#include <xsi_base.h>
Inheritance diagram for CBase:

Public Member Functions |
|
| CBase () | |
| virtual | ~CBase () |
| CString | GetClassIDName () const |
| virtual siClassID | GetClassID () const=0 |
| virtual bool | IsA (siClassID in_ClassID) const |
| bool | IsA (const CRef &in_ref) const |
| CStatus | SetObject (const CRef &in_obj) |
| bool | IsValid () const |
| void | ResetObject () |
| operator CRef & () | |
| bool | operator== (const CBase &in_obj) const |
| bool | operator!= (const CBase &in_obj) const |
| const CRef & | GetRef () const |
The RTTI is a mechanism that allows API classes to determine the type of reference objects during program execution. The API classes must be attached to compatible CRef objects in order to operate on XSI objects (CRef). A CRef object can only map to one XSI object at a time, an API class can only have one API class type. However, a CRef object can be compatible with many API classes. This compatibility model follows the hierarchy class, thus an CRef object of type siPolygonMeshID would be compatible with PolygonMesh, Geometry and SIObject API classes.
CRef objects expose the following functions for querying its underlying object class type and to determine its compatibility with a given API class: CRef::GetClassID and CRef::IsA.
CBase provides functions similar to CRef to determine if an API class is compatible with a given XSI object type or a specific CRef instance:
All API classes derive from CBase class. The virtual CBase::IsA function must be implemented by the derived classes.
using namespace XSI; // Forward declaration void GetSomeObjects( CRefArray& io_array, const Application& in_app ); Application app; CRefArray array; GetSomeObjects( array, app ); Geometry geom; Primitive prim; for ( LONG i=0; i<array.GetCount(); ++i ) { if ( array[i].IsA(siPrimitiveID) ) { prim.SetObject(array[i]); geom = prim.GetGeometry(); app.LogMessage( geom.GetName() + L" is a valid Geometry object: " + CValue(geom.IsValid()).GetAsText() ); app.LogMessage( L"Number of points on " + geom.GetName() + L": " + CValue(geom.GetPoints().GetCount()).GetAsText() ); } } //INFO : PolygonMesh is a valid Geometry object: true //INFO : Number of points on PolygonMesh: 8 //INFO : PolygonMesh is a valid Geometry object: true //INFO : Number of points on PolygonMesh: 26 // Fills an array with CRef objects void GetSomeObjects( CRefArray& io_array, const Application& in_app ) { X3DObject myCube; X3DObject myCone; Material myPhong; Model root = in_app.GetActiveSceneRoot(); root.AddGeometry( L"Cube", L"MeshSurface", L"", myCube ); root.AddGeometry( L"Cone", L"MeshSurface", L"", myCone ); myCone.AddMaterial( L"Phong", false, L"", myPhong ); // Add CRef items to the input array io_array.Add( myCube.GetActivePrimitive().GetRef() ); io_array.Add( myCone.GetActivePrimitive().GetRef() ); io_array.Add( myPhong.GetRef() ); }
API classes can also accept any kind of object without knowing how to operate on it. In such a case if the reference object passed to CBase::SetObject is incompatible then the API class will be put in an invalid state and all its functions would return an error.
using namespace XSI; Application app; CRefArray array; GetSomeObjects( array, app ); // use function defined in Example 1 Geometry geom; Primitive prim; for (LONG i = 0; i < array.GetCount(); ++i ) { prim.SetObject(array[i]); geom = prim.GetGeometry(); SIObject obj(array[i]); app.LogMessage( obj.GetName() + L" is a valid Geometry object: " + CValue(geom.IsValid()).GetAsText() ); app.LogMessage( L"Number of points on " + obj.GetName() + L": " + CValue(geom.GetPoints().GetCount()).GetAsText() ); }
Default destructor.
| CString GetClassIDName | ( | ) | const |
Returns the type of the API class in a text string,
Returns the type of the API class.
Implemented in ActionDelta, ActionDeltaItem, ActionSource, AnimationSourceItem, AnimationSource, Application, Argument, ArgumentArray, ArgumentHandler, ArrayParameter, Camera, CameraRig, ChainBone, ChainEffector, ChainElement, ChainRoot, Clip, ClipContainer, ClipEffect, ClipEffectItem, ClipRelation, Cluster, ClusterProperty, CClusterPropertyBuilder, Command, CommandArray, Constraint, Context, ControlPoint, CustomOperator, CustomProperty, Delta, Desktop, Dictionary, Directed, Edge, Envelope, EnvelopeWeight, EventInfo, Expression, Facet, Factory, FCurve, FCurveKey, FileReference, Filter, Framebuffer, Geometry, CGeometryAccessor, GraphicSequencerContext, GridData, GridWidget, Group, HairPrimitive, Image, ImageClip, ImageClip2, InputPort, Joint, Kinematics, KinematicState, CKnotArray, Layer, Layout, Library, Light, LightRig, MappedItem, Material, MaterialLibrary, Menu, MenuItem, CMeshBuilder, Mixer, Model, Null, NurbsCurve, NurbsCurveList, NurbsSample, NurbsSurface, NurbsSurfaceMesh, OGLLight, OGLMaterial, OGLTexture, Operator, OperatorContext, OutputPort, Parameter, Particle, ParticleAttribute, ParticleCloud, ParticleCloudPrimitive, ParticleType, Pass, PassContainer, Plugin, PluginItem, PluginRegistrar, Point, PointLocatorData, PolygonFace, PolygonMesh, PolygonNode, Port, PortGroup, PPGEventContext, PPGItem, PPGLayout, Preferences, Primitive, ProgressBar, Project, ProjectItem, Property, ProxyParameter, RenderChannel, Renderer, RendererContext, CRenderHairAccessor, Rig, CRigidBodyAccessor, CRigidConstraintAccessor, Sample, Scene, SceneItem, SceneRenderProperty, Segment, Selection, Shader, ShapeClip, ShapeKey, SimulationEnvironment, SIObject, Source, StaticKinematicState, StaticSource, SubComponent, Texture, TextureLayer, TextureLayerPort, TimeControl, TimerEvent, Track, Transition, Triangle, TriangleVertex, UIObject, UIPersistable, UIToolkit, UpdateContext, UserDataBlob, UserDataMap, Vertex, View, ViewContext, and X3DObject.
Returns true if a given class type is compatible with this API class.
| in_ClassID | Class type. |
Reimplemented in ActionDelta, ActionDeltaItem, ActionSource, AnimationSourceItem, AnimationSource, Application, Argument, ArgumentArray, ArgumentHandler, ArrayParameter, Camera, CameraRig, ChainBone, ChainEffector, ChainElement, ChainRoot, Clip, ClipContainer, ClipEffect, ClipEffectItem, ClipRelation, Cluster, ClusterProperty, CClusterPropertyBuilder, Command, CommandArray, Constraint, Context, ControlPoint, CustomOperator, CustomProperty, Delta, Desktop, Dictionary, Directed, Edge, Envelope, EnvelopeWeight, EventInfo, Expression, Facet, Factory, FCurve, FCurveKey, FileReference, Filter, Framebuffer, Geometry, CGeometryAccessor, GraphicSequencerContext, GridData, GridWidget, Group, HairPrimitive, Image, ImageClip, ImageClip2, InputPort, Joint, Kinematics, KinematicState, CKnotArray, Layer, Layout, Library, Light, LightRig, MappedItem, Material, MaterialLibrary, Menu, MenuItem, CMeshBuilder, Mixer, Model, Null, NurbsCurve, NurbsCurveList, NurbsSample, NurbsSurface, NurbsSurfaceMesh, OGLLight, OGLMaterial, OGLTexture, Operator, OperatorContext, OutputPort, Parameter, Particle, ParticleAttribute, ParticleCloud, ParticleCloudPrimitive, ParticleType, Pass, PassContainer, Plugin, PluginItem, PluginRegistrar, Point, PointLocatorData, PolygonFace, PolygonMesh, PolygonNode, Port, PortGroup, PPGEventContext, PPGItem, PPGLayout, Preferences, Primitive, ProgressBar, Project, ProjectItem, Property, ProxyParameter, RenderChannel, Renderer, RendererContext, CRenderHairAccessor, Rig, CRigidBodyAccessor, CRigidConstraintAccessor, Sample, Scene, SceneItem, SceneRenderProperty, Segment, Selection, Shader, ShapeClip, ShapeKey, SimulationEnvironment, SIObject, Source, StaticKinematicState, StaticSource, SubComponent, Texture, TextureLayer, TextureLayerPort, TimeControl, TimerEvent, Track, Transition, Triangle, TriangleVertex, UIObject, UIPersistable, UIToolkit, UpdateContext, UserDataBlob, UserDataMap, Vertex, View, ViewContext, and X3DObject.
| bool IsA | ( | const CRef & | in_ref | ) | const |
Returns true if a given CRef object is compatible with this API class.
| in_ref | CRef object. |
Sets this API class object with a reference object.
| in_obj | CRef object. |
CStatus::Fail Failure
Returns true if the object is valid.
Resets this API class by deleting its CRef object.
Converts from CBase to a CRef reference object..
Equality operator
| in_obj | API class object to compare. |
Inequality operator
| in_obj | API class object to compare. |
Converts from CBase to a constant CRef reference object.