AlSettable
 
 
 

Encapsulates methods common to Alias objects that can belong to sets.

Synopsis

#include <AlSettable.h>
class AlSettable
virtual AlSet*	firstSet() const;
virtual AlSet*	nextSet( const AlSet* ) const;
virtual AlSet*	prevSet( const AlSet* ) const;
virtual statusCode	nextSetD( AlSet* ) const;
virtual statusCode	prevSetD( AlSet* ) const;
virtual statusCode	applyIteratorToSets( AlIterator*, int& );
statusCode	removeFromAllSets();
statusCode	removeFromSet( AlSet *set );
statusCode	addToSet( AlSet *set );
AlSetMember*	isSetMember( const AlSet *set ) const;

Description

This class is a base class for all objects which can be contained in a set. It provides the methods necessary to access the set methods of these objects.

AlSet* AlSettable::firstSet() const

Description

Finds and returns the first set of which this object is a member. If no such set can be found, NULL is returned.

AlSet* AlSettable::nextSet( const AlSet* lastSet ) const

Description

Finds and returns the set following the given one of which this object is a member. If no such set can be found, NULL is returned.

Argument

< lastSet - set to walk forward from

AlSet* AlSettable::prevSet( const AlSet* lastSet ) const

Description

Finds and returns the set preceding the given one of which this object is a member. If no such set can be found, NULL is returned.

Argument

< lastSet - set to walk forward from

statusCode AlSettable::nextSetD( AlSet* lastSet ) const

Description

Destructively points lastSet to the next set for the given object.

Argument

< lastSet - set to walk forward from

Return Codes

sSuccess - the set wrapper points to the next set

sInvalidArgument - ’lastSet’ is invalid or NULL

sFailure - there is no next set

statusCode AlSettable::prevSetD( AlSet* lastSet ) const

Description

Destructively points lastSet to the previous set for the given object. If this can not be accomplished, then lastSet is unaffected.

Argument

< lastSet - set to walk backward from

Return Codes

sSuccess - lastSet points to the previous set for the given object

sInvalidArgument - ’lastSet’ is invalid or NULL

sFailure - there is no previous set

statusCode AlSettable::applyIteratorToSets( AlIterator* iter, int &rc )

Description

Applies the given iterator to all the sets affected by this object. See the documentation for AlIterator.

Warning: be careful when using this iterator. If you modify the actual set during an iteration, it is possible that this routine will end up pointing to invalid data and send you garbage. This should not happen when simply applying transformations to a set. But deleting a set using this method is considered unsafe. If you do it, return immediately.

Arguments

< iter - the iterator to apply to each set

> rc - the value returned from the last application of the iterator

Return Codes

sSuccess - the applyIteratorToSets exited normally

sFailure - applyIteratorToSets exited abnormally

sInvalidArgument - iter is NULL

statusCode AlSettable::addToSet( AlSet *set )

Description

Adds this object to the set

Arguments

< set - set to add to

Return Codes

sSuccess - successfully added to the set

sInsufficientMemory - not enough memory available

sObjectInSet - this object already belongs to this set

sObjectInAnotherSet - this set is exclusive and this object already belongs to another set

sObjectInExclusiveSet - this object already belongs to an exclusive set

sObjectAncestorInSet - an ancestor of this object already belongs to this set

sObjectDescendentInSet - a descendent of this object already belongs to this set

sInvalidArgument - set was NULL

sInvalidObject - this object was invalid

statusCode AlSettable::removeFromSet( AlSet *set )

Description

Removes this object from the set. If the given DAG node was not found in the set, then nothing is removed.

Arguments

< set - the set to remove from

Return Codes

sSuccess - if this object was removed successfully

sInvalidArgument - set was invalid

sObjectNotAMember - if the object was not found in this set

sInvalidObject - the set is invalid

AlSetMember *AlSettable::isSetMember( const AlSet *set ) const

Description

Returns TRUE if this object is a member of the given set.

Arguments

< set - the object to test membership in

statusCode AlSettable::removeFromAllSets()

Description

Removes this object from all sets in the universe that it may be in.

Return Codes

sSuccess - object was removed from all sets