00001 // ***************************************************************************** 00002 // ***************************************************************************** 00003 // sdAttribute.h 00004 // 00005 // This file contains the definitions for the following classes. 00006 // 00007 // sdAttributeActionType 00008 // This class is a wrapper around sdAttributeActionTypeEnum. The 00009 // sdAttributeActionTypeEnum enum defines the various actions that can be 00010 // performed on an attribute. 00011 // 00012 // sdAttributeContainerType 00013 // This class is a wrapper around the sdAttributeContainerTypeEnum values. 00014 // The enum values of sdAttributeContainerTypeEnum define the different 00015 // ways an attribute can be returned. 00016 // 00017 // sdAttribute 00018 // This class represents an attribute of an object in a schema. 00019 // 00020 // ***************************************************************************** 00021 // Except as specified in the OpenAccess terms of use of Cadence or Silicon 00022 // Integration Initiative, this material may not be copied, modified, 00023 // re-published, uploaded, executed, or distributed in any way, in any medium, 00024 // in whole or in part, without prior written permission from Cadence. 00025 // 00026 // Copyright 2007 Cadence Design Systems, Inc. 00027 // All Rights Reserved. 00028 // 00029 // $Author: icftcm $ 00030 // $Revision: #1 $ 00031 // $Date: 2007/03/20 $ 00032 // $State: Exp $ 00033 // ***************************************************************************** 00034 // ***************************************************************************** 00035 00036 00037 00038 #if !defined(sdAttribute_P) 00039 #define sdAttribute_P 00040 00041 00042 00043 // ***************************************************************************** 00044 // Nested includes 00045 // ***************************************************************************** 00046 #include <vector> 00047 #include "sdBase.h" 00048 00049 00050 00051 // ***************************************************************************** 00052 // Declare and define types in the schema definition namespace. 00053 // ***************************************************************************** 00054 BEGIN_SD_NAMESPACE 00055 00056 00057 00058 // ***************************************************************************** 00059 // Forward Public Class Declarations 00060 // ***************************************************************************** 00061 class sdObject; 00062 class sdValue; 00063 00064 00065 00066 // ***************************************************************************** 00067 // sdAttributeActionTypeEnum 00068 // ***************************************************************************** 00069 #define sdvNumAttributeActionTypes 4 00070 00071 enum sdAttributeActionTypeEnum { 00072 sdcGetAttributeActionType = 1, 00073 sdcSetAttributeActionType = 2, 00074 sdcUnsetAttributeActionType = 4, 00075 sdcInitAttributeActionType = 8 00076 }; 00077 00078 00079 00080 // ***************************************************************************** 00081 // sdAttributeContainerTypeEnum 00082 // ***************************************************************************** 00083 #define sdvNumAttributeContainerTypes 3 00084 00085 enum sdAttributeContainerTypeEnum { 00086 sdcSingleAttributeContainerType = 0, 00087 sdcArrayAttributeContainerType = 1, 00088 sdcCollectionAttributeContainerType = 2 00089 }; 00090 00091 00092 00093 // ***************************************************************************** 00094 // sdAttributeActionType 00095 // ***************************************************************************** 00096 class SD_DLL_API sdAttributeActionType { 00097 public: 00098 sdAttributeActionType(sdAttributeActionTypeEnum action); 00099 sdAttributeActionType(const std::string &name); 00100 ~sdAttributeActionType(); 00101 00102 operator sdAttributeActionTypeEnum() const; 00103 const std::string &getName() const; 00104 00105 private: 00106 static const std::string *initNames(); 00107 00108 sdAttributeActionTypeEnum m_value; 00109 00110 static const std::string *s_names; 00111 }; 00112 00113 00114 00115 // ***************************************************************************** 00116 // sdAttributeContainerType 00117 // ***************************************************************************** 00118 class SD_DLL_API sdAttributeContainerType { 00119 public: 00120 sdAttributeContainerType(sdAttributeContainerTypeEnum container); 00121 sdAttributeContainerType(const std::string &name); 00122 ~sdAttributeContainerType(); 00123 00124 operator sdAttributeContainerTypeEnum() const; 00125 const std::string &getName() const; 00126 00127 private: 00128 static const std::string *initNames(); 00129 00130 sdAttributeContainerTypeEnum m_value; 00131 00132 static const std::string *s_names; 00133 }; 00134 00135 00136 00137 // ***************************************************************************** 00138 // sdAttribute 00139 // ***************************************************************************** 00140 class SD_DLL_API sdAttribute : public sdBase { 00141 public: 00142 typedef std::vector<sdAttributeActionType> Actions; 00143 typedef Actions::const_iterator ActionConstIter; 00144 00145 sdAttribute(unsigned int id, 00146 const std::string &name, 00147 const std::string &description, 00148 const Actions &actions, 00149 sdAttributeContainerType containerType, 00150 bool isObjectIdentifier, 00151 sdNameSpace *nameSpace, 00152 const sdObject *object, 00153 const sdValue *value); 00154 00155 virtual ~sdAttribute(); 00156 00157 unsigned int getId() const; 00158 const std::string &getName() const; 00159 const std::string &getDescription() const; 00160 const sdObject *getObject() const; 00161 const sdValue *getValue() const; 00162 ActionConstIter begin() const; 00163 ActionConstIter end() const; 00164 00165 sdAttributeContainerType getContainerType() const; 00166 00167 virtual void accept(sdVisitor *visitor); 00168 00169 private: 00170 const unsigned int m_id; 00171 const std::string &m_name; 00172 const std::string m_description; 00173 const Actions m_actions; 00174 00175 const sdAttributeContainerTypeEnum m_containerType; 00176 00177 const sdObject *m_object; 00178 const sdValue *m_value; 00179 }; 00180 00181 00182 00183 END_SD_NAMESPACE 00184 00185 #endif
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.