VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
propertyInterface.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 
11 #include <vrfutil/vrfutilDefines.h>
12 #include <vrfutil/rwBoolean.h>
13 #include <vrfutil/rwString.h>
14 #include <vrfutil/rwInt.h>
15 #include <vrfutil/rwReal.h>
16 #include <vrfutil/rwVector.h>
18 #include <vlutil/vlTime.h>
19 
20 #include <string>
21 
24 {
25 public:
27  {
28  Replace = 0x00000001,
29  MinimalSimilarityCheck = 0x00000002,
30  RollUp = 0x00000004,
31 
32 
33  AddMissing = 0x00000008
34  };
35 
36  virtual ~DtPropertyInterface() {};
37 
41  virtual char* encode(char*) const = 0;
42 
44  virtual const char* decode(const char*) = 0;
45 
47  virtual void getSize(int& size) const = 0;
48 
50  virtual int hlaAlignment() const = 0;
51 
53  virtual const char* propertyType() const = 0;
54 
55  virtual DtString stringRep(const DtString& root = "") const = 0;
56 
57  int getSize() const
58  {
59  int size = 0;
60  getSize(size);
61 
62  return size;
63  }
64 
68  virtual DtReaderWriter* readerWriter() = 0;
69  virtual const DtReaderWriter* readerWriter() const = 0;
71 
74  virtual bool isSimilarProperty(const DtPropertyInterface* rhs) const
75  {
76  return (std::string(rhs->propertyType()) == std::string(propertyType()));
77  }
78 
90  virtual bool merge(const DtPropertyInterface& target, MergeFlags,
91  const DtMergePath& path = DtMergePath(), const std::set<DtString>& ignore = std::set<DtString>()) = 0;
92 
94  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
95  const DtVariableBindingsList& variableBindings) = 0;
96 
98  virtual void reset() = 0;
99 };
100 
103 template <typename _RwType>
104 class DtRwProperty : public _RwType, public DtPropertyInterface
105 {
106 private:
108  DtRwProperty();
109 
110 public:
111 
112  DtRwProperty(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
113  DtRwProperty(const DtString& name, const DtRwProperty& orig,
114  DtReaderWriterRegistry* parentRegistry = 0);
115  DtRwProperty& operator=(const DtRwProperty& orig);
116  virtual ~DtRwProperty();
117 
121  virtual char* encode(char*) const;
122 
124  virtual const char* decode(const char*);
125 
126  virtual DtString stringRep(const DtString& root = "") const;
127 
129  virtual void getSize(int& size) const;
130 
131  virtual int hlaAlignment() const;
132 
134  virtual const char* propertyType() const;
135 
136  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
137  const DtVariableBindingsList& variableBindings);
138 
140  virtual bool merge(const DtPropertyInterface& target, MergeFlags,
141  const DtMergePath& path = DtMergePath(), const std::set<DtString>& ignore = std::set<DtString>());
142 
145  virtual DtReaderWriter* readerWriter();
146  virtual const DtReaderWriter* readerWriter() const;
148 
151  virtual DtPropertyInterface* property();
152  virtual const DtPropertyInterface* property() const;
154 
156  virtual void recordUpdateTime() const;
157 
159  virtual bool wasUpdatedSince(DtTime t) const;
160 
161  virtual void reset();
162 
163 protected:
164 
167 
168 };
169 
174 template <typename _RwType>
176 {
177 private:
180 
181 public:
182 
183  DtRwPropertyWithThreshold(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
185  DtReaderWriterRegistry* parentRegistry = 0);
187  virtual ~DtRwPropertyWithThreshold();
188 
193  virtual char* encode(char*) const;
194 
198  virtual bool wasUpdatedSince(DtTime t) const;
199 
201  virtual void enableThresholding(bool enable);
202 
206  virtual void setThreshold(double percentage);
207 
210  static void setDefaultThreshold(double percentage);
211 
216  virtual void setMaxUpdateInterval(DtTime interval);
217 
220  static void setDefaultMaxUpdateInterval(DtTime interval);
221 
230  virtual void setMaxUnchangedUpdateInterval(DtTime interval);
231 
234  static void setDefaultMaxUnchangedUpdateInterval(DtTime interval);
235 
236 protected:
237 
240 
242  mutable _RwType myLastEncodedValue;
243 
246 
247  static double myDefaultThreshold;
248  double myThreshold;
249 
252 
255 };
256 
258 {
259 public:
260  DtRwPropertyString(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
261  DtRwPropertyString(const DtString& name, const DtRwPropertyString& orig,
262  DtReaderWriterRegistry* parentRegistry = 0);
264  DtReaderWriterRegistry* parentRegistry = 0);
265 
267 
268  virtual ~DtRwPropertyString();
269 };
270 
272 {
273 public:
274  DtRwPropertyBoolean(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
275  DtRwPropertyBoolean(const DtString& name, const DtRwPropertyBoolean& orig,
276  DtReaderWriterRegistry* parentRegistry = 0);
278  DtReaderWriterRegistry* parentRegistry = 0);
280  virtual ~DtRwPropertyBoolean();
281 };
282 
284 {
285 public:
286  DtRwPropertyInt(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
287  DtRwPropertyInt(const DtString& name, const DtRwPropertyInt& orig,
288  DtReaderWriterRegistry* parentRegistry = 0);
289  DtRwPropertyInt(const DtRwPropertyInt& orig,
290  DtReaderWriterRegistry* parentRegistry = 0);
292  virtual ~DtRwPropertyInt();
293 };
294 
296 {
297 public:
298  DtRwPropertyReal(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
299  DtRwPropertyReal(const DtString& name, const DtRwPropertyReal& orig,
300  DtReaderWriterRegistry* parentRegistry = 0);
302  DtReaderWriterRegistry* parentRegistry = 0);
304  virtual ~DtRwPropertyReal();
305 };
306 
308 {
309 public:
310  DtRwPropertyVector(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
311  DtRwPropertyVector(const DtString& name, const DtRwPropertyVector& orig,
312  DtReaderWriterRegistry* parentRegistry = 0);
314  DtReaderWriterRegistry* parentRegistry = 0);
316  virtual ~DtRwPropertyVector();
317 };
318 
319 
321 {
322 public:
323  DtRwPropertyOffsetVector(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
325  DtReaderWriterRegistry* parentRegistry = 0);
327  DtReaderWriterRegistry* parentRegistry = 0);
329  virtual ~DtRwPropertyOffsetVector();
330 };

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)