VR-Forces 4.7 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
metafileRecord.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1998 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: mfRec.h,v $ $Revision: 1.21 $ $State: Exp $
7 *******************************************************************************/
8 #ifndef metafileRecord_H_
9 #define metafileRecord_H_
10 
13 #include "geometry/color.h"
14 #include "geometry/point.h"
15 #include <vlutil/vlFilename.h>
16 #include <iosfwd>
17 #include <map>
18 
21 
22 typedef std::map<DtString, DtString> DtPropertyNamesMap;
23 typedef DtPropertyNamesMap::iterator DtPropertyNamesIterator;
24 typedef DtPropertyNamesMap::const_iterator DtPropertyNamesConstIterator;
25 
26 //
27 // This is the base class for all metafile records.
29 {
30 
31 public:
32 
35 
37  virtual ~DtMetafileRecord();
38 
41 
43  DtMetafileRecord& operator=(const DtMetafileRecord& orig);
44 
46  virtual bool init();
47 
51  virtual DtString recordTypeName() const = 0;
52 
56  virtual DtConfigCategoryType recordCategory() const = 0;
57 
60  virtual bool canImport();
61 
63  virtual bool put(std::ostream& stream) const;
64 
66  virtual bool get(std::istream& stream);
67 
69  virtual bool processToken(std::istream& stream, DtString& token);
70 
75  virtual bool getAttribute(const DtString attrName, DtString& value, DtString& type, unsigned index=0);
76 
80  virtual bool setAttribute(DtString attrName, DtString value);
81 
83  virtual const DtTerrainInitializer* initializer() const;
84  virtual DtTerrainInitializer* initializer();
85 
88  virtual void setInitializer(DtTerrainInitializer* init);
89 
90  virtual const int recordKey();
91  virtual void setRecordKey(const int key);
92 
94  virtual const DtPropertyNamesMap properties() const;
95 
97  virtual const DtString& recordString() const;
98 
100  virtual void resetFileLists();
101 
103  virtual void setPath(const DtFilename&);
104  virtual const DtFilename& path() const;
105 
106 protected:
107 
109  virtual bool writeAttributes(std::ostream& stream) const;
110 
113  virtual bool getAttribute(const DtString attrName, DtString& value, unsigned index=0);
114 
116  virtual bool setToken(const DtString& token, const DtString value);
117 
118 public:
119 
120  bool isInt(const DtString& valueIn);
121  bool isDouble(const DtString& valueIn);
122  bool isColor(const DtString& valueIn);
123  bool isPoint(const DtString& valueIn);
124  bool isBool(const DtString& valueIn);
125 
126  bool toInt(const DtString& valueIn, int& valueOut);
127  bool toDouble(const DtString& valueIn, double& valueOut);
128  bool toColor(const DtString& valueIn, DtColor& valueOut);
129  bool toPoint(const DtString& valueIn, DtPoint& valueOut);
130  bool toBool(const DtString& valueIn, bool& valueOut);
131 
132 protected:
133 
136  int myRecordKey; // Unique int indentifier for the record
137  DtPropertyNamesMap myAttributeNames; // The attributes that the record has
139  DtFilename myPath;
140 
141 protected:
142 
143  static const DtString theImport; // Used to determine whether the record is
144  // importable or not
145 
146 };
147 
148 DT_DLL_terrainDbFactory std::ostream& operator<<(std::ostream& str, const DtMetafileRecord& object);
149 DT_DLL_terrainDbFactory std::istream& operator>>(std::istream& str, DtMetafileRecord& object);
150 
151 #endif
152 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)