Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

ArrayOfTaggedObjects Class Reference

#include <ArrayOfTaggedObjects.h>

Inheritance diagram for ArrayOfTaggedObjects::

TaggedObjectStorage List of all members.

Public Methods

 ArrayOfTaggedObjects (int size)
 ~ArrayOfTaggedObjects ()
int setSize (int newSize)
 public methods to populate a domain. More...

bool addComponent (TaggedObject *newComponent)
TaggedObjectremoveComponent (int tag)
 bool allowMutltipleTags = false);. More...

int getNumComponents (void) const
TaggedObjectgetComponentPtr (int tag)
TaggedObjectIter& getComponents ()
ArrayOfTaggedObjectsIter getIter ()
virtual TaggedObjectStoragegetEmptyCopy (void)
virtual void clearAll (bool invokeDestructor=true)
void Print (ostream &s, int flag=0)

Detailed Description

ArrayOfTaggedObjects is used as a container object to store and provide access to objects of type TaggedObject. A single one dimensional array is used to store the pointers to the objects. As a one dimensional array is used, certain ideas are tried to improve performance: (1) if the array needs to be larger to hold more components, the array size is doubled; (2) when adding/retrieving components, the array location given by the components tag is first checked; and (3) a boolean flag is used to keep track of whether all objects have been stored at the location given by the tags.\

}

Definition at line 64 of file ArrayOfTaggedObjects.h.


Constructor & Destructor Documentation

ArrayOfTaggedObjects::ArrayOfTaggedObjects ( int size )
 

Creates an array of size {sizeInitialArray} to hold pointers to the TaggedObject objects that will be added to the container. This array is created using {new()} to allow the array to grow as needed. Zeros this array and sets a number of integer values: (1) the size of the array; (2) the last position used in the array is ; (3) the position in the array through which all previous cells are being used for pointers is ; (4) the number of components added to the container is ; and (5) all components have been added at the position given by their tag. If not enough space is available, the warning method is invoked on the global ErrorHandler and the integer outlining the array size is set to .

Definition at line 42 of file ArrayOfTaggedObjects.cpp.

Referenced by getEmptyCopy().

ArrayOfTaggedObjects::~ArrayOfTaggedObjects ( )
 

If memory has been allocated for the array, the object invokes the destructor on the current array.

Definition at line 66 of file ArrayOfTaggedObjects.cpp.


Member Function Documentation

void ArrayOfTaggedObjects::Print ( ostream & s,
int flag = 0 ) [virtual]
 

To invoke {Print(s,flag)} on all objects which have been added to the container.

Reimplemented from TaggedObjectStorage.

Definition at line 388 of file ArrayOfTaggedObjects.cpp.

bool ArrayOfTaggedObjects::addComponent ( TaggedObject * newComponent ) [virtual]
 

{bool addComponent(TaggedObject *newComponent);}

Reimplemented from TaggedObjectStorage.

Definition at line 158 of file ArrayOfTaggedObjects.cpp.

Referenced by setSize().

void ArrayOfTaggedObjects::clearAll ( bool invokeDestructor = true ) [virtual]
 

To remove all objects from the container and {\bf to invoke the destructor on these objects} if {invokeDestructor} is {true}.

Reimplemented from TaggedObjectStorage.

Definition at line 355 of file ArrayOfTaggedObjects.cpp.

TaggedObject * ArrayOfTaggedObjects::getComponentPtr ( int tag ) [virtual]
 

To return a pointer to the TaggedObject whose identifier is given by {tag}. If tag is not too large and all components have been added nicely, the contents of the array at location {tag} is returned. Otherwise if the tag is not too large, the contents at position {tag} is first checked to see if it is pointing to an object and if this object has the same tag as {tag}, the object returned. If the object is not at it's nice location, the array is searched from the start to the position holding the last entry to see if the array points to the object with the appropriate tag. If it does the object is returned. If the object has not been found after the last possible location has been checked, is returned.

Reimplemented from TaggedObjectStorage.

Definition at line 296 of file ArrayOfTaggedObjects.cpp.

Referenced by addComponent().

TaggedObjectIter & ArrayOfTaggedObjects::getComponents ( void ) [virtual]
 

To return an iter for iterating through the objects that have been added to the container. Each container object has its own iter. This iter() is reset to point to the start and a reference to this iter is returned.

Reimplemented from TaggedObjectStorage.

Definition at line 322 of file ArrayOfTaggedObjects.cpp.

TaggedObjectStorage * ArrayOfTaggedObjects::getEmptyCopy ( void ) [virtual]
 

To return an empty copy of the container.

Reimplemented from TaggedObjectStorage.

Definition at line 342 of file ArrayOfTaggedObjects.cpp.

ArrayOfTaggedObjectsIter ArrayOfTaggedObjects::getIter ( )
 

Definition at line 332 of file ArrayOfTaggedObjects.cpp.

int ArrayOfTaggedObjects::getNumComponents ( void ) const [virtual]
 

Returns the number of components currently stored in the container.

Reimplemented from TaggedObjectStorage.

Definition at line 290 of file ArrayOfTaggedObjects.cpp.

TaggedObject * ArrayOfTaggedObjects::removeComponent ( int tag ) [virtual]
 

bool allowMutltipleTags = false);.

Reimplemented from TaggedObjectStorage.

Definition at line 220 of file ArrayOfTaggedObjects.cpp.

int ArrayOfTaggedObjects::setSize ( int newSize ) [virtual]
 

public methods to populate a domain.

Reimplemented from TaggedObjectStorage.

Definition at line 75 of file ArrayOfTaggedObjects.cpp.

Referenced by addComponent().


The documentation for this class was generated from the following files:
Copyright Contact Us