VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
modelSet.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
13 
14 #include "vrfutil/rwList.h"
15 #include "vrfutil/rwInt.h"
16 #include <vlutil/vlString.h>
18 #include <boost/unordered_map.hpp>
20 
21 class DtModelSetEntry;
22 class DtFilename;
23 class DtObjectType;
25 
26 #define LATEST_MODEL_SET_VERSION 1
27 
29 {
30 public:
31 
33  DtModelSet();
34 
36  parentRegistry = NULL);
37 
39  virtual ~DtModelSet();
40 
42  DtModelSet(const DtModelSet& orig,
43  DtReaderWriterRegistry* parentRegistry = NULL);
44 
46  DtModelSet& operator=(const DtModelSet& orig);
47 
48  virtual bool load(const DtFilename&);
49  virtual bool save(const DtFilename&);
50 
51  virtual DtModelSetEntry* find(const DtObjectType&) const;
52  virtual DtModelSetEntry* findMatchingPattern(const DtObjectType&) const;
53  virtual DtModelSetEntry* findByUniqueID(const DtString&) const;
54  virtual DtModelSetEntry* findByLabel(const DtString&) const;
55 
58  virtual void add(DtModelSetEntry*);
59 
61  virtual void* remove(DtReaderWriter*, DtListItem*);
62 
63  virtual void setComment(const DtString&);
64  virtual const DtString comment() const;
65 
66  static DtModelSet* create(const DtString&, DtReaderWriterRegistry* const parentRegistry = NULL);
67 
69  DtObjectType objectTypeFor(const DtString& label) const;
70 
73  virtual DtModelSetEntry* addModel(DtModelSetEntry*, bool clone = true);
74 
75  virtual void emptyList();
76 
79  virtual void entitiesForObjectType(const DtObjectType& o, std::list<DtString>& list) const;
80 
82 
83  int version() const;
84 
86  virtual DtString createUniqueID(const DtModelSetEntry*) const;
87  virtual DtString createUniqueID(const DtString&) const;
88 
90  virtual DtModelSetEntry* removeModel(const DtObjectType&);
91  virtual DtModelSetEntry* removeModel(const DtModelSetEntry* e);
92 
95  virtual void loadFromDataFiles(const std::string& directory);
96 
99  virtual const std::set<DtString>& categories() const;
100 
102  virtual const std::set<DtString>& categoriesForPalette(const DtString& pal) const;
103 
105  virtual void loadEntityFiles(const std::string&);
106 
108  virtual void loadSimulationObjectGroupFiles(const std::string&);
109 
111  virtual const DtObjectType& nextAvailableSimulationObjectGroupObjectType() const;
112 
114  virtual const DtObjectType& nextAvailableRandomizedObjectObjectType() const;
115 
117  virtual DtSimulationObjectGroupModelSetEntry findSimulationObjectGroup(const DtString& sogName) const;
118 
119 protected:
122  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
123  const DtVariableBindingsList& variableBindings);
124 
126  void copyList(const DtModelSet& orig);
128  void clear();
129 
130  virtual void writeSelf(std::string& fp, int i, bool writeUnspecified,
131  const DtFilename& path);
132 
134  virtual void addCategoriesFrom(DtModelSetEntry*);
135 
136  virtual void updateNextSimulationObjectGroupObjectType(DtSimulationObjectGroupModelSetEntry*);
137  virtual void updateNextRandomizedObjectObjectType(DtModelSetEntry*);
138 
139 protected:
143  std::set<DtString> myCategories;
144  std::map<DtString, std::set<DtString> > myCategoriesForPalette;
145  typedef boost::unordered_map<DtString, DtModelSetEntry*> FastMap;
149 };
150 
151 
152 inline int DtModelSet::version() const
153 {
154  return myVersion;
155 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)