00001 // ***************************************************************************** 00002 // ***************************************************************************** 00003 // sdNameSpace.h 00004 // 00005 // This file contains the definition for the following classes. 00006 // 00007 // sdNameSpace 00008 // This is a class that is used to partition the schema into different 00009 // groups and revisions. This class holds the schema objects of a 00010 // particular revision of a software component. 00011 // 00012 // ***************************************************************************** 00013 // Except as specified in the OpenAccess terms of use of Cadence or Silicon 00014 // Integration Initiative, this material may not be copied, modified, 00015 // re-published, uploaded, executed, or distributed in any way, in any medium, 00016 // in whole or in part, without prior written permission from Cadence. 00017 // 00018 // Copyright 2007 Cadence Design Systems, Inc. 00019 // All Rights Reserved. 00020 // 00021 // $Author: icftcm $ 00022 // $Revision: #1 $ 00023 // $Date: 2007/03/20 $ 00024 // $State: Exp $ 00025 // ***************************************************************************** 00026 // ***************************************************************************** 00027 00028 00029 00030 #if !defined(sdNameSpace_P) 00031 #define sdNameSpace_P 00032 00033 00034 00035 // ***************************************************************************** 00036 // Nested includes 00037 // ***************************************************************************** 00038 #include <vector> 00039 #include <map> 00040 #include <set> 00041 #include "sdBaseTypes.h" 00042 00043 00044 00045 // ***************************************************************************** 00046 // Declare and define types in the schema definition namespace. 00047 // ***************************************************************************** 00048 BEGIN_SD_NAMESPACE 00049 00050 00051 00052 // ***************************************************************************** 00053 // Forward Public Class Declarations 00054 // ***************************************************************************** 00055 class sdAttribute; 00056 class sdObject; 00057 class sdRelationshipBase; 00058 class sdSession; 00059 class sdValue; 00060 class sdVisitor; 00061 00062 00063 // ***************************************************************************** 00064 // sdNameSpace 00065 // ***************************************************************************** 00066 class SD_DLL_API sdNameSpace { 00067 public: 00068 typedef std::map<unsigned int, const sdValue*> ValueMap; 00069 typedef std::map<unsigned int, const sdAttribute*> AttributeMap; 00070 typedef std::map<unsigned int, const sdRelationshipBase*> RelationshipMap; 00071 typedef std::map<unsigned int, const sdObject*> ObjectMap; 00072 typedef std::vector<std::string> StringVector; 00073 00074 typedef ValueMap::const_iterator ValueConstIter; 00075 typedef AttributeMap::const_iterator AttributeConstIter; 00076 typedef RelationshipMap::const_iterator RelationshipConstIter; 00077 typedef ObjectMap::const_iterator ObjectConstIter; 00078 typedef StringVector::const_iterator StringConstIter; 00079 00080 sdNameSpace(const std::string &name, 00081 const unsigned int version); 00082 00083 sdNameSpace(const std::string &name, 00084 const unsigned int &version, 00085 const StringVector &dependencies, 00086 const StringVector &aliases); 00087 virtual ~sdNameSpace(); 00088 00089 const sdValue *findValue(unsigned int enumValue) const; 00090 const sdValue *findValue(const std::string &enumName) const; 00091 00092 const sdAttribute *findAttribute(unsigned int enumValue) const; 00093 const sdAttribute *findAttribute(const std::string &enumName) const; 00094 00095 const sdObject *findObject(unsigned int enumValue) const; 00096 const sdObject *findObject(const std::string &enumName) const; 00097 00098 const sdRelationshipBase *findRelationship(unsigned int enumValue) const; 00099 const sdRelationshipBase *findRelationship(const std::string &enumName) const; 00100 00101 00102 const std::string &getName() const; 00103 unsigned int getVersion() const; 00104 bool dependsOn(const sdNameSpace *nameSpace) const; 00105 bool isInitialized() const; 00106 00107 ValueConstIter beginValue() const; 00108 ValueConstIter endValue() const; 00109 AttributeConstIter beginAttribute() const; 00110 AttributeConstIter endAttribute() const; 00111 RelationshipConstIter beginRelationship() const; 00112 RelationshipConstIter endRelationship() const; 00113 ObjectConstIter beginObject() const; 00114 ObjectConstIter endObject() const; 00115 StringConstIter beginDependentNameSpace() const; 00116 StringConstIter endDependentNameSpace() const; 00117 StringConstIter beginNameAlias() const; 00118 StringConstIter endNameAlias() const; 00119 00120 virtual void accept(sdVisitor *visitor); 00121 00122 protected: 00123 virtual void createSDObjects() = 0; 00124 virtual void destroySDObjects() = 0; 00125 00126 private: 00127 const std::string &addString(const std::string &string); 00128 void addValue(const sdValue *value); 00129 void addAttribute(const sdAttribute *attribute); 00130 void addRelationship(const sdRelationshipBase *relationship); 00131 void addObject(const sdObject *object); 00132 00133 00134 void removeInterObjectDependencies(); 00135 void clear(); 00136 00137 typedef std::set<std::string> StringSet; 00138 typedef std::map<const std::string*, const sdValue*> ValueNameMap; 00139 typedef std::map<const std::string*, const sdObject*> ObjectNameMap; 00140 00141 typedef std::map<const std::string*, const sdAttribute*> AttributeNameMap; 00142 typedef std::map<const std::string*, const sdRelationshipBase*> RelationshipNameMap; 00143 00144 ValueMap m_valueIdMap; 00145 AttributeMap m_attributeIdMap; 00146 RelationshipMap m_relationshipIdMap; 00147 ObjectMap m_objectIdMap; 00148 StringVector m_dependencies; 00149 StringVector m_aliases; 00150 const std::string m_name; 00151 unsigned int m_version; 00152 StringSet m_strings; 00153 ValueNameMap m_valueNameMap; 00154 AttributeNameMap m_attributeNameMap; 00155 RelationshipNameMap m_relationshipNameMap; 00156 ObjectNameMap m_objectNameMap; 00157 00158 friend class sdValue; 00159 friend class sdAttribute; 00160 friend class sdObject; 00161 friend class sdRelationshipBase; 00162 friend class sdField; 00163 friend class sdSession; 00164 }; 00165 00166 00167 00168 END_SD_NAMESPACE 00169 00170 #endif
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.