A portgroup is a group of Port objects on an Operator. The port group is a logical grouping of multiple port connections that are normally scoped by an X3DObject. A single portgroup can contain both InputPort and OutputPort objects.
You can determine the number of port groups defined by an operator using the Operator::GetNumPortGroups function and determine the number of ports in a PortGroup using the Operator::GetNumPortsInGroup function.
For built-in Operators the port groups contain all ports that will be connected to parts of the selected or picked object. For example, when the Twist operator is applied to a selected object, the operator has ports that read from the object's local KinematicState and Geometry and write to the result object's geometry.
However, for typical Self-Installed Custom Operators, all outputs and inputs can be in a single PortGroup because the individual targets for each port are specifically provided at the time of calls to CustomOperator::AddInputPort or the AddCustomOp command. In fact, the concept of PortGroup can be completely ignored for most custom operators. However any dynamic input inside an advanced operators should be in its own PortGroup to permit usage of Operator::ConnectToGroup.
Multiple objects can connect to the same port group, for example, the loft operator may read from many curves to generate the resulting mesh. Each of these input curves are connected to the same port group and each connection is called a port group instance. You can determine the number of objects connected to a port group by using Operator::GetNumInstancesInGroup or PortGroup::GetInstanceCount.
Use SIObject::GetParent to get the Operator for this PortGroup and SIObject::GetName to get the name of this port group.
From the port you can determine which port group a port belongs to using the Port::GetGroupName or Port::GetGroupIndex functions. You can determine which port group instance a port belongs to using the Port::GetGroupInstance function.
#include <xsi_portgroup.h>
Public Member Functions | |
PortGroup () | |
~PortGroup () | |
PortGroup (const CRef &in_ref) | |
PortGroup (const PortGroup &in_obj) | |
bool | IsA (siClassID in_ClassID) const |
siClassID | GetClassID () const |
PortGroup & | operator= (const PortGroup &in_obj) |
PortGroup & | operator= (const CRef &in_ref) |
bool | IsOptional (LONG in_port=-1) const |
LONG | GetIndex () const |
LONG | GetMin () const |
LONG | GetMax () const |
LONG | GetFlags () const |
CString | GetPickPrompt () const |
CString | GetFilter () const |
CRefArray | GetPorts () const |
LONG | GetInstanceCount () const |
bool | SupportsBranchGroup (LONG in_port=-1) const |
CRef | AddInputPort (const CRef &target, const CString &name=CString(), LONG insertat=-1, LONG flags=0, CStatus *pst=0) |
CRef | AddOutputPort (const CRef &target, const CString &name=CString(), LONG insertat=-1, LONG flags=0, CStatus *pst=0) |
CRefArray | AddIOPort (const CRef &target, const CString &name=CString(), LONG insertat=-1, LONG flags=0, CStatus *pst=0) |
PortGroup | ( | ) |
Default constructor.
~PortGroup | ( | ) |
Default destructor.
bool IsA | ( | siClassID | in_ClassID | ) | const [virtual] |
Returns true if a given class type is compatible with this API class.
in_ClassID | class type. |
Reimplemented from SIObject.
siClassID GetClassID | ( | ) | const [virtual] |
Creates an object from another object. The newly created object is set to empty if the input object is not compatible.
in_obj | constant class object. |
bool IsOptional | ( | LONG | in_port = -1 | ) | const |
Returns true if all the ports are optional
in_port | index of port to test; otherwise all ports are checked. |
LONG GetIndex | ( | ) | const |
Returns the port index in port group.
LONG GetMin | ( | ) | const |
Returns the minimum number of objects required for a connection
LONG GetMax | ( | ) | const |
Returns the maximum number of objects allowed to be connected.
LONG GetFlags | ( | ) | const |
Returns the flags used to determine which is the main group, created group, secondary group, optional group.
CString GetPickPrompt | ( | ) | const |
Returns the pick prompt string, this is the string displayed in the status bar when a picking session is started to pick objects to be connected to the operator.
CString GetFilter | ( | ) | const |
Returns the filter string id, this is the same name used to look up filters .
CRefArray GetPorts | ( | ) | const |
Returns a collection of all ports defined for this group .
LONG GetInstanceCount | ( | ) | const |
Returns the number of object connected to this group.
bool SupportsBranchGroup | ( | LONG | in_port = -1 | ) | const |
Returns true if the port group has ports that support branch and group connections.
in_port | Index of port to test; otherwise all ports are checked. |
CRef AddInputPort | ( | const CRef & | target, |
const CString & | name = CString() , |
||
LONG | insertat = -1 , |
||
LONG | flags = 0 , |
||
CStatus * | pst = 0 |
||
) |
Adds input port to operator port group. The port is assumed to be mandatory.
target | Object to be connected to the port. |
name | Port name. |
insertat | Port index within group. |
flags | Mask of input port flags described by siPortFlags. |
pst | The returned status code, returns CStatus::OK for success. |
CRef AddOutputPort | ( | const CRef & | target, |
const CString & | name = CString() , |
||
LONG | insertat = -1 , |
||
LONG | flags = 0 , |
||
CStatus * | pst = 0 |
||
) |
Adds output port to operator port group. The port is assumed to be mandatory.
target | Object to be connected to the port. |
name | Port name. |
insertat | Port index within group. |
flags | Mask of output port flags described by siPortFlags. |
pst | The returned status code, returns CStatus::OK for success. |
CRefArray AddIOPort | ( | const CRef & | target, |
const CString & | name = CString() , |
||
LONG | insertat = -1 , |
||
LONG | flags = 0 , |
||
CStatus * | pst = 0 |
||
) |
Adds output port to operator port group. The port is assumed to be mandatory.
target | Object to be connected to the port. |
name | Port name. |
insertat | Port index within group. |
flags | Mask of port flags described by siPortFlags. |
pst | The returned status code, returns CStatus::OK for success. |