VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtModelDefinition.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
14 #include <vrvUtil/DtKeywordMixin.h>
15 #include <boost/serialization/version.hpp>
16 #include <boost/unordered_map.hpp>
17 #include <map>
18 
19 namespace makArchives
20 {
21  class DtModelDefinitionRecord;
22 }
23 
24 namespace makVrv
25 {
26  class DtVirtualBaseClass;
27 
33  {
34  public:
35 
36  //Global public empty string.
37  static const std::string theEmptyString;
38 
39  typedef std::map<std::string,std::string> ParameterMap;
40 
45  DtModelDefinition(const std::string& modelName = "");
46 
49 
51  DtModelDefinition(const std::string& modelName,const DtModelDefinition& copy);
52 
55 
58  DtModelDefinition& operator=(const DtModelDefinition&);
59 
61  virtual void getRecord(makArchives::DtModelDefinitionRecord& rec);
62 
64  virtual void setFromRecord(const makArchives::DtModelDefinitionRecord& rec);
65 
78 
82  void clearCache();
83 
86  DtVirtualBaseClass* findCachedData(const std::string& name);
87 
91  void setCachedData(const std::string& name,DtVirtualBaseClass* data);
92 
94  inline void deleteCachedData(const std::string& name)
95  {
96  setCachedData(name,0);
97  }
98 
104  void setParameter(const std::string& parameterName,
105  const std::string& parameterValue);
106 
111  bool clearParameter(const std::string& parameterName);
112 
117  const std::string& parameter(const std::string& parameterName) const;
118 
125  const std::string* findParameter(const std::string& parameterName) const;
126 
130  std::string* findParameter(const std::string& parameterName);
131 
133  const ParameterMap& parameters() const;
134 
136  const std::string& name() const;
137 
139  const std::string& schema() const;
140 
142  void setSchema(const std::string& schemaStr);
143 
145  void setPersistent(bool persistent);
146 
148  bool persistent() const;
149 
151  bool modified() const;
152  void setModified(bool);
153 
155  //void addKeyWord( const std::string& keyword);
156 
158  //void removeKeyWord( const std::string& keyword);
159 
161  //const std::set<std::string>& keyWords() const;
162 
166  //bool hasKeyWords(const std::set<std::string>&) const;
167 
168  protected:
169 
170  static std::string cleanName(const std::string& name);
171 
173  {
174  public:
175  template <typename Archive>
176  void serialize(Archive& ar,unsigned int version)
177  {
179  }
180  };
181 
182  typedef boost::unordered_map<std::string,DtVirtualBaseClass*> CacheMap;
183 
184  template <typename Archive>
185  void _serialize(Archive& ar,unsigned int version)
186  {
187  ar & DT_SERIALIZE_MEMBER(myName);
188 
189  //If not initial version.
190  if(version > 1)
191  {
192  ar& DT_SERIALIZE_MEMBER(mySchema);
193  }
194  ar & DT_SERIALIZE_MEMBER(myParameters);
195 
196  if(version > 2)
197  {
198  ar & DT_SERIALIZE_MEMBER(myKeywords);
199  }
200 
201  //We're no longer modified if we save or load.
202  myModifiedFlag = false;
203  }
204 
205  std::string myName;
206  std::string mySchema;
208 
210 
215  };
216 }
217 

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)