A class for maintaining a persistent ID on an object.
#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 &);
Sometimes it may be 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, and so on.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.