VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtElementsRecord.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
6 
7 #pragma once
8 
11 
12 #include <boost/serialization/unordered_map.hpp>
13 
14 #include <iostream>
15 #include <unordered_map>
16 
17 namespace makArchives
18 {
19 
23 {
24 public:
25  using ElementDefinitionRecords = std::vector<DtElementDefinitionRecord> ;
26 
27  using ElementDefinitionsToFiles = std::unordered_map<std::string, std::string>;
28 
31 
33  virtual ~DtElementsRecord();
34 
35 public:
38  void setElementDefinitions(const ElementDefinitionRecords& elementDefinitions);
39  void addElementDefinitions(const ElementDefinitionRecords& elementDefinitions);
40  void removeElementDefinition(const DtElementDefinitionRecord elementDefinition);
41  void replaceOrAddElementDefinition(const DtElementDefinitionRecord& elemRec);
43 
44  // Mark all these element definitions are belonging to the hierarchy
45  void setAllIsHierTo(bool isHier);
46 
47  // Update all the records to a file name *if* they don't have one already aka empty
48  // (usally done on load so we know which records go with which files)
49  void setAllFileName(const std::string& fileName);
50 
51  const ElementDefinitionRecords& elementDefinitions() const;
52  ElementDefinitionRecords& elementDefinitions();
53 
56  void setWriteFilePaths( bool shouldWrite );
57 
60  void copyFilePathsToDefinitions();
61 protected:
62  friend class boost::serialization::access;
63 
64  template<class Archive>
65  void serialize(Archive & ar, const unsigned int version)
66  {
67  ar & BOOST_SERIALIZATION_NVP(myElementDefinitions);
68 
69  if( version == 2 && myWriteFilePaths )
70  {
71  ar & BOOST_SERIALIZATION_NVP( myElementDefinitionToFilePathMap );
72  }
73  }
74 
78 };
79 }
80 
bool myWriteFilePaths
Definition: DtElementsRecord.h:75
BOOST_CLASS_VERSION(makArchives::DtDiGuySettingsRecord, 3)
void serialize(Archive &ar, const unsigned int version)
Definition: DtElementsRecord.h:65
Record containing a collection of element definition records.
Definition: DtElementsRecord.h:22
ElementDefinitionsToFiles myElementDefinitionToFilePathMap
Definition: DtElementsRecord.h:77
ElementDefinitionRecords myElementDefinitions
Definition: DtElementsRecord.h:76
Record for an element definition (new type)
Definition: DtElementDefinitionRecord.h:90
std::unordered_map< std::string, std::string > ElementDefinitionsToFiles
Definition: DtElementsRecord.h:27
#define DT_DLL_MAKARCHIVES
Definition: makArchives.h:31
std::vector< DtElementDefinitionRecord > ElementDefinitionRecords
Definition: DtElementsRecord.h:25

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)