ArrayOfTaggedObjects.hGo 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.2 $ 00022 // $Date: 2003/02/14 23:02:10 $ 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 00050 class ArrayOfTaggedObjects : public TaggedObjectStorage 00051 { 00052 public: 00053 ArrayOfTaggedObjects(int size); 00054 ~ArrayOfTaggedObjects(); 00055 00056 // public methods to populate a domain 00057 int setSize(int newSize); 00058 bool addComponent(TaggedObject *newComponent); 00059 // bool allowMutltipleTags = false); 00060 TaggedObject *removeComponent(int tag); 00061 int getNumComponents(void) const; 00062 00063 TaggedObject *getComponentPtr(int tag); 00064 TaggedObjectIter &getComponents(); 00065 00066 ArrayOfTaggedObjectsIter getIter(); 00067 00068 virtual TaggedObjectStorage *getEmptyCopy(void); 00069 virtual void clearAll(bool invokeDestructor = true); 00070 00071 void Print(OPS_Stream &s, int flag =0); 00072 friend class ArrayOfTaggedObjectsIter; 00073 00074 protected: 00075 00076 private: 00077 int numComponents; // num of components added 00078 int sizeComponentArray; // size of the array 00079 int positionLastEntry; // marker of last position used in the array 00080 int positionLastNoFitEntry; // marker of place array filled up to 00081 bool fitFlag; // flag indicating if all components in nicely 00082 TaggedObject **theComponents; // the array 00083 ArrayOfTaggedObjectsIter myIter; // an iter for accessing the objects 00084 }; 00085 00086 #endif 00087 00088 |