VR-Forces 4.3 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>
16 
17 #include <boost/serialization/version.hpp>
18 #include <boost/serialization/set.hpp>
19 #include <boost/serialization/map.hpp>
20 #include <boost/unordered_map.hpp>
21 #include <map>
22 #include <string>
23 #include <set>
24 
25 namespace makVrv
26 {
27  class DtVirtualBaseClass;
28 
34  {
35  public:
36 
37  //Global public empty string.
38  static const std::string theEmptyString;
39 
40  typedef std::map<std::string,std::string> ParameterMap;
41 
46  DtModelDefinition(const std::string& modelName = "");
47 
50 
52  DtModelDefinition(const std::string& modelName,const DtModelDefinition& copy);
53 
56 
59  DtModelDefinition& operator=(const DtModelDefinition&);
60 
62  virtual void getRecord(makArchives::DtModelDefinitionRecord& rec);
63 
65  virtual void setFromRecord(const makArchives::DtModelDefinitionRecord& rec);
66 
79 
83  void clearCache();
84 
87  DtVirtualBaseClass* findCachedData(const std::string& name);
88 
92  void setCachedData(const std::string& name,DtVirtualBaseClass* data);
93 
95  inline void deleteCachedData(const std::string& name)
96  {
97  setCachedData(name,0);
98  }
99 
105  void setParameter(const std::string& parameterName,
106  const std::string& parameterValue);
107 
112  bool clearParameter(const std::string& parameterName);
113 
118  const std::string& parameter(const std::string& parameterName) const;
119 
126  const std::string* findParameter(const std::string& parameterName) const;
127 
131  std::string* findParameter(const std::string& parameterName);
132 
134  const ParameterMap& parameters() const;
135 
137  const std::string& name() const;
138 
140  const std::string& schema() const;
141 
143  void setSchema(const std::string& schemaStr);
144 
146  void setPersistent(bool persistent);
147 
149  bool persistent() const;
150 
152  bool modified() const;
153  void setModified(bool);
154 
156  //void addKeyWord( const std::string& keyword);
157 
159  //void removeKeyWord( const std::string& keyword);
160 
162  //const std::set<std::string>& keyWords() const;
163 
167  //bool hasKeyWords(const std::set<std::string>&) const;
168 
169  protected:
170 
171  static std::string cleanName(const std::string& name);
172 
174  {
175  public:
176  template <typename Archive>
177  void serialize(Archive& ar,unsigned int version)
178  {
180  }
181  };
182 
183  typedef boost::unordered_map<std::string,DtVirtualBaseClass*> CacheMap;
184 
185  template <typename Archive>
186  void _serialize(Archive& ar,unsigned int version)
187  {
188  ar & DT_SERIALIZE_MEMBER(myName);
189 
190  //If not initial version.
191  if(version > 1)
192  {
193  ar& DT_SERIALIZE_MEMBER(mySchema);
194  }
195  ar & DT_SERIALIZE_MEMBER(myParameters);
196 
197  if(version > 2)
198  {
199  ar & DT_SERIALIZE_MEMBER(myKeywords);
200  }
201 
202  //We're no longer modified if we save or load.
203  myModifiedFlag = false;
204  }
205 
206  std::string myName;
207  std::string mySchema;
209 
211 
216  };
217 }
218 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)