oaParam.h

Go to the documentation of this file.
00001 // *****************************************************************************
00002 // *****************************************************************************
00003 // oaParam.h
00004 //
00005 // This file contains the definitions for the oaParam, oaParamType, and
00006 // oaParamArray classes.
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(oaParam_P)
00027 #define oaParam_P
00028 
00029 
00030 
00031 // *****************************************************************************
00032 // Nested includes
00033 // *****************************************************************************
00034 #include "oaString.h"
00035 #include "oaArray.h"
00036 
00037 
00038 
00039 // *****************************************************************************
00040 // Declare and define types in the OpenAccess namespace.
00041 // *****************************************************************************
00042 BEGIN_OA_NAMESPACE
00043 
00044 
00045 
00046 // *****************************************************************************
00047 // oaParamTypeEnum
00048 // *****************************************************************************
00049 #define oavNumParamTypes    7
00050 
00051 enum oaParamTypeEnum {
00052     oacIntParamType     = 0,
00053     oacFloatParamType   = 1,
00054     oacStringParamType  = 2,
00055     oacAppParamType     = 3,
00056     oacDoubleParamType  = 4,
00057     oacBooleanParamType = 5,
00058     oacTimeParamType    = 6
00059 };
00060 
00061 
00062 
00063 // *****************************************************************************
00064 // oaParamType
00065 // *****************************************************************************
00066 class OA_BASE_DLL_API oaParamType {
00067 public:
00068                             oaParamType(oaParamTypeEnum typeIn);
00069                             oaParamType(const oaString &name);
00070                             ~oaParamType();
00071 
00072     const oaString          &getName() const;
00073 
00074                             operator                oaParamTypeEnum() const;
00075 
00076 private:
00077     oaParamTypeEnum         type;
00078 
00079     static const oaString   names[];
00080 };
00081 
00082 
00083 
00084 // *****************************************************************************
00085 // oaParam
00086 // *****************************************************************************
00087 class OA_BASE_DLL_API oaParam {
00088 public:
00089                             oaParam();
00090                             oaParam(const oaParam &param);
00091                             oaParam(const oaString  &nameIn,
00092                                     oaInt4          value);
00093                             oaParam(const oaString  &nameIn,
00094                                     oaFloat         value);
00095                             oaParam(const oaString  &nameIn,
00096                                     const oaString  &value);
00097                             oaParam(const oaString  &nameIn,
00098                                     oaDouble        value);
00099                             oaParam(const oaString  &nameIn,
00100                                     const oaString  &appTypeIn,
00101                                     oaUInt4         numBytesIn,
00102                                     const oaByte    *byteDataIn);
00103 
00104                             ~oaParam();
00105 
00106     void                    getName(oaString &name) const;
00107     oaParamType             getType() const;
00108     oaInt4                  getIntVal() const;
00109     oaFloat                 getFloatVal() const;
00110     const oaChar            *getStringVal() const;
00111     oaDouble                getDoubleVal() const;
00112     oaBoolean               getBooleanVal() const;
00113     oaTime                  getTimeVal() const;
00114     void                    getStringVal(oaString &value) const;
00115     void                    getAppVal(oaByte *byteData) const;
00116     oaUInt4                 getNumBytes() const;
00117     void                    getAppType(oaString &value) const;
00118 
00119     void                    setAppType(const oaChar *value);
00120     void                    setAppVal(oaUInt4       numBytes,
00121                                       const oaByte  *byteData);
00122     void                    setName(const oaChar *nameIn);
00123     void                    setIntVal(oaInt4 value);
00124     void                    setFloatVal(oaFloat value);
00125     void                    setStringVal(const oaChar *value);
00126     void                    setDoubleVal(oaDouble value);
00127     void                    setBooleanVal(oaBoolean value);
00128     void                    setTimeVal(oaTime value);
00129 
00130     oaParam                 &operator=(const oaParam &param);
00131 
00132     oaBoolean               operator==(const oaParam &p) const;
00133     oaBoolean               operator!=(const oaParam &p) const;
00134 
00135 private:
00136     union {
00137         oaInt4              intVal;
00138         oaFloat             floatVal;
00139         oaChar              *strVal;
00140         oaDouble            doubleVal;
00141         oaBoolean           booleanVal;
00142         oaTime              timeVal;
00143         oaByte              *byteDataVal;
00144     };
00145     oaString                name;
00146     oaParamType             type;
00147     oaChar                  *appType;
00148     oaUInt4                 numBytes;
00149 
00150     friend class oaParamArray;
00151     friend class oaParamTbl;
00152     friend class oaIntParamTbl;
00153     friend class oaStringParamTbl;
00154     friend class oaFloatParamTbl;
00155     friend class oaDoubleParamTbl;
00156     friend class oaBooleanParamTbl;
00157     friend class oaTimeParamTbl;
00158     friend class oaAppParamTbl;
00159 };
00160 
00161 
00162 
00163 // *****************************************************************************
00164 // oaParamArray
00165 // *****************************************************************************
00166 class OA_BASE_DLL_API oaParamArray : public oaArray<oaParam> {
00167 public:
00168                             oaParamArray(oaUInt4 sizeIn = 0);
00169                             oaParamArray(const oaParamArray &paramsIn);
00170 
00171     oaUInt4                 find(const oaParam &param) const;
00172     oaBoolean               find(const oaString &name,
00173                                  oaParam        &param) const;
00174 
00175     virtual oaBoolean       operator==(const oaArray<oaParam> &p) const;
00176 };
00177 
00178 
00179 
00180 END_OA_NAMESPACE
00181 
00182 #endif

Return to top of page