VR-Forces 4.1 Class Documentation
DtModelDefinition.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtModelDefinition.h,v $ $Revision: 1.17 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #ifndef DtModelDefinition_H_
14 #define DtModelDefinition_H_
15 
16 #include <vrvCore/vrvCore.h>
18 #include <vrvUtil/DtKeywordMixin.h>
20 
21 #include <boost/serialization/version.hpp>
22 #include <boost/serialization/set.hpp>
23 #include <boost/serialization/map.hpp>
24 #include <boost/unordered_map.hpp>
25 #include <map>
26 #include <string>
27 #include <set>
28 
29 namespace makVrv
30 {
31  class DtVirtualBaseClass;
32 
38  {
39  public:
40 
41  //Global public empty string.
42  static const std::string theEmptyString;
43 
44  typedef std::map<std::string,std::string> ParameterMap;
45 
50  DtModelDefinition(const std::string& modelName = "");
51 
54 
56  DtModelDefinition(const std::string& modelName,const DtModelDefinition& copy);
57 
60 
63  DtModelDefinition& operator=(const DtModelDefinition&);
64 
66  virtual void getRecord(makArchives::DtModelDefinitionRecord& rec);
67 
69  virtual void setFromRecord(const makArchives::DtModelDefinitionRecord& rec);
70 
83 
87  void clearCache();
88 
91  DtVirtualBaseClass* findCachedData(const std::string& name);
92 
96  void setCachedData(const std::string& name,DtVirtualBaseClass* data);
97 
99  inline void deleteCachedData(const std::string& name)
100  {
101  setCachedData(name,0);
102  }
103 
109  void setParameter(const std::string& parameterName,
110  const std::string& parameterValue);
111 
116  bool clearParameter(const std::string& parameterName);
117 
122  const std::string& parameter(const std::string& parameterName) const;
123 
130  const std::string* findParameter(const std::string& parameterName) const;
131 
135  std::string* findParameter(const std::string& parameterName);
136 
138  const ParameterMap& parameters() const;
139 
141  const std::string& name() const;
142 
144  const std::string& schema() const;
145 
147  void setSchema(const std::string& schemaStr);
148 
150  void setPersistent(bool persistent);
151 
153  bool persistent() const;
154 
156  bool modified() const;
157  void setModified(bool);
158 
160  //void addKeyWord( const std::string& keyword);
161 
163  //void removeKeyWord( const std::string& keyword);
164 
166  //const std::set<std::string>& keyWords() const;
167 
171  //bool hasKeyWords(const std::set<std::string>&) const;
172 
173  protected:
174 
175  static std::string cleanName(const std::string& name);
176 
178  {
179  public:
180  template <typename Archive>
181  void serialize(Archive& ar,unsigned int version)
182  {
184  }
185  };
186 
187  typedef boost::unordered_map<std::string,DtVirtualBaseClass*> CacheMap;
188 
189  template <typename Archive>
190  void _serialize(Archive& ar,unsigned int version)
191  {
192  ar & DT_SERIALIZE_MEMBER(myName);
193 
194  //If not initial version.
195  if(version > 1)
196  {
197  ar& DT_SERIALIZE_MEMBER(mySchema);
198  }
199  ar & DT_SERIALIZE_MEMBER(myParameters);
200 
201  if(version > 2)
202  {
203  ar & DT_SERIALIZE_MEMBER(myKeywords);
204  }
205 
206  //We're no longer modified if we save or load.
207  myModifiedFlag = false;
208  }
209 
210  std::string myName;
211  std::string mySchema;
213 
215 
220  };
221 }
222 
224 
225 #endif

Document ID: Generated on Tue Jan 29 18:21:16 EST 2013 from SVN revision 123193
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)