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

ArrayOfTaggedObjects.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:30 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/tagged/storage/ArrayOfTaggedObjects.h,v $
00024                                                                         
00025                                                                         
00026 #ifndef ArrayOfTaggedObjects_h
00027 #define ArrayOfTaggedObjects_h
00028 
00029 // File: ~/tagged/storage/ArrayOfTaggedObjects.h
00030 // 
00031 // Written: fmk 
00032 // Created: 11/96
00033 // Revision: A
00034 //
00035 // Description: This file contains the class definition for 
00036 // ArrayOfTaggedObjects. ArrayOfTaggedObjects is a storage class. The class 
00037 // is responsible for holding and providing access to objects of type 
00038 // TaggedObject. The data structure used to hold the objects is a simple 
00039 // array of pointers. As a one dimensional array is used certain ideas are tried 
00040 // to improve performance: (1) if the array needs to be larger to hold more 
00041 // components, the array size is doubled and (2) when adding/retrieving components,
00042 // the array location given by the components tag is first checked. 
00043 //
00044 // What: "@(#) ArrayOfTaggedObjects.h, revA"
00045 
00046 
00047 #include <TaggedObjectStorage.h>
00048 #include <ArrayOfTaggedObjectsIter.h>
00049 
00064 class ArrayOfTaggedObjects : public TaggedObjectStorage
00065 {
00066   public:
00080     ArrayOfTaggedObjects(int size);
00081 
00086     ~ArrayOfTaggedObjects();    
00087 
00088 
00090     int  setSize(int newSize);
00096     bool addComponent(TaggedObject *newComponent);
00097 
00099     TaggedObject *removeComponent(int tag);    
00103     int  getNumComponents(void) const;
00104 
00105     
00120     TaggedObject     *getComponentPtr(int tag);
00121 
00128     TaggedObjectIter &getComponents();
00129 
00130 
00132     ArrayOfTaggedObjectsIter  getIter();
00133 
00134     
00136     virtual TaggedObjectStorage *getEmptyCopy(void);
00138     virtual void clearAll(bool invokeDestructor = true);
00139     
00141     void Print(ostream &s, int flag =0);
00143     friend #include <ArrayOfTaggedObjectsIter.h>
00144     
00145   protected:    
00146     
00147   private:
00148     int numComponents;          
00149     int sizeComponentArray;     
00150     int positionLastEntry;      
00151     int positionLastNoFitEntry; 
00152     bool fitFlag;               
00153     TaggedObject **theComponents; 
00154     ArrayOfTaggedObjectsIter  myIter; // an iter for accessing the objects
00155 };
00156 
00157 #endif
00158 
00159 
Copyright Contact Us