oaNameSpace.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // oaNameSpace.h
00003 //
00004 // This file contains the definition for the oaNameSpace class. This utility
00005 // class provides the base object for defining the name spaces used in name
00006 // mapping.  In conjunction with the oaName objects, derived oaNameSpace classes
00007 // facilitate mapping names to and from the derived NameSpace.
00008 //
00009 // *****************************************************************************
00010 // Except as specified in the OpenAccess terms of use of Cadence or Silicon
00011 // Integration Initiative, this material may not be copied, modified,
00012 // re-published, uploaded, executed, or distributed in any way, in any medium,
00013 // in whole or in part, without prior written permission from Cadence.
00014 //
00015 //                Copyright 2002-2005 Cadence Design Systems, Inc.
00016 //                           All Rights Reserved.
00017 //
00018 //  $Author: icftcm $
00019 //  $Revision: #1 $
00020 //  $Date: 2010/08/09 $
00021 //  $State: Exp $
00022 // *****************************************************************************
00023 // *****************************************************************************
00024 
00025 
00026 
00027 #if !defined(oaNameSpace_P)
00028 #define oaNameSpace_P
00029 
00030 
00031 
00032 // *****************************************************************************
00033 // Nested includes
00034 // *****************************************************************************
00035 #include "oaCommonTypes.h"
00036 #include "oaString.h"
00037 #include <ctype.h>
00038 
00039 
00040 
00041 // *****************************************************************************
00042 // Declare and define types in the OpenAccess namespace.
00043 // *****************************************************************************
00044 BEGIN_OA_NAMESPACE
00045 
00046 
00047 
00048 // *****************************************************************************
00049 // Forward Public Class Declarations
00050 // *****************************************************************************
00051 class oaVectorName;
00052 class oaScalarName;
00053 class oaVectorBitName;
00054 class oaBundleName;
00055 class oaSimpleName;
00056 class oaName;
00057 class oaNameMem;
00058 class oaNameType;
00059 class oaString;
00060 
00061 
00062 // *****************************************************************************
00063 // Special characters in the internal nameSpace
00064 // *****************************************************************************
00065 #define oacInternalHexDelimiter     '#'
00066 #define oacInternalOpenBus          '['
00067 #define oacInternalCloseBus         ']'
00068 #define oacInternalBitDelimiter     ':'
00069 #define oacInternalHierDelimiter    '/'
00070 #define oacInternalNameDelimiter    ','
00071 #define oacInternalRepeat           '*'
00072 
00073 
00074 
00075 // *****************************************************************************
00076 // Flags for defining member context
00077 // *****************************************************************************
00078 #define oavMemberFirstInName        0x0001U
00079 #define oavMemberLastInName         0x0002U
00080 
00081 
00082 
00083 // *****************************************************************************
00084 // oaNameSpace
00085 // *****************************************************************************
00086 class OA_BASE_DLL_API oaNameSpace {
00087 public:
00088     virtual inline          ~oaNameSpace();
00089 
00090     virtual oaBoolean       isEqual(const oaScalarName  &n1,
00091                                     const oaScalarName  &n2) const = 0;
00092     virtual oaBoolean       isEqual(const oaVectorName  &n1,
00093                                     const oaVectorName  &n2) const = 0;
00094     virtual oaBoolean       isEqual(const oaVectorBitName   &n1,
00095                                     const oaVectorBitName   &n2) const = 0;
00096     virtual oaBoolean       isEqual(const oaBundleName  &n1,
00097                                     const oaBundleName  &n2) const = 0;
00098     virtual oaBoolean       isEqual(const oaSimpleName  &n1,
00099                                     const oaSimpleName  &n2) const = 0;
00100     virtual oaBoolean       isEqual(const oaName    &n1,
00101                                     const oaName    &n2) const = 0;
00102     virtual oaBoolean       isEqual(const oaNameMem &n1,
00103                                     const oaNameMem &n2) const = 0;
00104 
00105     virtual oaNameType      getType(const oaChar *in) const = 0;
00106 
00107 
00108     virtual void            getInternalMember(const oaChar  *in,
00109                                               oaString      &out,
00110                                               oaBoolean     &caseSensitive,
00111                                               oaUInt4       len,
00112                                               oaUInt4       flags = 0) const = 0;
00113     virtual void            getInternalScalar(const oaChar  *in,
00114                                               oaScalarName  &out) const = 0;
00115     virtual void            getInternalVBit(const oaChar    *in,
00116                                             oaVectorBitName &out,
00117                                             oaBoolean       baseOnly = false)
00118         const;
00119     virtual void            getInternalVector(const oaChar  *in,
00120                                               oaVectorName  &out,
00121                                               oaBoolean     baseOnly = false)
00122         const;
00123     virtual void            getInternalBundle(const oaChar  *in,
00124                                               oaBundleName  &out) const;
00125 
00126     virtual void            getMember(const oaChar  *in,
00127                                       oaBoolean     caseSensitive,
00128                                       oaString      &out,
00129                                       oaUInt4       &loc,
00130                                       oaUInt4       flags = 0) const = 0;
00131     virtual void            getMemberArray(const oaNameMem  *in,
00132                                            oaUInt4          numMembers,
00133                                            oaString         &out,
00134                                            oaUInt4          &loc) const;
00135     virtual void            getScalarName(const oaScalarName    &in,
00136                                           oaString              &out,
00137                                           oaUInt4               &loc) const = 0;
00138     virtual void            getVectorName(const oaVectorName    &in,
00139                                           oaString              &out,
00140                                           oaUInt4               &loc) const;
00141     virtual void            getVectorBitName(const oaVectorBitName  &in,
00142                                              oaString               &out,
00143                                              oaUInt4                &loc) const;
00144     virtual void            getVectorBitName(const oaNameMem    *in,
00145                                              oaUInt4            numMembers,
00146                                              oaUInt4            start,
00147                                              oaString           &out,
00148                                              oaUInt4            &loc) const;
00149     virtual void            getBundleName(const oaBundleName    &in,
00150                                           oaString              &out,
00151                                           oaUInt4               &loc) const;
00152     virtual void            getSimpleName(const oaSimpleName    &in,
00153                                           oaString              &out,
00154                                           oaUInt4               &loc) const;
00155 
00156     virtual void            get(const oaByte    *data,
00157                                 oaString        &out,
00158                                 oaUInt4         &loc) const = 0;
00159 
00160 protected:
00161     virtual oaBoolean       isEqual(const oaVectorName      &n1,
00162                                     const oaVectorBitName   &n2) const = 0;
00163 
00164     void                    decodeChar(const oaChar *str,
00165                                        oaChar       &out,
00166                                        oaUInt2      &shift) const;
00167 
00168     void                    encodeChar(oaChar   *str,
00169                                        oaChar   delimiter,
00170                                        oaChar   c) const;
00171 
00172     void                    writeChar(oaString  &str,
00173                                       oaUInt4   &index,
00174                                       oaChar    val) const;
00175     void                    writeInt(oaString   &str,
00176                                      oaUInt4    &index,
00177                                      int        val) const;
00178 
00179     oaUInt4                 getUInt(const oaChar *&str) const;
00180     oaUInt4                 getUInt(const oaChar    *str,
00181                                     oaUInt4         &end) const;
00182 
00183     oaUInt4                 readUInt4(const oaByte  *data,
00184                                       oaUInt4       &loc) const;
00185     const char              *readStr(const oaByte   *data,
00186                                      oaUInt4        &loc) const;
00187 
00188     oaBoolean               isInternalNormalChar(oaChar c)const;
00189     oaBoolean               isInternalBusChar(oaChar c) const;
00190     oaBoolean               isInternalHexDelimiter(oaChar c) const;
00191 
00192     friend class oaNameBase;
00193     friend class oaScalarName;
00194     friend class oaVectorName;
00195     friend class oaVectorBitName;
00196     friend class oaBundleName;
00197     friend class oaSimpleName;
00198     friend class oaName;
00199 };
00200 
00201 
00202 
00203 END_OA_NAMESPACE
00204 
00205 #endif

Return to top of page