VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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  KeepIsPublished = 0x00000010
35  };
36 
37  virtual ~DtPropertyInterface() {};
38 
42  virtual char* encode(char*) const = 0;
43 
45  virtual const char* decode(const char*) = 0;
46 
48  virtual void getSize(int& size) const = 0;
49 
51  virtual int hlaAlignment() const = 0;
52 
54  virtual const char* propertyType() const = 0;
55 
56  virtual DtString stringRep(const DtString& root = "") const = 0;
57 
58  int getSize() const
59  {
60  int size = 0;
61  getSize(size);
62 
63  return size;
64  }
65 
69  virtual DtReaderWriter* readerWriter() = 0;
70  virtual const DtReaderWriter* readerWriter() const = 0;
72 
75  virtual bool isSimilarProperty(const DtPropertyInterface* rhs) const
76  {
77  return (std::string(rhs->propertyType()) == std::string(propertyType()));
78  }
79 
91  virtual bool merge(const DtPropertyInterface& target, MergeFlags,
92  const DtMergePath& path = DtMergePath(), const std::set<DtString>& ignore = std::set<DtString>()) = 0;
93 
95  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
96  const DtVariableBindingsList& variableBindings) = 0;
97 
100  virtual bool isPublishedArg(DtlObjPtr arg, unsigned& disVarRecType) const
101  {
102  bool isPub = false;
103  disVarRecType = 0;
104 
105  if (!DtcNull(arg))
106  {
107  if (arg->tag() == DtpSymbol)
108  {
109  DtString pn(arg->pname());
110  pn.toLower();
111  if (pn == "publish")
112  {
113  isPub = true;
114  }
115  }
116  else if (arg->tag() == DtpList)
117  {
118  DtlObjPtr pub = DtcCar(arg);
119  if (!DtcNull(pub) && pub->tag() == DtpSymbol)
120  {
121  DtString pn(pub->pname());
122  pn.toLower();
123  if (pn == "publish")
124  {
125  isPub = true;
126 
127  DtlObjPtr recType = DtcCadr(arg);
128  if (!DtcNull(recType) && recType->tag() == DtpFix)
129  {
130  disVarRecType = recType->fixnum();
131  }
132  }
133  }
134  }
135  }
136 
137  return isPub;
138  }
139 
142  virtual bool isPublished() const = 0;
143  virtual void setIsPublished(bool isPub) = 0;
145 
149  virtual unsigned disRecordType() const = 0;
150  virtual void setDisRecordType(unsigned recType) = 0;
152 
154  virtual void reset() = 0;
155 };
156 
159 template <typename _RwType>
160 class DtRwProperty : public _RwType, public DtPropertyInterface
161 {
162 private:
164  DtRwProperty();
165 
166 public:
167 
168  DtRwProperty(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
169  DtRwProperty(const DtString& name, const DtRwProperty& orig,
170  DtReaderWriterRegistry* parentRegistry = 0);
171  DtRwProperty& operator=(const DtRwProperty& orig);
172  virtual ~DtRwProperty();
173 
177  virtual char* encode(char*) const;
178 
180  virtual const char* decode(const char*);
181 
182  virtual DtString stringRep(const DtString& root = "") const;
183 
185  virtual void getSize(int& size) const;
186 
187  virtual int hlaAlignment() const;
188 
190  virtual const char* propertyType() const;
191 
192  virtual void getSelf(DtlObjPtr args,
195 
196  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
197  const DtVariableBindingsList& variableBindings);
198 
200  virtual bool merge(const DtPropertyInterface& target, MergeFlags,
201  const DtMergePath& path = DtMergePath(), const std::set<DtString>& ignore = std::set<DtString>());
202 
205  virtual DtReaderWriter* readerWriter();
206  virtual const DtReaderWriter* readerWriter() const;
208 
211  virtual DtPropertyInterface* property();
212  virtual const DtPropertyInterface* property() const;
214 
216  virtual void recordUpdateTime() const;
217 
219  virtual bool wasUpdatedSince(DtTime t) const;
220 
223  virtual bool isPublished() const;
224  virtual void setIsPublished(bool isPub);
226 
230  virtual unsigned disRecordType() const;
231  virtual void setDisRecordType(unsigned recType);
233 
234  virtual void reset();
235 
236 protected:
237 
241  unsigned myDisRecordType;
242 };
243 
248 template <typename _RwType>
250 {
251 private:
254 
255 public:
256 
257  DtRwPropertyWithThreshold(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
259  DtReaderWriterRegistry* parentRegistry = 0);
261  virtual ~DtRwPropertyWithThreshold();
262 
267  virtual char* encode(char*) const;
268 
272  virtual bool wasUpdatedSince(DtTime t) const;
273 
275  virtual void enableThresholding(bool enable);
276 
280  virtual void setThreshold(double percentage);
281 
284  static void setDefaultThreshold(double percentage);
285 
290  virtual void setMaxUpdateInterval(DtTime interval);
291 
294  static void setDefaultMaxUpdateInterval(DtTime interval);
295 
304  virtual void setMaxUnchangedUpdateInterval(DtTime interval);
305 
308  static void setDefaultMaxUnchangedUpdateInterval(DtTime interval);
309 
310 protected:
311 
314 
316  mutable _RwType myLastEncodedValue;
317 
320 
321  static double myDefaultThreshold;
322  double myThreshold;
323 
326 
329 };
330 
332 {
333 public:
334  DtRwPropertyString(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
335  DtRwPropertyString(const DtString& name, const DtRwPropertyString& orig,
336  DtReaderWriterRegistry* parentRegistry = 0);
338  DtReaderWriterRegistry* parentRegistry = 0);
339 
341 
342  virtual ~DtRwPropertyString();
343 };
344 
346 {
347 public:
348  DtRwPropertyBoolean(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
349  DtRwPropertyBoolean(const DtString& name, const DtRwPropertyBoolean& orig,
350  DtReaderWriterRegistry* parentRegistry = 0);
352  DtReaderWriterRegistry* parentRegistry = 0);
354  virtual ~DtRwPropertyBoolean();
355 };
356 
358 {
359 public:
360  DtRwPropertyInt(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
361  DtRwPropertyInt(const DtString& name, const DtRwPropertyInt& orig,
362  DtReaderWriterRegistry* parentRegistry = 0);
363  DtRwPropertyInt(const DtRwPropertyInt& orig,
364  DtReaderWriterRegistry* parentRegistry = 0);
366  virtual ~DtRwPropertyInt();
367 };
368 
370 {
371 public:
372  DtRwPropertyInt8(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
373  DtRwPropertyInt8(const DtString& name, const DtRwPropertyInt8& orig,
374  DtReaderWriterRegistry* parentRegistry = 0);
376  DtReaderWriterRegistry* parentRegistry = 0);
378  virtual ~DtRwPropertyInt8();
379 };
380 
382 {
383 public:
384  DtRwPropertyInt16(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
385  DtRwPropertyInt16(const DtString& name, const DtRwPropertyInt16& orig,
386  DtReaderWriterRegistry* parentRegistry = 0);
388  DtReaderWriterRegistry* parentRegistry = 0);
390  virtual ~DtRwPropertyInt16();
391 };
392 
394 {
395 public:
396  DtRwPropertyInt32(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
397  DtRwPropertyInt32(const DtString& name, const DtRwPropertyInt32& orig,
398  DtReaderWriterRegistry* parentRegistry = 0);
400  DtReaderWriterRegistry* parentRegistry = 0);
402  virtual ~DtRwPropertyInt32();
403 };
404 
406 {
407 public:
408  DtRwPropertyReal(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
409  DtRwPropertyReal(const DtString& name, const DtRwPropertyReal& orig,
410  DtReaderWriterRegistry* parentRegistry = 0);
412  DtReaderWriterRegistry* parentRegistry = 0);
414  virtual ~DtRwPropertyReal();
415 };
416 
418 {
419 public:
420  DtRwPropertyReal32(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
421  DtRwPropertyReal32(const DtString& name, const DtRwPropertyReal32& orig,
422  DtReaderWriterRegistry* parentRegistry = 0);
424  DtReaderWriterRegistry* parentRegistry = 0);
426  virtual ~DtRwPropertyReal32();
427 };
428 
430 {
431 public:
432  DtRwPropertyReal64(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
433  DtRwPropertyReal64(const DtString& name, const DtRwPropertyReal64& orig,
434  DtReaderWriterRegistry* parentRegistry = 0);
436  DtReaderWriterRegistry* parentRegistry = 0);
438  virtual ~DtRwPropertyReal64();
439 };
440 
442 {
443 public:
444  DtRwPropertyVector(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
445  DtRwPropertyVector(const DtString& name, const DtRwPropertyVector& orig,
446  DtReaderWriterRegistry* parentRegistry = 0);
448  DtReaderWriterRegistry* parentRegistry = 0);
450  virtual ~DtRwPropertyVector();
451 };
452 
453 
455 {
456 public:
457  DtRwPropertyOffsetVector(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0);
459  DtReaderWriterRegistry* parentRegistry = 0);
461  DtReaderWriterRegistry* parentRegistry = 0);
463  virtual ~DtRwPropertyOffsetVector();
464 };

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)