AlClusterable
Encapsulates methods common to Alias objects that can belong to clusters.
Synopsis
#include <AlClusterable.h>
class AlClusterable
virtual AlCluster* firstCluster() const;
virtual AlCluster* nextCluster( const AlCluster* ) const;
virtual AlCluster* prevCluster( const AlCluster* ) const;
virtual statusCode nextClusterD( AlCluster* ) const;
virtual statusCode prevClusterD( AlCluster* ) const;
virtual statusCode applyIteratorToClusters( AlIterator*, int& );
statusCode addToCluster( AlCluster*, double = 1.0 );
statusCode removeFromCluster( AlCluster* );
statusCode removeFromAllClusters();
AlClusterMember* isClusterMember( AlCluster* ) const;
double percentEffect( AlCluster* ) const;
statusCode setPercentEffect( AlCluster*, double );
Description
This class is a base class for all objects which can be contained in a cluster. It provides the methods necessary to access the cluster methods of these objects.
Summary
AlCluster* AlClusterable::firstCluster() const
Description
Finds and returns the first cluster of which this object is a member. If no such cluster can be found, NULL is returned.
AlCluster* AlClusterable::nextCluster( const AlCluster* lastCluster ) const
Description
Finds and returns the cluster following the given one of which this object is a member. If no such cluster can be found, NULL is returned.
Argument
< lastCluster - Cluster to walk forward from
AlCluster* AlClusterable::prevCluster( const AlCluster* lastCluster ) const
Description
Finds and returns the cluster preceeding the given one of which this object is a member. If no such cluster can be found, NULL is returned.
Argument
< lastCluster - Cluster to walk forward from
statusCode AlClusterable::nextClusterD( AlCluster* lastCluster ) const
Description
Destructively sets the passed-in cluster to the next cluster for the given object. If this can not be accomplished, the passed-in cluster is unaffected.
Argument
< lastCluster - Cluster to walk forward from
Return codes
sSuccess - the cluster now points to the next cluster
sInvalidArgument - 'lastCluster' was invalid or NULL
sFailure - there was no next cluster
statusCode AlClusterable::prevClusterD( AlCluster* lastCluster ) const
Description
Finds and returns the cluster preceeding the given one of which this object is a member. If no such cluster can be found, NULL is returned.
Argument
< lastCluster - Cluster to walk forward from
Return codes
sSuccess - the cluster now points to the previous cluster
sInvalidArgument - 'lastCluster' was invalid or NULL
sFailure - there was no previous cluster
statusCode AlClusterable::applyIteratorToClusters( AlIterator* iter, int &rc )
Description
Apply the given iterator to all the clusters in this object. See the documentation for AlIterator. Warning: be careful when using this iterator. If you modify the actual cluster 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 cluster. But deleting a cluster using this method is considered unsafe. If you do it, return immediately.
Arguments
< iter - the iterator to apply to each cluster
> rc - the return from the last application of the iterator
Return codes
sSuccess - the application of the iterator terminated normally
sFailure - the application of the iterator terminated abnormally
sInvalidArgument - the iterator was NULL.
double AlClusterable::percentEffect( AlCluster* cluster ) const
Description
Returns the percentage effect this cluster has on the given object. If the call fails, 0.0 is returned.
Arguments
< clustobj - is the object whose percentage is to be found
statusCode AlClusterable::setPercentEffect( AlCluster* cluster, double percentage )
Description
Sets the percentage effect this cluster has on all things below the given object
Arguments
< cluster - is the object whose children are to have their cluster percentage effects set
Return codes
sSuccess - if everything successful
sInvalidArgument - 'clustobj' was NULL.
sFailure - if the percentage effect setting failed
sInvalidObject - the cluster was not valid
statusCode AlClusterable::addToCluster( AlCluster* cluster, double percentage /* = 1.0 */)
Description
Adds this clusterable object to a cluster. This means that all CVs under this dag are affected by the cluster. The percentage defines how much of the cluster's transformation is applied to the CVs under the dag node. A value of 1.0 means that the object's CVs are affected 100% by the cluster leaf transformations.
The method may fail if unable to create a cluster member object, or if the addition of the object would create a cycle of clusters, or if the object to be added is already in the cluster, or if the object to be added already has an ancestor in the same target cluster.
Arguments
< cluster - is the cluster to add this object to
< percentage - the extent of the effect of the cluster on the object's CVs.
A value of 1.0 means 100%.
Return codes
sSuccess - if everything was successful
sInvalidArgument - cluster was NULL.
sFailure - failed for one of the reasons outlined above
sInvalidObject - the cluster was invalid
sInsufficientMemory - if not enough memory
statusCode AlClusterable::removeFromCluster( AlCluster* cluster )
Description
Removes this object from the cluster.
Arguments
< cluster - the cluster to remove this object from.
Return codes
sSuccess - if everything successful
sInvalidObject - if the cluster is not valid
sInvalidArgument - clustobj was not valid
AlClusterMember* AlClusterable::isClusterMember( AlCluster* cluster ) const
Description
Finds the AlClusterMember that corresponds to the relationship between this object and the cluster object. NULL is returned if the object is not a member of the cluster or the cluster is not valid.
Arguments
< cluster - is the cluster object to be checked.
statusCode AlClusterable::removeFromAllClusters()
Description
Removes this object from all clusters in the universe that it may be in.
Return codes
sSuccess - the object was successfully removed from all clusters.
sInvalidArgument - the object was not valid.
aliasdocs@aw.sgi.com
Copyright © 1996, Alias|Wavefront, a Silicon Graphics Company. All rights
reserved.