VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtElementDefinitionManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
7 
8 #pragma once
9 
12 #include <boost/unordered_map.hpp>
13 
14 namespace makArchives
15 {
16  class DtElementDefinitionRecord;
17  class DtElementsRecord;
18 
19  namespace oldRecords
20  {
21  class DtElementDefinition;
22  class DtElementDefinitionHierarchy;
23  class DtElementDefinitionNode;
24  class DtVisualAttributeInterface;
25  };
26 }
27 
28 namespace makVrv
29 {
30  class DtDe;
31  class DtBaseConnection;
32  class DtElementDefinitionNew;
33  class DtDeSettings;
34  class DtBackupInterface;
35  class DtVisualizerDefinitionValidator;
36 
42  {
43  public:
45  typedef std::map<DtUnicode, DtElementDefinitionNew*>
47 
49  typedef std::vector<const DtElementDefinitionNew*> ElementDefinitions;
50 
52  typedef std::vector<std::string>::const_iterator ParentToElementIter;
53 
55  static const DtElementDefinitionManager* createConstCopy(
56  const DtElementDefinitionManager& orig);
57 
59  virtual ~DtElementDefinitionManager();
60 
63  const std::string& name() const;
64 
67  const DtUnicode& screenName() const;
68 
70  unsigned int numberOfElementDefinitions() const;
71 
75  const DefinitionMap& elementDefinitions() const;
76 
79  DtElementDefinitionNew* findElementDefinition(
80  const DtUnicode& definitionName);
81 
84  const DtElementDefinitionNew* findElementDefinition(
85  const DtUnicode& definitionName) const;
86 
89  DtElementDefinitionNew* createElementDefinition(
90  const DtUnicode& definitionName);
91 
95  DtElementDefinitionNew* createElementDefinition(
96  const DtUnicode& definitionName,
97  DtElementDefinitionNew* parentDefinition);
98 
101  void destroyElementDefinition(DtElementDefinitionNew*);
102 
104  void destroyElementDefinitionAndChildren(DtElementDefinitionNew*);
105 
110  DtElementDefinitionNew* copyElementDefinition(DtElementDefinitionNew& def,
111  const DtUnicode& newName);
112 
114  DtBackupInterface* backup();
115 
120  bool renameElementDefinition(const DtUnicode& oldName,
121  const DtUnicode& newName);
122 
124  void loadDefaults();
125 
127  void loadDefaults(bool loadOnlyFactory);
128 
132  virtual std::vector<std::string> retrieveHierFilesToMerge(const std::string& type);
133 
137  virtual std::vector<std::string> retrieveLeafFilesToMerge(const std::string& type);
138 
142  virtual bool shouldSkipDefLoading();
143 
145  void revertSettings();
146 
148  virtual void saveAsDefaults();
149 
151  virtual void splitAndWriteToDir(makArchives::DtElementsRecord& elementsRec,
152  const std::string& existingDirName);
153 
155  virtual void exportSettings(const std::string& fileOrDirName);
156 
158  virtual void exportHierSettings(const std::string& fileName);
159 
161  virtual void exportLeafSettings(const std::string& fileName);
162 
164  virtual void exportSelectedLeafSettings(std::vector<std::string>& names,const std::string& fileName);
165 
169  void createFolderFromPathAndSplit(const std::string &fileOrDirName,
170  std::string& newPath, std::string& dirName);
171 
176  virtual void importSettings(const std::string& fileName,
177  ElementDefinitions& addedDefinitions,
178  ElementDefinitions& skippedDefinitions);
179 
181  virtual void importSettings(const std::string& fileName);
182 
184  virtual void mergeHierSettings(const std::string& hierFileOrDirName);
185 
187  virtual void mergeHierSettings(const std::string& hierFileOrDirName,
188  ElementDefinitions& addedDefinitions,
189  ElementDefinitions& skippedDefinitions);
190 
193  virtual void mergeLeafSettings(const std::string& leafFileOrDirName);
194 
196  virtual void mergeLeafSettings(const std::string& fileOrDirName,
197  ElementDefinitions& addedDefinitions,
198  ElementDefinitions& skippedDefinitions);
199 
201  virtual void mergeSettings(const std::string& fileName,
202  ElementDefinitions& addedDefinitions,
203  ElementDefinitions& skippedDefinitions);
204 
209  virtual void markRecordsAsHier(makArchives::DtElementsRecord& rec);
210 
212  virtual DtDeSettings* settings();
213 
218  virtual void setFromRecord(const makArchives::DtElementsRecord& rec);
219 
224  virtual void setFromRecord(const makArchives::DtElementsRecord& rec,
225  ElementDefinitions& addedDefinitions,
226  ElementDefinitions& skippedDefinitions);
227 
230  virtual void mergeRecord(
232  ElementDefinitions& addedDefinitions,
233  ElementDefinitions& skippedDefinitions);
234 
237  virtual void mergeHierRecord(
239  ElementDefinitions& addedDefinitions,
240  ElementDefinitions& skippedDefinitions);
241 
244  virtual void mergeLeafRecord(
246  ElementDefinitions& addedDefinitions,
247  ElementDefinitions& skippedDefinitions);
248 
250  virtual void getRecord(makArchives::DtElementsRecord& rec);
251 
253  virtual void getRecord(const std::vector<std::string>& elementDefinitions, makArchives::DtElementsRecord& rec);
254 
258  virtual void getSplitRecord(std::vector<makArchives::DtElementsRecord>& rec,
259  std::vector<std::string>& fileNames);
260 
263  virtual void addRecords(makArchives::DtElementsRecord& recs,
264  makArchives::DtElementsRecord& combinedRec);
265 
270  virtual void splitRecordElemMgr(makArchives::DtElementsRecord& rec,
272  makArchives::DtElementsRecord& recLeaves);
273 
275  virtual void setAutoSave(bool enabled);
276 
278  virtual bool validateElementDefinition(const DtElementDefinitionNew& def);
279 
283  buildElementDefinitionRecord( DtElementDefinitionNew& elementDef);
284 
286  virtual bool canUseHierLeaf();
287 
289  virtual bool modifiedSinceStartup();
290 
292  virtual void addToModifiedDefinitionsMap(DtElementDefinitionNew* modelDefinition);
293 
295  virtual void addToAddedDefinitionsMap(DtElementDefinitionNew* modelDefinition);
296 
298  virtual void addToDeletedDefinitionsMap(DtElementDefinitionNew* modelDefinition);
299 
301  virtual void resetModifiedFlags();
302 
303  public:
306  boost::signal<void ()> signal_managerAboutTobeDeleted;
307 
308  protected:
309 
311 
313  DtElementDefinitionManager(const std::string& name,
314  const DtUnicode& screenName, DtDe& de, bool procedural);
315 
318 
320  void registerDefinitionHierarchy(DtElementDefinitionNew* root);
321 
323  typedef std::vector<const makArchives::DtElementDefinitionRecord*> ElementGroup;
324 
328  typedef std::map<DtUnicode, ElementGroup> ParentToElementsMap;
329 
331  virtual void buildElementVisualizers(DtElementDefinitionNew& ed,
333 
335  virtual void buildElementVisualizersForModelSet(
337  DtElementDefinitionNew &ed, int modelSet);
338 
341  virtual void buildElementChildren(
342  DtElementDefinitionNew& ed, ParentToElementsMap& parentToElementsMap,
343  ElementDefinitions& addedDefinitions,
344  ElementDefinitions& skippedDefinitions);
345 
348  static void setupVisualizerDefs(makArchives::DtElementDefinitionRecord &elementRec,
349  DtElementDefinitionNew &elementDef, unsigned int modelSet);
350 
353  virtual void registerBackup();
354 
356  virtual bool recordMatchesDefinition(
358  const DtElementDefinitionNew* existingChildDef) const;
359 
361  virtual bool recordMatchesDefinitionModelSet(
363  const DtElementDefinitionNew* existingChildDef,
364  int modelSet) const;
365 
367  virtual void generateParentToElement(ParentToElementsMap& parentToElements,
369 
371  virtual bool checkRecordsAreLeavesInHier(ParentToElementsMap& parentToElements,
372  std::vector<makArchives::DtElementsRecord>& recVec,
373  std::vector<std::string>& leafFiles);
374 
376  virtual bool replaceMergeLeaves(
378  std::vector<makArchives::DtElementsRecord>& recVec,
379  const std::vector<std::string>& leafFiles);
380 
382  virtual bool loadDefaultsFromHierLeafDir(makArchives::DtElementsRecord& rec);
383 
386  virtual bool isEntityDefinitions();
387 
388  private:
392 
396 
397  protected:
398  typedef std::map<std::string, DtVisualizerDefinitionValidator*> VisualizerDefinitionValidatorMap;
401 
403 
404  std::string myName;
405  std::string myHierName;
406  std::string myLeafName;
408 
413 
419  };
420 
421 
426  public DtVirtualBaseClass
427  {
428  public:
429 
431  typedef unsigned int ElementDefinitionType;
432 
436  {
444  };
445 
450  static DtElementDefinitionTypeManager& instance(DtDe& de);
451 
454  static DtElementDefinitionTypeManager& instance(DtBaseConnection& con);
455 
458  static void copyInstance(DtBaseConnection& con, DtDe&);
459 
461  static const DtElementDefinitionTypeManager* createConstCopy(DtDe& de);
462 
465 
476  virtual void registerElementType(ElementDefinitionType type,
477  const std::string& name, const DtUnicode& typeScreenName,
478  bool proceduralOnly);
479 
482  virtual DtElementDefinitionManager* findElementManager(ElementDefinitionType type);
483 
486  virtual DtElementDefinitionManager& elementManager(ElementDefinitionType type);
487 
491  virtual const DtElementDefinitionManager& elementManager(
492  ElementDefinitionType type) const;
493 
495  virtual void loadDefaults();
496 
498  virtual DtElementDefinitionTypeManager::ElementDefinitionType getElementDefinitionType(const DtElementDefinitionManager& element);
499 
500  protected:
501 
503  template <typename ManagerClass>
504  friend ManagerClass& defaultManagerInstanceFunction(DtDe&,bool);
505 
507  template <typename ManagerClass>
508  friend void defaultManagerRegisterInstanceFunction(DtDe&, ManagerClass*);
509 
512 
515 
518 
519  private:
523  operator=( const DtElementDefinitionTypeManager& );
524 
525  protected:
526 
527  typedef boost::unordered_map<unsigned int, DtElementDefinitionManager*>
529 
533  };
534 
535 
540  {
541  public:
543  static DtElementDefinitionSignaler& instance(DtDe&);
544 
546  virtual ~DtElementDefinitionSignaler();
547 
548  //Signals.
549  boost::signal<void (const DtUnicode& oldName, const DtUnicode& newName)>
551 
552  protected:
555 
556  private:
560 
564 
565  };
566 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)