oaCollection.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // *****************************************************************************
00003 // oaCollection.h
00004 //
00005 // This file contains the definitions for collections and iterators and their
00006 // supporting classes. The supporting classes include:
00007 //
00008 //  oaBaseCollection
00009 //      This is the base class for the oaCollection class.
00010 //
00011 //  oaCollection
00012 //      This class implements a collection of database objects.
00013 //
00014 //  oaEnumCollection
00015 //      This class implements a collection over a oaEnumProp values. It's a
00016 //      special case collection because it constructs an iterator that returns
00017 //      a oaString instead of a database object.
00018 //
00019 //  oaBaseIter
00020 //      This is the base class for the oaIter class.
00021 //
00022 //  oaIter
00023 //      This class implements an templated iterator. It iterates over objects
00024 //      in a collection.
00025 //
00026 //  oaEnumIter
00027 //      This class implements a special case iterator. It returns a oaString
00028 //      which contains the name of an enumeration value.
00029 //
00030 // *****************************************************************************
00031 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00032 // Integration Initiative, this material may not be copied, modified,
00033 // re-published, uploaded, executed, or distributed in any way, in any medium,
00034 // in whole or in part, without prior written permission from Cadence.
00035 //
00036 //                Copyright 2002-2005 Cadence Design Systems, Inc.
00037 //                           All Rights Reserved.
00038 //
00039 //  $Author: icftcm $
00040 //  $Revision: #1 $
00041 //  $Date: 2010/08/09 $
00042 //  $State: Exp $
00043 // *****************************************************************************
00044 // *****************************************************************************
00045 
00046 
00047 
00048 #if !defined(oaCollection_P)
00049 #define oaCollection_P
00050 
00051 
00052 
00053 // *****************************************************************************
00054 // Nested includes
00055 // *****************************************************************************
00056 #include "oaObject.h"
00057 
00058 
00059 
00060 // *****************************************************************************
00061 // Declare and define types in the OpenAccess namespace.
00062 // *****************************************************************************
00063 BEGIN_OA_NAMESPACE
00064 
00065 
00066 
00067 // *****************************************************************************
00068 // Forward Class Declarations
00069 // *****************************************************************************
00070 class oaDatabase;
00071 
00072 
00073 
00074 // *****************************************************************************
00075 // oaCollTypeEnum
00076 // *****************************************************************************
00077 enum oaCollTypeEnum {
00078     oacBaseCollType         = 0,
00079     oacDomainBaseCollType   = 1,
00080     oacAllCollType          = 2,
00081     oacGenericCollType      = 3,
00082     oacEmptyCollType        = 7
00083 };
00084 
00085 
00086 
00087 // *****************************************************************************
00088 // oaBaseCollection
00089 // *****************************************************************************
00090 class OA_BASE_DLL_API oaBaseCollection {
00091 public:
00092                             oaBaseCollection(const oaObject *object,
00093                                              oaUInt4        dataTypeIn);
00094                             oaBaseCollection(const oaObject *object,
00095                                              oaUInt4        dataTypeIn,
00096                                              oaDomain       domain);
00097                             oaBaseCollection(const oaObject *object,
00098                                              oaUInt4        assocDataType,
00099                                              oaDomain       domain,
00100                                              oaCollTypeEnum typeIn,
00101                                              oaUInt4        flagsIn,
00102                                              oaUInt4        objFlagsIn,
00103                                              const oaObject *scopeObjIn = NULL);
00104                             oaBaseCollection(const oaBaseCollection &coll);
00105 
00106     oaUInt4                 getCount() const;
00107     oaBoolean               isEmpty() const;
00108     oaBoolean               includes(const oaObject *object) const;
00109 
00110     void                    *owner;
00111     void                    *scopeObj;
00112 
00113     oaCollTypeEnum          type;
00114 
00115     oaDomain                ownerDomain;
00116     oaUInt4                 ownerDataType;
00117     oaUInt4                 ownerIndex;
00118     oaDomain                objDomain;
00119     oaUInt4                 objDataType;
00120     oaUInt4                 scopeIndex;
00121     oaUInt4                 objFlags;
00122     oaUInt4                 flags;
00123 };
00124 
00125 
00126 
00127 // *****************************************************************************
00128 // oaBaseIter
00129 // *****************************************************************************
00130 class OA_BASE_DLL_API oaBaseIter {
00131 public:
00132                             oaBaseIter(const oaBaseCollection &coll);
00133                             oaBaseIter(const oaBaseIter &iter);
00134 
00135     oaObject                *getNext();
00136     void                    reset();
00137 
00138     void                    *owner;
00139     void                    *objTbl;
00140     void                    *scopeObj;
00141 
00142     oaCollTypeEnum          type;
00143 
00144     oaDomain                objDomain;
00145     oaUInt4                 objDataType;
00146     oaDomain                ownerDomain;
00147     oaUInt4                 ownerDataType;
00148     oaUInt4                 ownerIndex;
00149     oaUInt4                 scopeIndex;
00150     oaUInt4                 objFlags;
00151     oaUInt4                 flags;
00152 
00153     oaUInt4                 index;
00154     oaUInt4                 index1;
00155 };
00156 
00157 
00158 
00159 // *****************************************************************************
00160 // oaCollection
00161 // *****************************************************************************
00162 template <class obj, class container>
00163 class OA_DLL_EXPORT oaCollection : public oaBaseCollection {
00164 public:
00165                             oaCollection(const oaObject *db,
00166                                          oaUInt4        dataTypeIn);
00167                             oaCollection(const oaObject *db,
00168                                          oaUInt4        dataTypeIn,
00169                                          oaDomain       domainIn);
00170                             oaCollection(const oaObject *object,
00171                                          oaUInt4        assocDataType,
00172                                          oaDomain       domainIn,
00173                                          oaCollTypeEnum collTypeIn,
00174                                          oaUInt4        flagsIn,
00175                                          oaUInt4        objFlagsIn,
00176                                          const oaObject *scopeObj = NULL);
00177                             oaCollection(const oaCollection<obj, container> &coll);
00178 
00179     oaBoolean               includes(const obj *o);
00180 };
00181 
00182 
00183 
00184 // *****************************************************************************
00185 // oaIter
00186 // *****************************************************************************
00187 template <class obj>
00188 class oaIter : public oaBaseIter {
00189 public:
00190                             oaIter(const oaBaseCollection &coll);
00191                             oaIter(const oaIter<obj> &iterIn);
00192 
00193     obj                     *getNext();
00194 };
00195 
00196 
00197 
00198 // *****************************************************************************
00199 // oaEnumIterState
00200 // *****************************************************************************
00201 class OA_BASE_DLL_API oaEnumIterState {
00202 public:
00203                             oaEnumIterState(oaDatabase  *db,
00204                                             oaObject    *objIn);
00205 
00206     virtual oaBoolean       getNext(oaString &enumVal) = 0;
00207     virtual void            reset() = 0;
00208     virtual oaEnumIterState *copy() = 0;
00209 
00210 protected:
00211     oaDatabase              *database;
00212     oaObject                *object;
00213 };
00214 
00215 
00216 
00217 // *****************************************************************************
00218 // oaEnumIter
00219 // *****************************************************************************
00220 class OA_BASE_DLL_API oaEnumPropIter {
00221 public:
00222                             oaEnumPropIter(oaEnumIterState *sub);
00223                             oaEnumPropIter(oaEnumPropIter &iterIn);
00224 
00225                             ~oaEnumPropIter();
00226 
00227     oaEnumPropIter          &operator=(oaEnumPropIter &iterIn);
00228 
00229     oaBoolean               getNext(oaString &enumV);
00230 
00231     void                    reset();
00232 
00233 protected:
00234     oaEnumIterState         *state;
00235 };
00236 
00237 
00238 
00239 // *****************************************************************************
00240 // oaEnumCollection
00241 // *****************************************************************************
00242 class OA_BASE_DLL_API oaEnumCollection {
00243 public:
00244                             oaEnumCollection(oaDatabase *db,
00245                                              oaObject   *objIn);
00246 
00247                             operator oaEnumIterState *();
00248 
00249     oaUInt4                 getCount();
00250     oaBoolean               isEmpty();
00251 
00252 protected:
00253     oaDatabase              *database;
00254     oaObject                *object;
00255 };
00256 
00257 
00258 
00259 END_OA_NAMESPACE
00260 
00261 #endif

Return to top of page