oaName.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // oaName.h
00003 //
00004 // This file contains the definition for the oaNameMem, oaScalarName,
00005 // oaVectorName, oaVectorBitName, oaSimpleName, and oaName classes. These
00006 // utility classes provide the base objects for name mapping.
00007 //
00008 // *****************************************************************************
00009 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00010 // Integration Initiative, this material may not be copied, modified,
00011 // re-published, uploaded, executed, or distributed in any way, in any medium,
00012 // in whole or in part, without prior written permission from Cadence.
00013 //
00014 //                Copyright 2002-2005 Cadence Design Systems, Inc.
00015 //                           All Rights Reserved.
00016 //
00017 //  $Author: icftcm $
00018 //  $Revision: #1 $
00019 //  $Date: 2010/08/09 $
00020 //  $State: Exp $
00021 // *****************************************************************************
00022 // *****************************************************************************
00023 
00024 
00025 
00026 #if !defined(oaName_P)
00027 #define oaName_P
00028 
00029 
00030 
00031 // *****************************************************************************
00032 // Nested includes
00033 // *****************************************************************************
00034 #include "oaNameSpace.h"
00035 
00036 
00037 
00038 // *****************************************************************************
00039 // Declare and define types in the OpenAccess namespace.
00040 // *****************************************************************************
00041 BEGIN_OA_NAMESPACE
00042 
00043 
00044 
00045 // *****************************************************************************
00046 // Forward Public Class Declarations
00047 // *****************************************************************************
00048 class oaNameSpace;
00049 class oaScalarName;
00050 class oaVectorBitName;
00051 class oaVectorName;
00052 
00053 
00054 
00055 // *****************************************************************************
00056 // oaNameTypeEnum
00057 // *****************************************************************************
00058 #define oavNumNameTypes     5
00059 
00060 enum oaNameTypeEnum {
00061     oacEmptyNameType        = 0,
00062     oacScalarNameType       = 1,
00063     oacVectorNameType       = 2,
00064     oacVectorBitNameType    = 3,
00065     oacBundleNameType       = 4
00066 };
00067 
00068 
00069 
00070 // *****************************************************************************
00071 // oaNameType
00072 // *****************************************************************************
00073 class OA_BASE_DLL_API oaNameType {
00074 public:
00075                             oaNameType(oaNameTypeEnum valueIn);
00076                             oaNameType(const oaString &name);
00077                             ~oaNameType();
00078 
00079     const oaString          &getName() const;
00080 
00081                             operator                oaNameTypeEnum() const;
00082 
00083 private:
00084     oaNameTypeEnum          value;
00085 
00086     static const oaString   names[];
00087 };
00088 
00089 
00090 
00091 // *****************************************************************************
00092 // oaNameMem
00093 // *****************************************************************************
00094 class OA_BASE_DLL_API oaNameMem {
00095 public:
00096                             oaNameMem();
00097                             oaNameMem(const oaString    &in,
00098                                       oaBoolean         caseSensitive);
00099                             oaNameMem(const oaChar  *in,
00100                                       oaBoolean     caseSensitive);
00101                             oaNameMem(const oaNameMem &name);
00102 
00103     oaBoolean               isCaseSensitive() const;
00104     oaBoolean               hasIndex() const;
00105     oaUInt4                 getIndex() const;
00106 
00107     const oaString          &getValue() const;
00108 
00109     void                    getBaseName(oaString &out) const;
00110 
00111     oaNameMem               &operator=(const oaNameMem &value);
00112 
00113 protected:
00114     oaBoolean               isEqual(const oaNameMem &value) const;
00115 
00116 private:
00117     void                    setCaseSensitive(oaBoolean value);
00118     void                    setValue(const oaString &value);
00119     void                    setValue(const char *value);
00120 
00121     oaString                data;
00122     oaBoolean               caseSensitive;
00123 
00124     friend class oaNameTbl;
00125     friend class oaNameBase;
00126     friend class oaScalarName;
00127     friend class oaVectorBitName;
00128     friend class oaVectorName;
00129 };
00130 
00131 
00132 
00133 // *****************************************************************************
00134 // oaNameBase
00135 // *****************************************************************************
00136 class OA_BASE_DLL_API oaNameBase {
00137 public:
00138                             oaNameBase();
00139                             ~oaNameBase();
00140 
00141     oaBoolean               isHier() const;
00142     oaBoolean               isEmpty() const;
00143     oaUInt4                 getNumMembers() const;
00144 
00145     const oaNameMem         &operator[](oaUInt4 i) const;
00146 
00147     void                    addHierPath(const oaScalarName &path);
00148     void                    addHierPath(const oaVectorBitName &path);
00149     void                    addHierMem(const oaNameSpace    &nSpace,
00150                                        const oaChar         *in,
00151                                        oaUInt4              len);
00152     void                    addHierMem(const oaNameMem &in);
00153 
00154 protected:
00155     oaUInt4                 getSize() const;
00156 
00157     void                    resize(oaUInt4 newSize);
00158 
00159     void                    truncate();
00160 
00161     oaBoolean               isEqual(const oaNameBase &value) const;
00162 
00163     oaNameMem               *data;
00164     oaUInt4                 numMembers;
00165     oaUInt4                 size;
00166 
00167     friend class oaNameTbl;
00168 };
00169 
00170 
00171 
00172 // *****************************************************************************
00173 // oaScalarName
00174 // *****************************************************************************
00175 class OA_BASE_DLL_API oaScalarName : public oaNameBase {
00176 public:
00177                             oaScalarName();
00178                             oaScalarName(const oaNameSpace  &nSpace,
00179                                          const oaChar       *in);
00180                             oaScalarName(const oaScalarName &in);
00181 
00182     void                    init(const oaNameSpace  &nSpace,
00183                                  const oaChar       *in);
00184 
00185     void                    get(const oaNameSpace   &nSpace,
00186                                 oaString            &out) const;
00187     void                    get(oaString &out) const;
00188 
00189     oaUInt4                 getNumBits() const;
00190 
00191     oaScalarName            &operator=(const oaScalarName &name);
00192 
00193     void                    append(const oaNameSpace    &nSpace,
00194                                    const oaChar         *in,
00195                                    oaUInt4              len,
00196                                    oaUInt4              flags);
00197     void                    append(const oaNameMem &in);
00198 
00199     oaBoolean               operator==(const oaScalarName &name) const;
00200     oaBoolean               operator!=(const oaScalarName &name) const;
00201 
00202     friend class oaNameTbl;
00203     friend class oaVectorBitName;
00204     friend class oaVectorName;
00205 };
00206 
00207 
00208 
00209 // *****************************************************************************
00210 // oaVectorBitName
00211 // *****************************************************************************
00212 class OA_BASE_DLL_API oaVectorBitName : public oaNameBase {
00213 public:
00214                             oaVectorBitName();
00215                             oaVectorBitName(const oaNameSpace   &nSpace,
00216                                             const oaChar        *in);
00217                             oaVectorBitName(const oaNameSpace   &nSpace,
00218                                             const oaChar        *in,
00219                                             oaUInt4             index);
00220                             oaVectorBitName(const oaScalarName  &in,
00221                                             oaUInt4             index);
00222                             oaVectorBitName(const oaVectorBitName &name);
00223 
00224     void                    init(const oaNameSpace  &nSpace,
00225                                  const oaChar       *in,
00226                                  oaBoolean          baseOnly = false);
00227 
00228     void                    get(const oaNameSpace   &nSpace,
00229                                 oaString            &out) const;
00230     void                    get(oaString &out) const;
00231 
00232     void                    getBaseName(const oaNameSpace   &nSpace,
00233                                         oaString            &out) const;
00234     void                    getBaseName(oaString &out) const;
00235     void                    getBaseName(oaScalarName &out) const;
00236 
00237     oaUInt4                 getIndex() const;
00238     oaUInt4                 getNumBits() const;
00239 
00240     void                    setIndex(oaUInt4 val);
00241 
00242     oaVectorBitName         &operator=(const oaVectorBitName &name);
00243 
00244     void                    append(const oaNameSpace    &nSpace,
00245                                    const oaChar         *in,
00246                                    oaUInt4              len,
00247                                    oaUInt4              flags);
00248 
00249     oaBoolean               operator==(const oaVectorBitName &name) const;
00250     oaBoolean               operator!=(const oaVectorBitName &name) const;
00251 
00252 private:
00253     oaUInt4                 index;
00254 
00255     friend class oaNameTbl;
00256 };
00257 
00258 
00259 
00260 // *****************************************************************************
00261 // oaVectorName
00262 // *****************************************************************************
00263 class OA_BASE_DLL_API oaVectorName : public oaNameBase {
00264 public:
00265                             oaVectorName();
00266                             oaVectorName(const oaNameSpace  &nSpace,
00267                                          const oaChar       *in,
00268                                          oaUInt4            start,
00269                                          oaUInt4            stop,
00270                                          oaUInt4            step = 1);
00271                             oaVectorName(const oaNameSpace  &nSpace,
00272                                          const oaChar       *in);
00273                             oaVectorName(const oaScalarName &in,
00274                                          oaUInt4            start,
00275                                          oaUInt4            stop,
00276                                          oaUInt4            step = 1);
00277                             oaVectorName(const oaVectorName &in);
00278 
00279     void                    init(const oaNameSpace  &nSpace,
00280                                  const oaChar       *in,
00281                                  oaBoolean          baseOnly = false);
00282 
00283     void                    get(const oaNameSpace   &nSpace,
00284                                 oaString            &out) const;
00285     void                    get(oaString &out) const;
00286 
00287     void                    getBaseName(const oaNameSpace   &nSpace,
00288                                         oaString            &out) const;
00289     void                    getBaseName(oaString &out) const;
00290     void                    getBaseName(oaScalarName &out) const;
00291 
00292     void                    getBitName(const oaNameSpace    &nSpace,
00293                                        oaUInt4              bit,
00294                                        oaString             &out) const;
00295 
00296     oaUInt4                 getNumBits() const;
00297     oaUInt4                 getStart() const;
00298     oaUInt4                 getStop() const;
00299     oaUInt4                 getStep() const;
00300 
00301     void                    setStart(oaUInt4 val);
00302     void                    setStop(oaUInt4 val);
00303     void                    setStep(oaUInt4 val);
00304 
00305     oaVectorName            &operator=(const oaVectorName &name);
00306 
00307     void                    append(const oaNameSpace    &nSpace,
00308                                    const oaChar         *in,
00309                                    oaUInt4              len,
00310                                    oaUInt4              flags);
00311 
00312     oaBoolean               operator==(const oaVectorName &name) const;
00313     oaBoolean               operator!=(const oaVectorName &name) const;
00314 
00315 private:
00316     oaUInt4                 start;
00317     oaUInt4                 stop;
00318     oaUInt4                 step;
00319 
00320     friend class oaNameTbl;
00321 };
00322 
00323 
00324 
00325 // *****************************************************************************
00326 // oaSimpleName
00327 // *****************************************************************************
00328 class OA_BASE_DLL_API oaSimpleName {
00329 public:
00330                             oaSimpleName();
00331                             oaSimpleName(const oaNameSpace  &nSpace,
00332                                          const oaChar       *in);
00333                             oaSimpleName(const oaSimpleName &name);
00334                             oaSimpleName(const oaScalarName &name);
00335                             oaSimpleName(const oaVectorBitName &name);
00336                             oaSimpleName(const oaVectorName &name);
00337                             ~oaSimpleName();
00338 
00339     void                    init(const oaNameSpace  &nSpace,
00340                                  const oaChar       *in);
00341 
00342     void                    get(const oaNameSpace   &nSpace,
00343                                 oaString            &out) const;
00344     void                    get(oaString &out) const;
00345 
00346     void                    getBitName(const oaNameSpace    &nSpace,
00347                                        oaUInt4              bit,
00348                                        oaString             &out) const;
00349 
00350     oaNameType              getType() const;
00351     oaUInt4                 getRepeat() const;
00352 
00353     oaUInt4                 getNumMembers() const;
00354     oaUInt4                 getNumBits() const;
00355 
00356     oaScalarName            *getScalar() const;
00357     oaVectorName            *getVector() const;
00358     oaVectorBitName         *getVectorBit() const;
00359 
00360     void                    addHierPath(const oaScalarName &path);
00361     void                    addHierPath(const oaVectorBitName &path);
00362     void                    addHierMem(const oaNameSpace    &nSpace,
00363                                        const oaChar         *in,
00364                                        oaUInt4              len);
00365     void                    addHierMem(const oaNameMem &in);
00366 
00367     oaSimpleName            &operator=(const oaSimpleName &name);
00368     oaSimpleName            &operator=(const oaScalarName &name);
00369     oaSimpleName            &operator=(const oaVectorName &name);
00370     oaSimpleName            &operator=(const oaVectorBitName &name);
00371 
00372     const oaNameMem         &operator[](oaUInt4 i) const;
00373 
00374     oaBoolean               operator==(const oaSimpleName &name) const;
00375     oaBoolean               operator==(const oaScalarName &name) const;
00376     oaBoolean               operator==(const oaVectorName &name) const;
00377     oaBoolean               operator==(const oaVectorBitName &name) const;
00378 
00379     oaBoolean               operator!=(const oaSimpleName &name) const;
00380     oaBoolean               operator!=(const oaScalarName &name) const;
00381     oaBoolean               operator!=(const oaVectorName &name) const;
00382     oaBoolean               operator!=(const oaVectorBitName &name) const;
00383 
00384 private:
00385     void                    deleteOldData();
00386 
00387     void                    setRepeat(oaUInt4 val);
00388 
00389     union {
00390         oaScalarName        *scalar;
00391         oaVectorName        *vector;
00392         oaVectorBitName     *vectorBit;
00393     };
00394     oaNameType              type;
00395     oaUInt4                 repeat;
00396 
00397     friend class oaBaseNameHashTbl;
00398     friend class oaNameTbl;
00399     friend class oaBundleName;
00400 };
00401 
00402 
00403 
00404 // *****************************************************************************
00405 // oaBundleName
00406 // *****************************************************************************
00407 class OA_BASE_DLL_API oaBundleName {
00408 public:
00409                             oaBundleName();
00410                             oaBundleName(const oaNameSpace  &nSpace,
00411                                          const oaChar       *in);
00412                             oaBundleName(const oaScalarName &in,
00413                                          oaUInt4            repeat = 1);
00414                             oaBundleName(const oaVectorName &in,
00415                                          oaUInt4            repeat = 1);
00416                             oaBundleName(const oaVectorBitName  &in,
00417                                          oaUInt4                repeat = 1);
00418                             oaBundleName(const oaSimpleName &in,
00419                                          oaUInt4            repeat = 1);
00420                             oaBundleName(const oaBundleName &in);
00421                             ~oaBundleName();
00422 
00423     void                    init(const oaNameSpace  &nSpace,
00424                                  const oaChar       *in);
00425 
00426     void                    get(const oaNameSpace   &nSpace,
00427                                 oaString            &out) const;
00428     void                    get(oaString &out) const;
00429 
00430     void                    getBitName(const oaNameSpace    &nSpace,
00431                                        oaUInt4              bit,
00432                                        oaString             &out) const;
00433 
00434     void                    append(const oaScalarName   &name,
00435                                    oaUInt4              repeat = 1);
00436     void                    append(const oaVectorName   &name,
00437                                    oaUInt4              repeat = 1);
00438     void                    append(const oaVectorBitName    &name,
00439                                    oaUInt4                  repeat = 1);
00440     void                    append(const oaSimpleName   &name,
00441                                    oaUInt4              repeat = 1);
00442 
00443     void                    addHierPath(const oaScalarName &path);
00444     void                    addHierPath(const oaVectorBitName &path);
00445     void                    addHierMem(const oaNameSpace    &nSpace,
00446                                        const oaChar         *in,
00447                                        oaUInt4              len);
00448     void                    addHierMem(const oaNameMem &in);
00449 
00450     oaBoolean               isEmpty() const;
00451     oaUInt4                 getNumMembers() const;
00452     oaUInt4                 getNumBits() const;
00453 
00454     oaUInt4                 getSize() const;
00455     void                    resize(oaUInt4 newSize);
00456 
00457     oaBundleName            &operator=(const oaBundleName &name);
00458     const oaSimpleName      &operator[](oaUInt4 i) const;
00459 
00460     oaBoolean               operator==(const oaBundleName &name) const;
00461     oaBoolean               operator!=(const oaBundleName &name) const;
00462 
00463 private:
00464     oaSimpleName            *data;
00465     oaUInt4                 numMembers;
00466     oaUInt4                 size;
00467 
00468     friend class oaNameTbl;
00469     friend class oaCdbaNS;
00470 };
00471 
00472 
00473 
00474 // *****************************************************************************
00475 // oaName
00476 // *****************************************************************************
00477 class OA_BASE_DLL_API oaName {
00478 public:
00479                             oaName();
00480                             oaName(const oaNameSpace    &nSpace,
00481                                    const oaChar         *in);
00482                             oaName(const oaName &name);
00483                             oaName(const oaSimpleName &name);
00484                             oaName(const oaBundleName &name);
00485                             oaName(const oaVectorName &name);
00486                             oaName(const oaVectorBitName &name);
00487                             oaName(const oaScalarName &name);
00488                             ~oaName();
00489 
00490     void                    init(const oaNameSpace  &nSpace,
00491                                  const oaChar       *in);
00492 
00493     void                    get(const oaNameSpace   &nSpace,
00494                                 oaString            &out) const;
00495     void                    get(oaString &out) const;
00496 
00497     void                    getBitName(const oaNameSpace    &nSpace,
00498                                        oaUInt4              bit,
00499                                        oaString             &out) const;
00500 
00501     oaNameType              getType() const;
00502 
00503     oaUInt4                 getNumBits() const;
00504 
00505     oaScalarName            *getScalar() const;
00506     oaVectorName            *getVector() const;
00507     oaVectorBitName         *getVectorBit() const;
00508     oaBundleName            *getBundle() const;
00509 
00510     void                    addHierPath(const oaScalarName &path);
00511     void                    addHierPath(const oaVectorBitName &path);
00512     void                    addHierMem(const oaNameSpace    &nSpace,
00513                                        const oaChar         *in,
00514                                        oaUInt4              len);
00515     void                    addHierMem(const oaNameMem &in);
00516 
00517     oaName                  &operator=(const oaName &name);
00518     oaName                  &operator=(const oaScalarName &name);
00519     oaName                  &operator=(const oaVectorName &name);
00520     oaName                  &operator=(const oaVectorBitName &name);
00521     oaName                  &operator=(const oaBundleName &name);
00522     oaName                  &operator=(const oaSimpleName &name);
00523 
00524     oaBoolean               operator==(const oaName &name) const;
00525     oaBoolean               operator==(const oaSimpleName &name) const;
00526     oaBoolean               operator==(const oaBundleName &name) const;
00527     oaBoolean               operator==(const oaVectorName &name) const;
00528     oaBoolean               operator==(const oaVectorBitName &name) const;
00529     oaBoolean               operator==(const oaScalarName &name) const;
00530 
00531     oaBoolean               operator!=(const oaName &name) const;
00532     oaBoolean               operator!=(const oaSimpleName &name) const;
00533     oaBoolean               operator!=(const oaBundleName &name) const;
00534     oaBoolean               operator!=(const oaVectorName &name) const;
00535     oaBoolean               operator!=(const oaVectorBitName &name) const;
00536     oaBoolean               operator!=(const oaScalarName &name) const;
00537 
00538 private:
00539     void                    deleteOldData();
00540 
00541     union {
00542         oaScalarName        *scalar;
00543         oaVectorName        *vector;
00544         oaVectorBitName     *vectorBit;
00545         oaBundleName        *bundle;
00546     };
00547     oaNameType              type;
00548 
00549     friend class oaNameTbl;
00550 };
00551 
00552 
00553 
00554 END_OA_NAMESPACE
00555 
00556 #endif

Return to top of page