00001 // ***************************************************************************** 00002 // ***************************************************************************** 00003 // sdValue.h 00004 // 00005 // This file contains the definitions for the following classes. 00006 // 00007 // sdValueSubType 00008 // This class is a wrapper class for the enumeration sdValueSubTypeEnum. 00009 // 00010 // sdValue 00011 // This class represents the value of an attribute. The value can be a POD 00012 // type or a composite type. 00013 // 00014 // sdLeafValue 00015 // This represents a POD value type of an attribute. 00016 // 00017 // sdField 00018 // This class represents an individual field of an attribute value which is 00019 // a composite type. 00020 // 00021 // sdHierValue 00022 // This represents a composite value type of an attribute. 00023 // 00024 // ***************************************************************************** 00025 // Except as specified in the OpenAccess terms of use of Cadence or Silicon 00026 // Integration Initiative, this material may not be copied, modified, 00027 // re-published, uploaded, executed, or distributed in any way, in any medium, 00028 // in whole or in part, without prior written permission from Cadence. 00029 // 00030 // Copyright 2007 Cadence Design Systems, Inc. 00031 // All Rights Reserved. 00032 // 00033 // $Author: icftcm $ 00034 // $Revision: #1 $ 00035 // $Date: 2007/03/20 $ 00036 // $State: Exp $ 00037 // ***************************************************************************** 00038 // ***************************************************************************** 00039 00040 00041 00042 #if !defined(sdValue_P) 00043 #define sdValue_P 00044 00045 00046 00047 // ***************************************************************************** 00048 // Nested includes 00049 // ***************************************************************************** 00050 #include <vector> 00051 #include "sdBase.h" 00052 00053 00054 00055 // ***************************************************************************** 00056 // Declare and define types in the schema definition namespace. 00057 // ***************************************************************************** 00058 BEGIN_SD_NAMESPACE 00059 00060 00061 00062 // ***************************************************************************** 00063 // sdValueSubTypeEnum 00064 // ***************************************************************************** 00065 #define sdvNumValueSubTypes 2 00066 00067 enum sdValueSubTypeEnum { 00068 sdcLeafValueSubType = 0, 00069 sdcHierValueSubType = 1 00070 }; 00071 00072 00073 00074 // ***************************************************************************** 00075 // sdValueSubType 00076 // ***************************************************************************** 00077 class SD_DLL_API sdValueSubType { 00078 public: 00079 sdValueSubType(sdValueSubTypeEnum value); 00080 sdValueSubType(const std::string &name); 00081 ~sdValueSubType(); 00082 00083 operator sdValueSubTypeEnum() const; 00084 const std::string &getName() const; 00085 00086 private: 00087 static const std::string *initNames(); 00088 00089 sdValueSubTypeEnum m_value; 00090 00091 static const std::string *s_names; 00092 }; 00093 00094 00095 00096 // ***************************************************************************** 00097 // sdValue 00098 // ***************************************************************************** 00099 class SD_DLL_API sdValue : public sdBase { 00100 public: 00101 virtual ~sdValue(); 00102 00103 unsigned int getId() const; 00104 const std::string &getName() const; 00105 const std::string &getDescription() const; 00106 sdValueSubType getSubType() const; 00107 00108 protected: 00109 sdValue(unsigned int id, 00110 const std::string &name, 00111 const std::string &description, 00112 sdValueSubType subType, 00113 sdNameSpace *nameSpace); 00114 00115 private: 00116 const unsigned int m_id; 00117 const std::string &m_name; 00118 const std::string m_description; 00119 const sdValueSubType m_subType; 00120 }; 00121 00122 00123 00124 // ***************************************************************************** 00125 // sdLeafValue 00126 // ***************************************************************************** 00127 class SD_DLL_API sdLeafValue : public sdValue { 00128 public: 00129 sdLeafValue(unsigned int id, 00130 const std::string &name, 00131 const std::string &description, 00132 sdNameSpace *nameSpace); 00133 virtual ~sdLeafValue(); 00134 00135 virtual void accept(sdVisitor *visitor); 00136 }; 00137 00138 00139 00140 // ***************************************************************************** 00141 // sdField 00142 // ***************************************************************************** 00143 class SD_DLL_API sdField { 00144 public: 00145 sdField(const std::string &name, 00146 unsigned int index, 00147 sdNameSpace *nameSpace, 00148 const sdValue *value); 00149 ~sdField(); 00150 00151 const std::string &getName() const; 00152 unsigned int getIndex() const; 00153 const sdNameSpace *getNameSpace() const; 00154 const sdValue *getValue() const; 00155 00156 private: 00157 const std::string &m_name; 00158 const unsigned int m_index; 00159 const sdNameSpace *m_nameSpace; 00160 const sdValue *m_value; 00161 }; 00162 00163 00164 00165 // ***************************************************************************** 00166 // sdHierValue 00167 // ***************************************************************************** 00168 class SD_DLL_API sdHierValue : public sdValue { 00169 public: 00170 typedef std::vector<sdField*> FieldVector; 00171 typedef FieldVector::const_iterator FieldConstIter; 00172 00173 sdHierValue(unsigned int id, 00174 const std::string &name, 00175 const std::string &description, 00176 sdNameSpace *nameSpace, 00177 const FieldVector &fields); 00178 virtual ~sdHierValue(); 00179 00180 FieldConstIter begin() const; 00181 FieldConstIter end() const; 00182 00183 virtual void accept(sdVisitor *visitor); 00184 00185 private: 00186 const FieldVector m_fields; 00187 }; 00188 00189 00190 00191 END_SD_NAMESPACE 00192 00193 #endif
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.