oaAppDef.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // *****************************************************************************
00003 // oaAppDef.h
00004 //
00005 // This file contains the definitions for the oaAppDef and related classes.
00006 // These classes implement attribute extensions in the database.
00007 //
00008 // oaAppDef
00009 //   This is a base class for all types of attribute extensions.
00010 //
00011 // oaIntAppDef
00012 //   This class implements an integer attribute extension.
00013 //
00014 // oaFloatAppDef
00015 //   This class implements a float attribute extension.
00016 //
00017 // oaStringAppDef
00018 //   This class implements a string attribute extension.
00019 //
00020 // oaIntraPointerAppDef
00021 //   This class implements an attribute extension that is a poiner to
00022 //   another object of the same type, in the same database.
00023 //
00024 // oaInterPointerAppDef
00025 //   This class implements an attribute extension that is a pointer to
00026 //   another object in the same database.
00027 //
00028 // oaDataAppDef
00029 //   This class implements a fixed size byte array extension.
00030 //
00031 // oaVarDataAppDef
00032 //   This class implements a variable sized byte array extension.
00033 //
00034 // oaTimeAppDef
00035 //   This class implements an oaTime attribute extension.
00036 //
00037 // oaDoubleAppDef
00038 //   This class implements a double attribute extension.
00039 //
00040 // oaVoidAppDef
00041 //   This class implements a pointer attribute extension. This extension type
00042 //   cannot be persistent, as pointer values will differ between sessions.
00043 //
00044 // oaBooleanAppDef
00045 //   This class implemants a boolean attribute extension.
00046 //
00047 // *****************************************************************************
00048 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00049 // Integration Initiative, this material may not be copied, modified,
00050 // re-published, uploaded, executed, or distributed in any way, in any medium,
00051 // in whole or in part, without prior written permission from Cadence.
00052 //
00053 //                Copyright 2002-2008 Cadence Design Systems, Inc.
00054 //                           All Rights Reserved.
00055 //
00056 //  $Author: icftcm $
00057 //  $Revision: #1 $
00058 //  $Date: 2010/08/09 $
00059 //  $State: Exp $
00060 // *****************************************************************************
00061 // *****************************************************************************
00062 
00063 
00064 
00065 #if !defined(oaAppDef_P)
00066 #define oaAppDef_P
00067 
00068 
00069 
00070 // *****************************************************************************
00071 // Nested includes
00072 // *****************************************************************************
00073 #include "oaAppObjectDef.h"
00074 
00075 
00076 
00077 // *****************************************************************************
00078 // Declare and define types in the OpenAccess namespace.
00079 // *****************************************************************************
00080 BEGIN_OA_NAMESPACE
00081 
00082 
00083 
00084 // *****************************************************************************
00085 // Forward Public Class Declarations
00086 // *****************************************************************************
00087 class oaString;
00088 class oaAppObjectDef;
00089 
00090 
00091 
00092 // *****************************************************************************
00093 // oaAppDef
00094 // *****************************************************************************
00095 class OA_BASE_DLL_API oaAppDef : public oaSessionObject {
00096 public:
00097     void                    getName(oaString &name) const;
00098 #if !defined(OA_DEPRECATED)
00099     void                    getName(oaString &name);
00100 #endif
00101 
00102     oaBoolean               isPersistent() const;
00103 
00104     void                    destroy(oaObject *object);
00105 
00106     oaBoolean               isUsedIn(const oaObject *database);
00107     void                    remove(oaObject *database);
00108 
00109 protected:
00110     static oaAppDef         *getInt(const oaString          &name,
00111                                     oaUInt4                 dbType,
00112                                     oaUInt4                 dataType,
00113                                     oaDomain                domain,
00114                                     oaBoolean               persistent,
00115                                     oaInt4                  defValue,
00116                                     const oaAppObjectDef    *def = NULL);
00117     static oaAppDef         *getFloat(const oaString        &name,
00118                                       oaUInt4               dbType,
00119                                       oaUInt4               dataType,
00120                                       oaDomain              domain,
00121                                       oaBoolean             persistent,
00122                                       oaFloat               defValue,
00123                                       const oaAppObjectDef  *def = NULL);
00124     static oaAppDef         *getString(const oaString       &name,
00125                                        oaUInt4              dbType,
00126                                        oaUInt4              dataType,
00127                                        oaDomain             domain,
00128                                        oaBoolean            persistent,
00129                                        const oaString       &defValue,
00130                                        const oaAppObjectDef *def = NULL);
00131     static oaAppDef         *getIntra(const oaString        &name,
00132                                       oaUInt4               dbType,
00133                                       oaUInt4               dataType,
00134                                       oaDomain              domain,
00135                                       oaBoolean             persistent,
00136                                       const oaAppObjectDef  *def = NULL);
00137     static oaAppDef         *getInter(const oaString        &name,
00138                                       oaUInt4               dbType,
00139                                       oaUInt4               dataType,
00140                                       oaDomain              domain,
00141                                       oaBoolean             persistent,
00142                                       const oaAppObjectDef  *def = NULL);
00143     static oaAppDef         *getData(const oaString         &name,
00144                                      oaUInt4                dbType,
00145                                      oaUInt4                dataType,
00146                                      oaDomain               domain,
00147                                      oaBoolean              persistent,
00148                                      oaUInt4                size,
00149                                      const oaByte           *defValue,
00150                                      const oaAppObjectDef   *def = NULL);
00151     static oaAppDef         *getVarData(const oaString          &name,
00152                                         oaUInt4                 dbType,
00153                                         oaUInt4                 dataType,
00154                                         oaDomain                domain,
00155                                         oaBoolean               persistent,
00156                                         oaUInt4                 defSize,
00157                                         const oaByte            *defValue,
00158                                         const oaAppObjectDef    *def = NULL);
00159     static oaAppDef         *getTime(const oaString         &name,
00160                                      oaUInt4                dbType,
00161                                      oaUInt4                dataType,
00162                                      oaDomain               domain,
00163                                      oaBoolean              persistent,
00164                                      oaTime                 defValue,
00165                                      const oaAppObjectDef   *def = NULL);
00166     static oaAppDef         *getDouble(const oaString       &name,
00167                                        oaUInt4              dbType,
00168                                        oaUInt4              dataType,
00169                                        oaDomain             domain,
00170                                        oaBoolean            persistent,
00171                                        oaDouble             defValue,
00172                                        const oaAppObjectDef *def = NULL);
00173     static oaAppDef         *getVoid(const oaString         &name,
00174                                      oaUInt4                dbType,
00175                                      oaUInt4                dataType,
00176                                      oaDomain               domain,
00177                                      const oaAppObjectDef   *def = NULL);
00178     static oaAppDef         *getBoolean(const oaString          &name,
00179                                         oaUInt4                 dbType,
00180                                         oaUInt4                 dataType,
00181                                         oaDomain                domain,
00182                                         oaBoolean               persistent,
00183                                         oaBoolean               defValue,
00184                                         const oaAppObjectDef    *def = NULL);
00185 
00186     static oaAppDef         *find(const oaString        &name,
00187                                   oaUInt4               dbType,
00188                                   oaUInt4               dtIndex,
00189                                   oaDomain              domain,
00190                                   const oaAppObjectDef  *def = NULL);
00191 
00192     void                    setInt(oaObject *object,
00193                                    oaInt4   value);
00194     oaInt4                  getInt(const oaObject *object);
00195     oaInt4                  getIntDefault() const;
00196 
00197     void                    setFloat(oaObject   *object,
00198                                      oaFloat    value);
00199     oaFloat                 getFloat(const oaObject *object);
00200     oaFloat                 getFloatDefault() const;
00201 
00202     void                    setString(oaObject          *object,
00203                                       const oaString    &value);
00204     void                    getString(const oaObject    *object,
00205                                       oaString          &value);
00206     void                    getStringDefault(oaString &value) const;
00207 
00208     void                    setIntra(oaObject       *object,
00209                                      const oaObject *otherObject);
00210     oaObject                *getIntra(const oaObject *object);
00211 
00212     void                    setInter(oaObject       *object,
00213                                      const oaObject *otherObject);
00214     oaObject                *getInter(const oaObject *object);
00215 
00216     void                    setData(oaObject        *object,
00217                                     const oaByte    *byteData);
00218     void                    getData(const oaObject  *object,
00219                                     oaByte          *byteData);
00220     void                    getDataDefault(oaByte *byteData) const;
00221     oaUInt4                 getDataSize() const;
00222 
00223     void                    setVarData(oaObject     *object,
00224                                        oaUInt4      dataSize,
00225                                        const oaByte *value);
00226     void                    getVarData(const oaObject   *object,
00227                                        oaByte           *value);
00228     oaUInt4                 getVarDataSize(const oaObject *object);
00229     void                    getVarDataDefault(oaByte *value) const;
00230     oaUInt4                 getVarDataSizeDefault() const;
00231 
00232     void                    setTime(oaObject    *object,
00233                                     oaTime      value);
00234     oaTime                  getTime(const oaObject *object);
00235     oaTime                  getTimeDefault() const;
00236 
00237     void                    setDouble(oaObject  *object,
00238                                       oaDouble  value);
00239     oaDouble                getDouble(const oaObject *object);
00240     oaDouble                getDoubleDefault() const;
00241 
00242     void                    setVoid(oaObject    *object,
00243                                     const void  *value);
00244     void                    *getVoid(const oaObject *object);
00245 
00246     void                    setBoolean(oaObject     *object,
00247                                        oaBoolean    value);
00248     oaBoolean               getBoolean(const oaObject *object);
00249     oaBoolean               getBooleanDefault() const;
00250 };
00251 
00252 
00253 
00254 // *****************************************************************************
00255 // oaIntAppDef
00256 // *****************************************************************************
00257 template <class T>
00258 class oaIntAppDef : public oaAppDef {
00259 public:
00260     static oaIntAppDef<T>   *get(const oaString &name,
00261                                  oaInt4         defValue = 0,
00262                                  oaBoolean      persist = true);
00263     static oaIntAppDef<T>   *get(const oaString         &name,
00264                                  const oaAppObjectDef   *objDef,
00265                                  oaInt4                 defValue = 0,
00266                                  oaBoolean              persist = true);
00267     static oaIntAppDef<T>   *find(const oaString &name);
00268     static oaIntAppDef<T>   *find(const oaString        &name,
00269                                   const oaAppObjectDef  *objDef);
00270 
00271     void                    set(T       *object,
00272                                 oaInt4  value);
00273     oaInt4                  get(const T *object);
00274 
00275     oaInt4                  getDefault() const;
00276 };
00277 
00278 
00279 
00280 // *****************************************************************************
00281 // oaFloatAppDef
00282 // *****************************************************************************
00283 template <class T>
00284 class oaFloatAppDef : public oaAppDef {
00285 public:
00286     static oaFloatAppDef<T> *get(const oaString &name,
00287                                  oaFloat        defValue = 0.,
00288                                  oaBoolean      persist = true);
00289     static oaFloatAppDef<T> *get(const oaString         &name,
00290                                  const oaAppObjectDef   *objDef,
00291                                  oaFloat                defValue = 0,
00292                                  oaBoolean              persist = true);
00293     static oaFloatAppDef<T> *find(const oaString &name);
00294     static oaFloatAppDef<T> *find(const oaString        &name,
00295                                   const oaAppObjectDef  *objDef);
00296 
00297     void                    set(T       *object,
00298                                 oaFloat value);
00299     oaFloat                 get(const T *object);
00300 
00301     oaFloat                 getDefault() const;
00302 };
00303 
00304 
00305 
00306 // *****************************************************************************
00307 // oaStringAppDef
00308 // *****************************************************************************
00309 template <class T>
00310 class oaStringAppDef : public oaAppDef {
00311 public:
00312     static oaStringAppDef<T>    *get(const oaString &name,
00313                                      const oaString &defValue = "",
00314                                      oaBoolean      persist = true);
00315     static oaStringAppDef<T>    *get(const oaString         &name,
00316                                      const oaAppObjectDef   *objDef,
00317                                      const oaString         &defValue = "",
00318                                      oaBoolean              persist = true);
00319     static oaStringAppDef<T>    *find(const oaString &name);
00320     static oaStringAppDef<T>    *find(const oaString        &name,
00321                                       const oaAppObjectDef  *objDef);
00322 
00323     void                        set(T               *object,
00324                                     const oaString  &value);
00325     void                        get(const T     *object,
00326                                     oaString    &value);
00327 
00328     void                        getDefault(oaString &value) const;
00329 };
00330 
00331 
00332 
00333 // *****************************************************************************
00334 // oaIntraPointerAppDef
00335 // *****************************************************************************
00336 template <class T>
00337 class oaIntraPointerAppDef : public oaAppDef {
00338 public:
00339     static oaIntraPointerAppDef<T>  *get(const oaString &name,
00340                                          oaBoolean      persist = true);
00341     static oaIntraPointerAppDef<T>  *get(const oaString         &name,
00342                                          const oaAppObjectDef   *objDef,
00343                                          oaBoolean              persist = true);
00344     static oaIntraPointerAppDef<T>  *find(const oaString &name);
00345     static oaIntraPointerAppDef<T>  *find(const oaString        &name,
00346                                           const oaAppObjectDef  *objDef);
00347 
00348     void                            set(T       *object,
00349                                         const T *otherObject);
00350     T                               *get(const T *object);
00351 };
00352 
00353 
00354 
00355 // *****************************************************************************
00356 // oaInterPointerAppDef
00357 // *****************************************************************************
00358 template <class T>
00359 class oaInterPointerAppDef : public oaAppDef {
00360 public:
00361     static oaInterPointerAppDef<T>  *get(const oaString &name,
00362                                          oaBoolean      persist = true);
00363     static oaInterPointerAppDef<T>  *get(const oaString         &name,
00364                                          const oaAppObjectDef   *objDef,
00365                                          oaBoolean              persist = true);
00366     static oaInterPointerAppDef<T>  *find(const oaString &name);
00367     static oaInterPointerAppDef<T>  *find(const oaString        &name,
00368                                           const oaAppObjectDef  *objDef);
00369 
00370     void                            set(T               *object,
00371                                         const oaObject  *otherObject);
00372     oaObject                        *get(const T *object);
00373 };
00374 
00375 
00376 
00377 // *****************************************************************************
00378 // oaDataAppDef
00379 // *****************************************************************************
00380 template <class T>
00381 class oaDataAppDef : public oaAppDef {
00382 public:
00383     static oaDataAppDef<T>  *get(const oaString &name,
00384                                  oaUInt4        dataSize,
00385                                  const oaByte   *defValue,
00386                                  oaBoolean      persist = true);
00387     static oaDataAppDef<T>  *get(const oaString         &name,
00388                                  const oaAppObjectDef   *objDef,
00389                                  oaUInt4                dataSize,
00390                                  const oaByte           *defValue,
00391                                  oaBoolean              persist = true);
00392     static oaDataAppDef<T>  *find(const oaString &name);
00393     static oaDataAppDef<T>  *find(const oaString        &name,
00394                                   const oaAppObjectDef  *objDef);
00395 
00396     void                    set(T               *object,
00397                                 const oaByte    *value);
00398     void                    get(const T *object,
00399                                 oaByte  *value);
00400     oaUInt4                 getSize();
00401 
00402     void                    getDefault(oaByte *value) const;
00403 };
00404 
00405 
00406 
00407 // *****************************************************************************
00408 // oaVarDataAppDef
00409 // *****************************************************************************
00410 template <class T>
00411 class oaVarDataAppDef : public oaAppDef {
00412 public:
00413     static oaVarDataAppDef<T>   *get(const oaString &name,
00414                                      oaBoolean      persist = true);
00415     static oaVarDataAppDef<T>   *get(const oaString &name,
00416                                      oaUInt4        defSize,
00417                                      const oaByte   *defValue,
00418                                      oaBoolean      persist = true);
00419     static oaVarDataAppDef<T>   *get(const oaString         &name,
00420                                      const oaAppObjectDef   *objDef,
00421                                      oaBoolean              persist = true);
00422     static oaVarDataAppDef<T>   *get(const oaString         &name,
00423                                      const oaAppObjectDef   *objDef,
00424                                      oaUInt4                defSize,
00425                                      const oaByte           *defValue,
00426                                      oaBoolean              persist = true);
00427     static oaVarDataAppDef<T>   *find(const oaString &name);
00428     static oaVarDataAppDef<T>   *find(const oaString        &name,
00429                                       const oaAppObjectDef  *objDef);
00430 
00431     void                        set(T               *object,
00432                                     oaUInt4         dataSize,
00433                                     const oaByte    *value);
00434     void                        get(const T *object,
00435                                     oaByte  *value);
00436     oaUInt4                     getSize(const T *object);
00437 
00438     oaUInt4                     getDefaultSize() const;
00439     void                        getDefault(oaByte *value) const;
00440 };
00441 
00442 
00443 
00444 // *****************************************************************************
00445 // oaTimeAppDef
00446 // *****************************************************************************
00447 template <class T>
00448 class oaTimeAppDef : public oaAppDef {
00449 public:
00450     static oaTimeAppDef<T>  *get(const oaString &name,
00451                                  oaTime         defValue = oaTime(0),
00452                                  oaBoolean      persist = true);
00453     static oaTimeAppDef<T>  *get(const oaString         &name,
00454                                  const oaAppObjectDef   *objDef,
00455                                  oaTime                 defValue = oaTime(0),
00456                                  oaBoolean              persist = true);
00457     static oaTimeAppDef<T>  *find(const oaString &name);
00458     static oaTimeAppDef<T>  *find(const oaString        &name,
00459                                   const oaAppObjectDef  *objDef);
00460 
00461     void                    set(T       *object,
00462                                 oaTime  value);
00463     oaTime                  get(const T *object);
00464 
00465     oaTime                  getDefault() const;
00466 };
00467 
00468 
00469 
00470 // *****************************************************************************
00471 // oaDoubleAppDef
00472 // *****************************************************************************
00473 template <class T>
00474 class oaDoubleAppDef : public oaAppDef {
00475 public:
00476     static oaDoubleAppDef<T>    *get(const oaString &name,
00477                                      oaDouble       defValue = 0.,
00478                                      oaBoolean      persist = true);
00479     static oaDoubleAppDef<T>    *get(const oaString         &name,
00480                                      const oaAppObjectDef   *objDef,
00481                                      oaDouble               defValue = 0.,
00482                                      oaBoolean              persist = true);
00483     static oaDoubleAppDef<T>    *find(const oaString &name);
00484     static oaDoubleAppDef<T>    *find(const oaString        &name,
00485                                       const oaAppObjectDef  *objDef);
00486 
00487     void                        set(T           *object,
00488                                     oaDouble    value);
00489     oaDouble                    get(const T *object);
00490 
00491     oaDouble                    getDefault() const;
00492 };
00493 
00494 
00495 
00496 // *****************************************************************************
00497 // oaVoidPointerAppDef
00498 // *****************************************************************************
00499 template <class T>
00500 class oaVoidPointerAppDef : public oaAppDef {
00501 public:
00502     static oaVoidPointerAppDef<T>   *get(const oaString &name);
00503     static oaVoidPointerAppDef<T>   *get(const oaString         &name,
00504                                          const oaAppObjectDef   *objDef);
00505     static oaVoidPointerAppDef<T>   *find(const oaString &name);
00506     static oaVoidPointerAppDef<T>   *find(const oaString        &name,
00507                                           const oaAppObjectDef  *objDef);
00508 
00509     void                            set(T           *object,
00510                                         const void  *value);
00511     void                            *get(const T *object);
00512 };
00513 
00514 
00515 
00516 // *****************************************************************************
00517 // oaVoidPointerAppDef
00518 // *****************************************************************************
00519 template <class T>
00520 class oaBooleanAppDef : public oaAppDef {
00521 public:
00522     static oaBooleanAppDef<T>   *get(const oaString &name,
00523                                      oaBoolean      defValue = false,
00524                                      oaBoolean      persist = true);
00525     static oaBooleanAppDef<T>   *get(const oaString         &name,
00526                                      const oaAppObjectDef   *objDef,
00527                                      oaBoolean              defValue = false,
00528                                      oaBoolean              persist = true);
00529     static oaBooleanAppDef<T>   *find(const oaString &name);
00530     static oaBooleanAppDef<T>   *find(const oaString        &name,
00531                                       const oaAppObjectDef  *objDef);
00532 
00533     void                        set(T           *object,
00534                                     oaBoolean   value);
00535     oaBoolean                   get(const T *object);
00536 
00537     oaBoolean                   getDefault() const;
00538 };
00539 
00540 
00541 
00542 // *****************************************************************************
00543 // Traits
00544 // *****************************************************************************
00545 template<>
00546 class oaTraits<oaAppDef> {
00547 public:
00548     typedef oaSessionObject parentType;
00549     enum {domain = oacNoDomain};
00550     enum {isMultiDomain = false};
00551     enum {isConcrete = false};
00552     enum {dbType = oacBaseDBType};
00553     enum {abstractTypeEnumVal = oacAppDefType};
00554 };
00555 
00556 
00557 
00558 END_OA_NAMESPACE
00559 
00560 #endif

Return to top of page