VR-Forces 4.5 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 
62  bool operator==(const DtModelDefinition&) const;
63 
66  bool operator!=(const DtModelDefinition&) const;
67 
69  virtual void getRecord(makArchives::DtModelDefinitionRecord& rec);
70 
72  virtual void setFromRecord(const makArchives::DtModelDefinitionRecord& rec);
73 
86 
90  void clearCache();
91 
94  DtVirtualBaseClass* findCachedData(const std::string& name);
95 
99  void setCachedData(const std::string& name,DtVirtualBaseClass* data);
100 
102  inline void deleteCachedData(const std::string& name)
103  {
104  setCachedData(name,0);
105  }
106 
112  void setParameter(const std::string& parameterName,
113  const std::string& parameterValue);
114 
119  bool clearParameter(const std::string& parameterName);
120 
125  const std::string& parameter(const std::string& parameterName) const;
126 
133  const std::string* findParameter(const std::string& parameterName) const;
134 
138  std::string* findParameter(const std::string& parameterName);
139 
141  const ParameterMap& parameters() const;
142 
144  const std::string& name() const;
145 
147  const std::string& schema() const;
148 
150  void setSchema(const std::string& schemaStr);
151 
153  void setPersistent(bool persistent);
154 
156  bool persistent() const;
157 
159  bool modified() const;
160  void setModified(bool);
161 
163  //void addKeyWord( const std::string& keyword);
164 
166  //void removeKeyWord( const std::string& keyword);
167 
169  //const std::set<std::string>& keyWords() const;
170 
174  //bool hasKeyWords(const std::set<std::string>&) const;
175 
176  protected:
177 
178  static std::string cleanName(const std::string& name);
179 
181  {
182  public:
183  template <typename Archive>
184  void serialize(Archive& ar,unsigned int version)
185  {
187  }
188  };
189 
190  typedef boost::unordered_map<std::string,DtVirtualBaseClass*> CacheMap;
191 
192  template <typename Archive>
193  void _serialize(Archive& ar,unsigned int version)
194  {
195  ar & DT_SERIALIZE_MEMBER(myName);
196 
197  //If not initial version.
198  if(version > 1)
199  {
200  ar& DT_SERIALIZE_MEMBER(mySchema);
201  }
202  ar & DT_SERIALIZE_MEMBER(myParameters);
203 
204  if(version > 2)
205  {
206  ar & DT_SERIALIZE_MEMBER(myKeywords);
207  }
208 
209  //We're no longer modified if we save or load.
210  myModifiedFlag = false;
211  }
212 
213  std::string myName;
214  std::string mySchema;
216 
218 
223  };
224 }
225 

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)