Public Types | Public Member Functions
CICEPortState Class Reference

Detailed Description

CICEPortState is used for accessing the state of a custom ICENode input port from the cb_ICENode_BeginEvaluate BeginEvaluate callback.

dirty states:checking for port changes The state information is normally used by custom nodes for managing internal cache in order to optimize the computation and improve performance. The following port states are supported:

Tip:
CICEPortState::siAnyDirtyState can be used to test if at least one state is dirty.
Note:
CICEPortState cannot be used in the cb_ICENode_Evaluate Evaluate callback.
Since:
8.0 (2010)
Example:
This example logs the dirty state information of input ports by using the CICEPortState class. For a more detailed example see the CustomICENodes/netview_CustomICENodes PortStateObserver custom ICE node example
    XSIPLUGINCALLBACK CStatus Port_State_Observer_BeginEvaluate( ICENodeContext& in_ctxt )
    {
        CICEPortState portGeomGroup( in_ctxt, ID_IN_GeometryGroup );
        CICEPortState portGeomCurve( in_ctxt, ID_IN_NurbsCurve );
        CICEPortState portGeomMesh( in_ctxt, ID_IN_MeshSurf );
        CICEPortState portGeomNurbsSurf( in_ctxt, ID_IN_NurbsSurf );
        CICEPortState portGeomCloud( in_ctxt, ID_IN_PointCloud );
        CICEPortState data( in_ctxt, ID_IN_Data );

        double dCurrentFrame = in_ctxt.GetTime();
        LogPortStates( portGeomGroup, L"GeometryGroup", dCurrentFrame );
        LogPortStates( portGeomCurve, L"NurbsCurve", dCurrentFrame );
        LogPortStates( portGeomMesh, L"MeshSurf", dCurrentFrame );
        LogPortStates( portGeomNurbsSurf, L"NurbsSurf", dCurrentFrame );
        LogPortStates( portGeomCloud, L"PointCloud", dCurrentFrame );
        LogPortStates( data, L"Data", dCurrentFrame );
        return CStatus::OK;
    }

    static void LogPortStates( CICEPortState& in_port, const CString& in_portName, double in_dCurrentFrame )
    {
        if ( in_port.IsDirty( CICEPortState::siAnyDirtyState ) )
        {
            bool bTypeDirtyState = in_port.IsDirty( CICEPortState::siTypeDirtyState );
            bool bDataDirtyState = in_port.IsDirty( CICEPortState::siDataDirtyState );
            bool bTimeDirtyState = in_port.IsDirty( CICEPortState::siTimeDirtyState );

            in_port.ClearState();

            Application app;

            // Don't log redundant information:
            // bTypeDirtyState always implies bDataDirtyState + bTimeDirtyState
            // bDataDirtyState always implies bTimeDirtyState

            if ( bTypeDirtyState)
            {
                app.LogMessage( ">>> Port " + in_portName + " siTypeDirtyState at frame " + CString(in_dCurrentFrame) + " is dirty" );
            }
            else
            {
                if ( bDataDirtyState)
                {
                    app.LogMessage( ">>> Port " + in_portName + " siDataDirtyState at frame " + CString(in_dCurrentFrame) + " is dirty" );
                }
                else if ( bTimeDirtyState)
                {
                    app.LogMessage( ">>> Port " + in_portName + " siTimeDirtyState at frame " + CString(in_dCurrentFrame) + " is dirty" );
                }
            }
        }
    }

#include <xsi_iceportstate.h>

List of all members.

Public Types

enum   DirtyState {
  siTypeDirtyState = 1<<0,
  siDataDirtyState = 1<<1,
  siTimeDirtyState = 1<<2,
  siAnyDirtyState = siTypeDirtyState|siDataDirtyState|siTimeDirtyState
}

Public Member Functions

  CICEPortState (ICENodeContext &in_ctxt, ULONG in_nInputPortID, ULONG in_nInstanceIndex=0)
  CICEPortState ()
  ~CICEPortState ()
  CICEPortState (const CICEPortState &in_obj)
bool  operator== (const CICEPortState &in_obj) const
bool  operator!= (const CICEPortState &in_obj) const
CICEPortState operator= (const CICEPortState &in_obj)
bool  IsValid () const
bool  IsDirty (unsigned short in_flag=siAnyDirtyState) const
void  ClearState ()

Member Enumeration Documentation

enum DirtyState

Defines the supported dirty port state types.

Enumerator:
siTypeDirtyState 

Port type change. This state is true if the port connection type has changed. When siTypeDirtyState is true all other states are also true.

siDataDirtyState 

Data change. This state is true when the data going through the port has been modified. siTimeDirtyState is always true when siDataDirtyState is set to true.

siTimeDirtyState 

Time change. This state is true if the input data is animated and the time line has changed.

siAnyDirtyState 

Any type.


Constructor & Destructor Documentation

CICEPortState ( ICENodeContext in_ctxt,
ULONG  in_nInputPortID,
ULONG  in_nInstanceIndex = 0 
)

Constructor for creating and initializing an instance of CICEPortState.

Parameters:
in_ctxt ICENode evaluation context.
in_nInputPortID Input port identifier.
in_nInstanceIndex The group instance of the port. Defaults to 0.

Default constructor.

Default destructor.

CICEPortState ( const CICEPortState in_obj )

Copy constructor.

Parameters:
in_obj constant class object.

Member Function Documentation

bool operator== ( const CICEPortState in_obj ) const

Equality operator. Tests whether the states on two ports are the same.

Parameters:
in_obj CICEPortState instance to compare.
Returns:
true if both objects are the same, false if different.
bool operator!= ( const CICEPortState in_obj ) const

Inequality operator. Tests whether the states on two ports are different.

Parameters:
in_obj CICEPortState instance to compare.
Returns:
true if both objects are different, false otherwise.
CICEPortState& operator= ( const CICEPortState in_obj )

Assignment operator. Assign this CICEPortState to another CICEPortState.

Parameters:
in_obj CICEPortState object to assign.
Returns:
A reference to new CICEPortState.
bool IsValid ( ) const

Returns true if the object is valid. Unless not created properly, the object is always valid.

Returns:
True if valid, false otherwise.
bool IsDirty ( unsigned short  in_flag = siAnyDirtyState ) const

Returns the dirty state of a port for a given state type defined in the CICEPortState::DirtyState enumerator. By default, IsDirty returns true if at least one of the port states is dirty or returns false otherwise.

Returns:
true if dirty, false otherwise.
void ClearState ( )

Clears the port states.


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