Public Member Functions
PortGroup Class Reference

## Detailed Description

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.

Note:
  The PortGroup object should not be confused with the Group object.

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.

See also:
  Operator, OperatorContext, SIObject, InputPort, OutputPort

Since:
  4.0

`#include <xsi_portgroup.h>`

Inheritance diagram for PortGroup:
[legend]

List of all members.

## 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)

## Constructor & Destructor Documentation

PortGroup | ( |  | ) |

Default constructor.

~PortGroup | ( |  | ) |

Default destructor.

PortGroup | ( | const CRef & | in_ref | ) |

Constructor.

Parameters:

  in_ref | constant reference object.

PortGroup | ( | const PortGroup & | in_obj | ) |

Copy constructor.

Parameters:

  in_obj | constant class object.

## Member Function Documentation

bool IsA | ( | siClassID | in_ClassID | ) | const`[virtual]`

Returns true if a given class type is compatible with this API class.

Parameters:

  in_ClassID | class type.

Returns:
  true if the class is compatible, false otherwise.

Reimplemented from SIObject.

siClassID GetClassID | ( |  | ) | const`[virtual]`

Returns the type of the API class.

Returns:
  The class type.

Reimplemented from SIObject.

PortGroup& operator= | ( | const PortGroup & | in_obj | ) |

Creates an object from another object. The newly created object is set to empty if the input object is not compatible.

Parameters:

  in_obj | constant class object.

Returns:
  The new PortGroup object.

PortGroup& operator= | ( | const CRef & | in_ref | ) |

Creates an object from a reference object. The newly created object is set to empty if the input reference object is not compatible.

Parameters:

  in_ref | constant class object.

Returns:
  The new PortGroup object.

Reimplemented from SIObject.

bool IsOptional | ( | LONG | in_port = `-1` | ) | const

Returns true if all the ports are optional

Parameters:

  in_port | index of port to test; otherwise all ports are checked.

Returns:
  true if connected.

LONG GetIndex | ( |  | ) | const

Returns the port index in port group.

Returns:
  LONG > 0 success
  -1 failure

LONG GetMin | ( |  | ) | const

Returns the minimum number of objects required for a connection

Returns:
  LONG > 0 success
  -1 failure

LONG GetMax | ( |  | ) | const

Returns the maximum number of objects allowed to be connected.

Returns:
  LONG > 0 success
  -1 failure

LONG GetFlags | ( |  | ) | const

Returns the flags used to determine which is the main group, created group, secondary group, optional group.

Returns:
  LONG > 0 success
  -1 failure

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.

Returns:
  The pick prompt string (empty on failure or if no pick string was specified).

CString GetFilter | ( |  | ) | const

Returns the filter string id, this is the same name used to look up filters .

Returns:
  The filter name (empty on failure or if no pick string was specified).

CRefArray GetPorts | ( |  | ) | const

Returns a collection of all ports defined for this group .

Returns:
  The collection of Port objects (empty on failure or objects connected).

LONG GetInstanceCount | ( |  | ) | const

Returns the number of object connected to this group.

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.

Parameters:

  in_port | Index of port to test; otherwise all ports are checked.

Returns:
  true if the port group has ports that support branch and group connections.

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.

Deprecated:
  5.1 This method is obsolete and must not be used. Use CustomOperator::AddInputPort instead.

Parameters:

  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.

Return values:

  pst | The returned status code, returns CStatus::OK for success.

Returns:
  A reference to the new InputPort.

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.

Deprecated:
  5.1 This method is obsolete and must not be used. Use CustomOperator::AddOutputPort instead.

Parameters:

  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.

Return values:

  pst | The returned status code, returns CStatus::OK for success.

Returns:
  A reference to the new OutputPort.

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.

Deprecated:
  5.1 This method is obsolete and must not be used. Use CustomOperator::AddIOPort instead.

Parameters:

  target | Object to be connected to the port.
  name | Port name.
  insertat | Port index within group.
  flags | Mask of port flags described by siPortFlags.

Return values:

  pst | The returned status code, returns CStatus::OK for success.

Returns:
  Array of references to the new input and output ports.

The documentation for this class was generated from the following file:

- xsi_portgroup.h