VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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>
18 
20 
21 #include <boost/signal.hpp>
22 
23 namespace makArchives
24 {
25  class DtElementDefinitionRecord;
26  class DtElementsRecord;
27 
28  namespace oldRecords
29  {
30  class DtElementDefinition;
31  class DtElementDefinitionHierarchy;
32  class DtElementDefinitionNode;
33  class DtVisualAttributeInterface;
34  };
35 }
36 
37 namespace makVrv
38 {
39  class DtDe;
40  class DtBaseConnection;
41  class DtElementDefinitionNew;
42  class DtDeSettings;
43 
49  {
50  public:
52  typedef boost::unordered_map<DtUnicode,DtElementDefinitionNew*>
54 
56  typedef std::vector<const DtElementDefinitionNew*> ElementDefinitions;
57 
59  static const DtElementDefinitionManager* createConstCopy(
60  const DtElementDefinitionManager& orig);
61 
64 
67  const std::string& name() const;
68 
71  const DtUnicode& screenName() const;
72 
74  unsigned int numberOfElementDefinitions() const;
75 
79  const DefinitionMap& elementDefinitions() const;
80 
83  DtElementDefinitionNew* findElementDefinition(
84  const DtUnicode& definitionName);
85 
88  const DtElementDefinitionNew* findElementDefinition(
89  const DtUnicode& definitionName) const;
90 
93  DtElementDefinitionNew* createElementDefinition(
94  const DtUnicode& definitionName);
95 
99  DtElementDefinitionNew* createElementDefinition(
100  const DtUnicode& definitionName,
101  DtElementDefinitionNew* parentDefinition);
102 
105  void destroyElementDefinition(DtElementDefinitionNew*);
106 
108  void destroyElementDefinitionAndChildren(DtElementDefinitionNew*);
109 
114  DtElementDefinitionNew* copyElementDefinition(DtElementDefinitionNew& def,
115  const DtUnicode& newName);
116 
118  DtBackupInterface* backup();
119 
124  bool renameElementDefinition(const DtUnicode& oldName,
125  const DtUnicode& newName);
126 
128  void loadDefaults();
129 
131  void loadDefaults(bool loadOnlyFactory);
132 
134  void revertSettings();
135 
137  virtual void saveAsDefaults();
138 
140  virtual void exportSettings(const std::string& fileName);
141 
146  virtual void importSettings(const std::string& fileName,
147  ElementDefinitions& addedDefinitions,
148  ElementDefinitions& skippedDefinitions);
149 
151  virtual void importSettings(const std::string& fileName);
152 
157  virtual void mergeSettings(const std::string& fileName,
158  ElementDefinitions& addedDefinitions,
159  ElementDefinitions& skippedDefinitions);
160 
162  virtual DtDeSettings* settings();
163 
165  virtual void setFromRecord(const makArchives::DtElementsRecord& rec);
166 
171  virtual void setFromRecord(const makArchives::DtElementsRecord& rec,
172  ElementDefinitions& addedDefinitions,
173  ElementDefinitions& skippedDefinitions);
174 
177  virtual void mergeRecord(
179  ElementDefinitions& addedDefinitions,
180  ElementDefinitions& skippedDefinitions);
181 
183  virtual void getRecord(makArchives::DtElementsRecord& rec);
184 
186  virtual void setAutoSave(bool enabled);
187 
189  virtual bool validateElementDefinition(const DtElementDefinitionNew& def);
190 
191  protected:
192 
194 
196  DtElementDefinitionManager(const std::string& name,
197  const DtUnicode& screenName, DtDe& de, bool procedural);
198 
201 
203  void registerDefinitionHierarchy(DtElementDefinitionNew* root);
204 
206  static DtVisualizerAttribute* attributeFromOldRecord(
208 
212  void setFromOldRecord(
214  ElementDefinitions& addedDefinitions,
215  ElementDefinitions& skippedDefinitions);
216 
222  void loadOldDefinitionNode(DtElementDefinitionNew* parent,
224  ElementDefinitions& addedDefinitions,
225  ElementDefinitions& skippedDefinitions);
226 
229  void buildDefinitionSetsFromOldRecord(DtElementDefinitionNew& newElem,
231 
233  typedef std::vector<const makArchives::DtElementDefinitionRecord*> ElementGroup;
234 
238  typedef std::map<DtUnicode, ElementGroup> ParentToElementsMap;
239 
241  virtual void buildElementVisualizers(DtElementDefinitionNew& ed,
243 
246  virtual void buildElementChildren(
247  DtElementDefinitionNew& ed, ParentToElementsMap& parentToElementsMap,
248  ElementDefinitions& addedDefinitions,
249  ElementDefinitions& skippedDefinitions);
250 
254  buildElementDefinitionRecord( DtElementDefinitionNew& elementDef);
255 
258  virtual void registerBackup();
259 
260  virtual bool recordMatchesDefinition(
262  const DtElementDefinitionNew* existingChildDef) const;
263  private:
267 
271 
272  protected:
273  typedef std::map<std::string, DtVisualizerDefinitionValidator*> VisualizerDefinitionValidatorMap;
276 
278 
279  std::string myName;
281 
286 
288  };
289 
290 
295  public DtVirtualBaseClass
296  {
297  public:
298 
300  typedef unsigned int ElementDefinitionType;
301 
305  {
313  };
314 
319  static DtElementDefinitionTypeManager& instance(DtDe& de);
320 
323  static DtElementDefinitionTypeManager& instance(DtBaseConnection& con);
324 
327  static void copyInstance(DtBaseConnection& con, DtDe&);
328 
330  static const DtElementDefinitionTypeManager* createConstCopy(DtDe& de);
331 
334 
345  void registerElementType(ElementDefinitionType type,
346  const std::string& name, const DtUnicode& typeScreenName,
347  bool proceduralOnly);
348 
351  DtElementDefinitionManager* findElementManager(ElementDefinitionType type);
352 
355  DtElementDefinitionManager& elementManager(ElementDefinitionType type);
356 
360  const DtElementDefinitionManager& elementManager(
361  ElementDefinitionType type) const;
362 
364  void loadDefaults();
365 
366  protected:
367 
369  template <typename ManagerClass>
370  friend ManagerClass& defaultManagerInstanceFunction(DtDe&,bool);
371 
373  template <typename ManagerClass>
374  friend void defaultManagerRegisterInstanceFunction(DtDe&, ManagerClass*);
375 
378 
381 
384 
385  private:
389  operator=( const DtElementDefinitionTypeManager& );
390 
391  protected:
392 
393  typedef boost::unordered_map<unsigned int, DtElementDefinitionManager*>
395 
399  };
400 
401 
406  {
407  public:
409  static DtElementDefinitionSignaler& instance(DtDe&);
410 
412  virtual ~DtElementDefinitionSignaler();
413 
414  //Signals.
415  boost::signal<void (const DtUnicode& oldName, const DtUnicode& newName)>
417 
418  protected:
421 
422  private:
426 
430 
431  };
432 }

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)