AlObject

Base class for all Alias Data types.

Synopsis

#include <AlObject.h>
class AlObject : protected AlHashable
virtual ~AlObject();
virtual AlObjectType type() const = 0;
virtual const char* name() const;
virtual statusCode setName( const char* );
virtual statusCode deleteObject();
virtual AlObject* copyWrapper() const;
// Down casting methods
virtual AlAnimatable* asAnimatablePtr();
virtual AlClusterable* asClusterablePtr();
virtual AlSettable* asSettablePtr();
virtual AlPickable* asPickablePtr();
virtual AlCamera* asCameraPtr();
virtual AlCameraNode* asCameraNodePtr();
virtual AlCluster* asClusterPtr();
virtual AlClusterNode* asClusterNodePtr();
virtual AlClusterMember* asClusterMemberPtr();
virtual AlCurveCV* asCurveCVPtr();
virtual AlCurve* asCurvePtr();
virtual AlCurveNode* asCurveNodePtr();
virtual AlCurveOnSurface* asCurveOnSurfacePtr();
virtual AlDagNode* asDagNodePtr();
virtual AlFace* asFacePtr();
virtual AlFaceNode* asFaceNodePtr();
virtual AlGroupNode* asGroupNodePtr();
virtual AlLight* asLightPtr();
virtual AlLightNode* asLightNodePtr();
virtual AlAmbientLight* asAmbientLightPtr();
virtual AlAreaLight* asAreaLightPtr();
virtual AlDirectionLight* asDirectionLightPtr();
virtual AlLinearLight* asLinearLightPtr();
virtual AlNonAmbientLight* asNonAmbientLightPtr();
virtual AlPointLight* asPointLightPtr();
virtual AlSpotLight* asSpotLightPtr();
virtual AlVolumeLight* asVolumeLightPtr();
virtual AlSphereLight* asSphereLightPtr();
virtual AlCylinderLight* asCylinderLightPtr();
virtual AlBoxLight* asBoxLightPtr();
virtual AlTorusLight* asTorusLightPtr();
virtual AlSurfaceCV* asSurfaceCVPtr();
virtual AlSurface* asSurfacePtr();
virtual AlSurfaceNode* asSurfaceNodePtr();
virtual AlSet* asSetPtr();
virtual AlSetMember* asSetMemberPtr();
virtual AlShader* asShaderPtr();
virtual AlTexture* asTexturePtr();
virtual AlEnvironment* asEnvironmentPtr();
virtual AlKeyframe* asKeyframePtr();
virtual AlStream* asStreamPtr();
virtual AlChannel* asChannelPtr();
virtual AlAction* asActionPtr();
virtual AlParamAction* asParamActionPtr();
virtual AlMotionAction* asMotionActionPtr();
virtual AlPolysetVertex* asPolysetVertexPtr();
virtual AlPolysetNode* asPolysetNodePtr();
virtual AlPolygon* asPolygonPtr();
virtual AlPolyset* asPolysetPtr();
virtual AlAttributes* asAttributesPtr();
virtual AlArcAttributes* asArcAttributesPtr();
virtual AlLineAttributes* asLineAttributesPtr();
virtual AlCurveAttributes* asCurveAttributesPtr();
virtual AlPlaneAttributes* asPlaneAttributesPtr();
virtual AlConicAttributes* asConicAttributesPtr();
virtual AlRevSurfAttributes* asRevSurfAttributesPtr();
virtual AlJoint* asJointPtr();
virtual AlConstraint* asConstraintPtr();
virtual AlPointConstraint* asPointConstraintPtr();
virtual AlOrientationConstraint*asOrientationConstraintPtr();
virtual AlAimConstraint* asAimConstraintPtr();
virtual AlTextureNode* asTextureNodePtr();
virtual AlShellNode* asShellNodePtr();
virtual AlShell* asShellPtr();
virtual AlTrimRegion* asTrimRegionPtr();
virtual AlTrimBoundary* asTrimBoundaryPtr();
virtual AlTrimCurve* asTrimCurvePtr();
virtual AlContact* asContactPtr();
virtual AlCommandRef* asCommandRefPtr();
virtual AlCommand* asCommandPtr();
virtual AlOrthographicCamera* asOrthographicCameraPtr();
virtual AlPerspectiveCamera* asPerspectiveCameraPtr();
virtual AlWindow* asWindowPtr();
virtual AlImagePlane* asImagePlanePtr();
virtual AlCharacterSpace* asCharacterSpacePtr();
virtual AlCharacter* asCharacterPtr();
virtual AlCharSnippet* asCharSnippetPtr();
virtual AlCharTransition* asCharTransitionPtr();
virtual AlIKHandle* asIKHandlePtr();
virtual AlIKHandleNode* asIKHandleNodePtr();

Description

This is an abstract base class which holds a reference to an anonymous data structure. Derived classes will initialize the reference to refer to a particular data structure. This class provides a mechanism for completely hiding the internal data structures from the user.

This class gives some homogeneity between several different classes by providing methods that derived classes will redefine so that the name and type of the object can be obtained and so that object downcasting can be done safely.

There are a group of functions (the 'downcasting' methods )for casting an AlObject to one of its derived classes. They have the form

Al{DerivedObject} *AlObject::as{DerivedObject}Ptr()
where {DerivedObject} is the name of the derived class.

All these functions return NULL in the base class, and the derived class of the appropriate type simply returns a pointer to itself. In this way, safe typecasting can be maintained.

Summary

AlObject::~AlObject()

Description

Destructor for AlObject class.

const char* AlObject::name() const

Description

Returns the name of the AlObject.

statusCode AlObject::setName( const char* )

Description

Sets the name for an AlObject.

Arguments

< name - the new name for the object

Return codes

sSuccess - everthing is okay

sFailure - the name could not be set

statusCode AlObject::deleteObject()

Description

Default deletion method for Alias objects. In general, calling this method on any object should delete the associated Alias object, and invalidate any OpenModel objects you have active that may reference that object.

Return codes (see individual classes for more detailed information)

sSuccess - object deleted

sFailure - object not deleted

AlObject *AlObject::copyWrapper() const

Description

This function returns a copy of the object upon which the method was called. The copy will have identical semantics to the passed-in object. Note that both OpenModel objects will still refer to the same Alias object. No new Alias data is created.

boolean AlIsValid( AlObject* obj )

Description

This is the central function to call to check that a given OpenModel pointer is in fact a valid object. Three checks will be performed - The first is done here, and simply checks that the pointer is non-null. The other two checks are done in the isValid method, which checks that the object's data field is valid, and finally that the object is in the currently active stage (universe).

Return codes

TRUE - the object is valid

FALSE - the object is invalid

return AlFriend::isValid( obj );

Description

This function should be called whenever you want to check whether two OpenModel pointers are referencing the same Alias object. Note that the two pointers may reference different OpenModel objects, but those objects may both reference the same Alias object. So use this function instead of just checking for pointer equality.

Returns

TRUE - the two objects point to the same Alias object

FALSE - the two objects point to different Alias objects





aliasdocs@aw.sgi.com
Copyright © 1996, Alias|Wavefront, a Silicon Graphics Company. All rights reserved.