VR-Forces 4.1.1 Class Documentation
DtElementDefinitionManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
7 
8 #pragma once
9 #include <boost/unordered_map.hpp>
10 #include <vrvUtil/DtUnicode.h>
11 #include <vrvCore/vrvCore.h>
17 
19 
20 #include <boost/signal.hpp>
21 
22 namespace makArchives
23 {
24  class DtElementDefinitionRecord;
25  class DtElementsRecord;
26 
27  namespace oldRecords
28  {
29  class DtElementDefinition;
30  class DtElementDefinitionHierarchy;
31  class DtElementDefinitionNode;
32  class DtVisualAttributeInterface;
33  };
34 }
35 
36 namespace makVrv
37 {
38  class DtDe;
39  class DtBaseConnection;
40  class DtElementDefinitionNew;
41  class DtDeSettings;
42 
48  {
49  public:
51  typedef boost::unordered_map<DtUnicode,DtElementDefinitionNew*>
53 
55  typedef std::vector<const DtElementDefinitionNew*> ElementDefinitions;
56 
58  static const DtElementDefinitionManager* createConstCopy(
59  const DtElementDefinitionManager& orig);
60 
63 
66  const std::string& name() const;
67 
70  const DtUnicode& screenName() const;
71 
73  unsigned int numberOfElementDefinitions() const;
74 
78  const DefinitionMap& elementDefinitions() const;
79 
82  DtElementDefinitionNew* findElementDefinition(
83  const DtUnicode& definitionName);
84 
87  const DtElementDefinitionNew* findElementDefinition(
88  const DtUnicode& definitionName) const;
89 
92  DtElementDefinitionNew* createElementDefinition(
93  const DtUnicode& definitionName);
94 
98  DtElementDefinitionNew* createElementDefinition(
99  const DtUnicode& definitionName,
100  DtElementDefinitionNew* parentDefinition);
101 
104  void destroyElementDefinition(DtElementDefinitionNew*);
105 
107  void destroyElementDefinitionAndChildren(DtElementDefinitionNew*);
108 
113  DtElementDefinitionNew* copyElementDefinition(DtElementDefinitionNew& def,
114  const DtUnicode& newName);
115 
117  DtBackupInterface* backup();
118 
123  bool renameElementDefinition(const DtUnicode& oldName,
124  const DtUnicode& newName);
125 
127  void loadDefaults();
128 
130  void loadDefaults(bool loadOnlyFactory);
131 
133  void revertSettings();
134 
136  virtual void saveAsDefaults();
137 
139  virtual void exportSettings(const std::string& fileName);
140 
145  virtual void importSettings(const std::string& fileName,
146  ElementDefinitions& addedDefinitions,
147  ElementDefinitions& skippedDefinitions);
148 
150  virtual void importSettings(const std::string& fileName);
151 
156  virtual void mergeSettings(const std::string& fileName,
157  ElementDefinitions& addedDefinitions,
158  ElementDefinitions& skippedDefinitions);
159 
161  virtual DtDeSettings* settings();
162 
164  virtual void setFromRecord(const makArchives::DtElementsRecord& rec);
165 
170  virtual void setFromRecord(const makArchives::DtElementsRecord& rec,
171  ElementDefinitions& addedDefinitions,
172  ElementDefinitions& skippedDefinitions);
173 
176  virtual void mergeRecord(
178  ElementDefinitions& addedDefinitions,
179  ElementDefinitions& skippedDefinitions);
180 
182  virtual void getRecord(makArchives::DtElementsRecord& rec);
183 
185  virtual void setAutoSave(bool enabled);
186 
187  protected:
188 
190 
192  DtElementDefinitionManager(const std::string& name,
193  const DtUnicode& screenName, DtDe& de, bool procedural);
194 
197 
199  void registerDefinitionHierarchy(DtElementDefinitionNew* root);
200 
202  static DtVisualizerAttribute* attributeFromOldRecord(
204 
208  void setFromOldRecord(
210  ElementDefinitions& addedDefinitions,
211  ElementDefinitions& skippedDefinitions);
212 
218  void loadOldDefinitionNode(DtElementDefinitionNew* parent,
220  ElementDefinitions& addedDefinitions,
221  ElementDefinitions& skippedDefinitions);
222 
225  void buildDefinitionSetsFromOldRecord(DtElementDefinitionNew& newElem,
227 
229  typedef std::vector<const makArchives::DtElementDefinitionRecord*> ElementGroup;
230 
234  typedef std::map<DtUnicode, ElementGroup> ParentToElementsMap;
235 
237  virtual void buildElementVisualizers(DtElementDefinitionNew& ed,
239 
242  virtual void buildElementChildren(
243  DtElementDefinitionNew& ed, ParentToElementsMap& parentToElementsMap,
244  ElementDefinitions& addedDefinitions,
245  ElementDefinitions& skippedDefinitions);
246 
250  buildElementDefinitionRecord( DtElementDefinitionNew& elementDef);
251 
254  virtual void registerBackup();
255 
256  virtual bool recordMatchesDefinition(
258  const DtElementDefinitionNew* existingChildDef) const;
259 
260  private:
264 
268 
269  protected:
272 
273  std::string myName;
275 
280 
282  };
283 
284 
289  public DtVirtualBaseClass
290  {
291  public:
292 
294  typedef unsigned int ElementDefinitionType;
295 
299  {
307  };
308 
313  static DtElementDefinitionTypeManager& instance(DtDe& de);
314 
317  static DtElementDefinitionTypeManager& instance(DtBaseConnection& con);
318 
321  static void copyInstance(DtBaseConnection& con, DtDe&);
322 
324  static const DtElementDefinitionTypeManager* createConstCopy(DtDe& de);
325 
328 
339  void registerElementType(ElementDefinitionType type,
340  const std::string& name, const DtUnicode& typeScreenName,
341  bool proceduralOnly);
342 
345  DtElementDefinitionManager* findElementManager(ElementDefinitionType type);
346 
349  DtElementDefinitionManager& elementManager(ElementDefinitionType type);
350 
354  const DtElementDefinitionManager& elementManager(
355  ElementDefinitionType type) const;
356 
358  void loadDefaults();
359 
360  protected:
361 
363  template <typename ManagerClass>
364  friend ManagerClass& defaultManagerInstanceFunction(DtDe&,bool);
365 
367  template <typename ManagerClass>
368  friend void defaultManagerRegisterInstanceFunction(DtDe&, ManagerClass*);
369 
372 
375 
378 
379  private:
383  operator=( const DtElementDefinitionTypeManager& );
384 
385  protected:
386 
387  typedef boost::unordered_map<unsigned int, DtElementDefinitionManager*>
389 
393  };
394 
395 
400  {
401  public:
403  static DtElementDefinitionSignaler& instance(DtDe&);
404 
406  virtual ~DtElementDefinitionSignaler();
407 
408  //Signals.
409  boost::signal<void (const DtUnicode& oldName, const DtUnicode& newName)>
411 
412  protected:
415 
416  private:
420 
424 
425  };
426 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)