Public Member Functions
CustomOperator Class Reference

Detailed Description

The CustomOperator object represents a custom operator (ie., a scripted or compiled operator) in the scene graph.

See also:
OperatorContext, PortGroup, Port, InputPort, OutputPort
Since:
4.0

#include <xsi_customoperator.h>

Inheritance diagram for CustomOperator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  CustomOperator ()
  ~CustomOperator ()
  CustomOperator (const CRef &in_ref)
  CustomOperator (const CustomOperator &in_obj)
bool  IsA (siClassID in_ClassID) const
siClassID  GetClassID () const
CustomOperator operator= (const CustomOperator &in_obj)
CustomOperator operator= (const CRef &in_ref)
CString  GetFileName (void) const
CStatus  PutFileName (const CString &in_str)
CString  GetLanguage (void) const
CString  GetCode (void) const
CStatus  PutCode (const CString &code)
LONG  GetDebug (void) const
CStatus  PutDebug (LONG debug)
bool  GetAlwaysEvaluate (void) const
CStatus  PutAlwaysEvaluate (bool val)
CStatus  AddParameter (const CRef &in_paramdef, Parameter &io_parameter)
CStatus  RemoveParameter (const Parameter &in_param)
CRef  AddInputPort (const CRef &obj, const CString &name=CString(), LONG group=-1, LONG insertat=-1, LONG flags=0, CStatus *pst=0)
CRef  AddOutputPort (const CRef &obj, const CString &name=CString(), LONG group=-1, LONG insertat=-1, LONG flags=0, CStatus *pst=0)
CRefArray  AddIOPort (const CRef &obj, const CString &name=CString(), LONG group=-1, LONG insertat=-1, LONG flags=0, CStatus *pst=0)
CRef  AddPortGroup (const CString &name, LONG groupmin=1, LONG groupmax=1, const CString &filterid=CString(), const CString &pickprompt=CString(), LONG flags=0, CStatus *pst=0)
CStatus  Validate ()
CRef  AddInputPortByClassID (siClassID in_TargetClassID, const CString &in_strPortName=CString(), LONG in_PortGroup=-1, LONG in_InsertAt=0, LONG in_flags=0)
CRef  AddOutputPortByClassID (siClassID in_TargetClassID, const CString &in_strPortName=CString(), LONG in_PortGroup=-1, LONG in_InsertAt=0, LONG in_flags=0)
CRefArray  AddIOPortByClassID (siClassID in_TargetClassID, const CString &in_strPortName=CString(), LONG in_PortGroup=-1, LONG in_InsertAt=0, LONG in_flags=0)

Constructor & Destructor Documentation

Default constructor.

Default destructor.

CustomOperator ( const CRef in_ref )

Constructor.

Parameters:
in_ref constant reference object.
CustomOperator ( const CustomOperator 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 Operator.

siClassID GetClassID ( ) const [virtual]

Returns the type of the API class.

Returns:
The class type.

Reimplemented from Operator.

CustomOperator& operator= ( const CustomOperator 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 CustomOperator object.
CustomOperator& 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 CustomOperator object.

Reimplemented from Operator.

CString GetFileName ( void  ) const

Returns the filename of the script or module containing the implementation of the custom operator.

Returns:
The filename of the implementation script or module.
CStatus PutFileName ( const CString in_str )

Sets the filename of the script or module containing the implementation of the custom operator.

Parameters:
in_str The filename of the implementation script or module in a CString.
Returns:
CStatus
CString GetLanguage ( void  ) const

Returns the API type used by the implementation of the custom operator.

Returns:
The implementation language: COM, CPP, VBScript, JScript, PerlScript or Python
CString GetCode ( void  ) const

Returns the script code used by the custom operator implementation.

Note:
If the custom operator is compiled then an empty string is returned.
Returns:
The implementation script code.
Empty string for compiled operators
CStatus PutCode ( const CString code )

Sets the script code used by the custom operator implementation.

Note:
If the custom operator is compiled then CStatus::Fail is returned.
Parameters:
code A string containing the script code.
Returns:
CStatus::OK
CStatus::Fail for compiled operators
LONG GetDebug ( void  ) const

Returns non zero value if the custom operator is in debug mode.

Returns:
true for debug mode; false otherwise.
CStatus PutDebug ( LONG  debug )

Sets the debug mode of the operator. Pass a non zero value to set the operator in Debug mode. The operator list sends a message to the history log each time request data, notify and update are called.

Parameters:
debug 0 to disable messages; anything other LONG to enable them
Returns:
CStatus::OK
CStatus::Fail
bool GetAlwaysEvaluate ( void  ) const

Returns true if the custom operator will call Update on each notify.

Returns:
True if the custom operator will always call update on each notify.
CStatus PutAlwaysEvaluate ( bool  val )

Sets the operator to call Update on each time change.

Parameters:
val True to force the operator to evaluate on each time change.
Returns:
CStatus::OK
CStatus::Fail
CStatus AddParameter ( const CRef in_paramdef,
Parameter io_parameter 
)

Adds a new custom parameter to the custom operator object.

Parameters:
in_paramdef The parameter definition (created via Factory::CreateParamDef)
io_parameter Returns the new Parameter object.
Returns:
CStatus::OK success
CStatus::Fail failure
CStatus RemoveParameter ( const Parameter in_param )

Removes the specified custom parameter from the custom operator.

Parameters:
in_param Parameter to remove.
Returns:
CStatus::OK success
CStatus::Fail failure
CRef AddInputPort ( const CRef obj,
const CString name = CString(),
LONG  group = -1,
LONG  insertat = -1,
LONG  flags = 0,
CStatus pst = 0 
)

Adds an input port to the operator. The port is assumed to be return. The group will be automatically assigned if not specified.

Parameters:
obj The object to be connected to the port
name Name for the port.
group The index of the group to add port.
insertat Not implemented
flags A mask of input port flags described by siOptionalInputPort (see siPortFlags).
Return values:
pst The returned status code (CStatus::OK for success).
Returns:
A reference to the new InputPort.
CRef AddOutputPort ( const CRef obj,
const CString name = CString(),
LONG  group = -1,
LONG  insertat = -1,
LONG  flags = 0,
CStatus pst = 0 
)

Adds an output port to the operator. The port is assumed to be return. The group will be automatically assigned if not specified.

Parameters:
obj The object to be connected to the port
name Name for the port.
group The index of the group to add port.
insertat Not implemented
flags A mask of output port flags described by siCreatedOutputPort (see siPortFlags).
Return values:
pst The returned status code (CStatus::OK for success).
Returns:
A reference to the new InputPort.
CRefArray AddIOPort ( const CRef obj,
const CString name = CString(),
LONG  group = -1,
LONG  insertat = -1,
LONG  flags = 0,
CStatus pst = 0 
)

Adds an input/output port to the operator. The port is assumed to be return. The group will be automatically assigned if not specified.

Parameters:
obj The object to be connected to the port
name Name for the port. The output port name is prefixed with Out and the input port with In.
group The index of the group to add port.
insertat Not implemented
flags A mask of port flags described by siOptionalInputPort + siCreatedOutputPort (see siPortFlags).
Return values:
pst The returned status code (CStatus::OK for success).
Returns:
Array of references to the newly created input and output ports.
CRef AddPortGroup ( const CString name,
LONG  groupmin = 1,
LONG  groupmax = 1,
const CString filterid = CString(),
const CString pickprompt = CString(),
LONG  flags = 0,
CStatus pst = 0 
)

Adds a port group to operator. If the operator has branch group support then the filter must also match the group as well as the allowed components; otherwise groups will be rejected when Operator::Connect is called.

Parameters:
name Name of the port group.
groupmin Minimum number of objects required for a connection.
groupmax Maximum number of objects allowed to be connected.
filterid The filter string id, this is the same name used to look up filters.
pickprompt String to show user during picking session
flags Port flags (see siPortFlags).
Return values:
pst The returned status code (CStatus::OK for success).
Returns:
A reference to the new PortGroup.
CStatus Validate ( )

Tests whether the operator contains a valid port definition and syntactically correct code. Note: This method is not implemented for Self-Installed Custom Operators.

Returns:
CStatus::OK success
CStatus::Fail failure
CRef AddInputPortByClassID ( siClassID  in_TargetClassID,
const CString in_strPortName = CString(),
LONG  in_PortGroup = -1,
LONG  in_InsertAt = 0,
LONG  in_flags = 0 
)

Adds an input port to the operator. This function makes it possible to define a connection to a custom operator by specifying the type of object it needs to connect to, rather than providing an existing object.

This is for use in advanced operators, where the port may be optional and dynamically connected after the Operator is instantiated. Each port defined in this way must be in its own PortGroup so that the connection can be established through Operator::ConnectToGroup.

For example, if an operator supports an optional connection to a ClusterProperty, the CustomOperator::AddInputPort function forces the existence of a ClusterProperty at the time of the operator definition, even if the operator is not meant to connect to a ClusterProperty until some later time. This function avoids the need for any ClusterProperty to actually exist in the scene.

Parameters:
in_TargetClassID The type of object that can connect to this object, for example siKinematicStateID, siClusterPropertyID, siParameterID or siPrimitiveID.
in_strPortName The name of the port. If empty a name is automatically generated.
in_PortGroup Index of the port group that will contain the new port
in_InsertAt Not implemented
in_flags Mask of port group flags from the siPortFlags enum
Returns:
A reference to the new InputPort
Since:
5.1
CRef AddOutputPortByClassID ( siClassID  in_TargetClassID,
const CString in_strPortName = CString(),
LONG  in_PortGroup = -1,
LONG  in_InsertAt = 0,
LONG  in_flags = 0 
)

Adds an OutputPort to the custom operator. This function makes it possible to define a connection to a custom operator by specifying the type of object it will connect to, rather than providing an actual existing object as is the case with CustomOperator::AddOutputPort. This is for use in advanced operators, where the port may be optional and dynamically connected after the operator is instantiated.

Note:
Use of this function is rarely necessary because an operator must connect to at least one output at the time of creation, and normally only has only one output.
Parameters:
in_TargetClassID The type of object that can connect to this object, for example siKinematicStateID, siClusterPropertyID, siParameterID or siPrimitiveID.
in_strPortName The name of the port. If empty a name is automatically generated.
in_PortGroup Index of the port group that will contain the new port
in_InsertAt Not implemented
in_flags Mask of port group flags from the siPortFlags enum
Returns:
A reference to the new OutputPort
Since:
5.1
CRefArray AddIOPortByClassID ( siClassID  in_TargetClassID,
const CString in_strPortName = CString(),
LONG  in_PortGroup = -1,
LONG  in_InsertAt = 0,
LONG  in_flags = 0 
)

Adds an InputPort and an OutputPort to the custom operator. This function makes it possible to define a connection to a custom operator by specifying the type of object it needs to connect to, rather than providing an actual existing object as is the case with CustomOperator::AddIOPort. This is for use in advanced operators, where the port may be optional and dynamically connected after the operator is instantiated.

Parameters:
in_TargetClassID The type of object that can connect to this object, for example siKinematicStateID, siClusterPropertyID, siParameterID or siPrimitiveID.
in_strPortName The name of the port. If empty a name is automatically generated.
in_PortGroup Index of the port group that will contain the new port
in_InsertAt Not implemented
in_flags Mask of port group flags from the siPortFlags enum
Returns:
An array of references to the new InputPort and OutputPort
Since:
5.1

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