AlPersistentID

A class for maintaining a persistent ID on an object

Synopsis

#include <AlPersistentID.h>
class AlPersistentID
AlPersistentID();
AlPersistentID( AlPersistentID & );
AlPersistentID( int, int = -1, int = -1, int = -1 );
virtual ~AlPersistentID();
AlPersistentID &operator=( const AlPersistentID& );
void id( int &, int &, int &, int & );
friend int operator== (const AlPersistentID &, const AlPersistentID &);
friend int operator!= (const AlPersistentID &, const AlPersistentID &);

Description

Sometimes it is necessary to maintain a persistent ID on an object. The name of the object is inadequate for this since it may be changed by the user, changed when the file is loaded, etc. The AlPersistentID remains with the object through storing and retrieving, without ever being changed.

This ID is not unique, however. If the object is copied, or if a wire file is retrieved more than once (into one or several stages) the ID will be shared by all copies of the object.

Note that querying an ID from an object will actually return a copy of the object's ID. This ensures that the ID for an object does not get changed.

For efficiency, IDs are not created until the first time they are queried. As a result, copies of an object made before its ID is created will not have the same ID as the original object.

Summary

AlPersistentID::AlPersistentID()

Description

This constructor automatically sets the internal values for the ID. In general it is unnecessary to use either of the constructors for this class.

AlPersistentID::AlPersistentID( int value0, int value1, int value2, int value3 )

Description

This is the copy constructor for the AlPersistentID class. It creates a new AlPersistentID with the given values.

AlPersistentID::AlPersistentID(AlPersistentID &that)

Description

This is the copy constructor for the AlPersistentID class. It creates a new AlPersistentID with the same internal state as the given one.

AlPersistentID::~AlPersistentID()

Description

This is the destructor for the AlPersistentID class. Any AlPersistentID returned to you by class must be deleted.

AlPersistentID &AlPersistentID::operator=( const AlPersistentID &that )

Description

This is the assignment operator. It will copy the contents of one ID onto another.

void AlPersistentID::id( int &value0, int &value1, int &value2, int &value3 )

Description

This method returns the internal values of this class.





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