VR-Forces 4.10 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) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
14 #include <readerWriter/rwString.h>
15 #include <readerWriter/rwVector.h>
16 #include <vlutil/vlTime.h>
17 
18 #include <string>
19 #include <boost/optional.hpp>
20 
21 // Must be incremented whenever the encoding for properties changes.
22 const int DtPropertyVersion = 0;
23 
49 {
50 public:
51 
54  {
55  Replace = 0x00000001, // Replace contents wholesale
56  MinimalSimilarityCheck = 0x00000002, // Do not do a stringent compare on items -- allows for partial item replacement
57  RollUp = 0x00000004, // This will add up numerical items and keep string items if the values are similar, else it will remove.
58  // Any item that exists in the to be merged that does not exist in the source will be added as long as
59  // the structures are similar, else they will be ignored
60  AddMissing = 0x00000008,// Any items missing will be added to the target
61  KeepIsPublished = 0x00000010 // Keeps the current setting for whether the property is published
62  };
63 
64  virtual ~DtPropertyInterface();
65 
80  template <typename ValueType>
81  boost::optional<ValueType> propertyValue() const;
82 
89  template <typename ValueType>
90  bool setPropertyValue(ValueType val);
92 
115  virtual const DtPropertyInterface* findPropertyInterface(const DtString& propertyName) const
116  {
117  return 0;
118  }
119 
120  virtual DtPropertyInterface* findPropertyInterface(const DtString& propertyName)
121  {
122  return 0;
123  }
125 
147  template <typename SpecificPropType>
148  const SpecificPropType* findProperty(const DtString& propertyName) const;
149  template <typename SpecificPropType>
150  SpecificPropType* findProperty(const DtString& propertyName);
152 
176  template <typename ValueType>
177  boost::optional<ValueType> findPropertyValue(const DtString& propertyName) const;
178 
195  template <typename ValueType>
196  bool findAndSetPropertyValue(const DtString& propertyName, ValueType val);
198 
211  virtual bool addProperty(DtPropertyInterface* property)
212  {
213  return false;
214  }
215 
222  template <typename SpecificPropType>
223  SpecificPropType* addNewProperty(const DtString& propertyName);
225 
232  virtual bool removeProperty(const DtString& propertyName)
233  {
234  return false;
235  }
236 
237  virtual bool removeProperty(const DtPropertyInterface* property)
238  {
239  return false;
240  }
242 
245  virtual void copy(const DtPropertyInterface& rhs) = 0;
246 
250  virtual char* encode(char*) const = 0;
251 
253  virtual const char* decode(const char*) = 0;
254 
256  virtual void getSize(int& size) const = 0;
257 
259  virtual int hlaAlignment() const = 0;
261 
263  virtual const char* propertyType() const = 0;
264 
266  virtual DtSymbolString propertyName() const = 0;
267 
269  virtual void setPropertyName(const DtString& propertyName) = 0;
270 
271  virtual DtString stringRep(const DtString& root = "") const = 0;
272 
273  int getSize() const;
274 
278  virtual DtReaderWriter* readerWriter() = 0;
279  virtual const DtReaderWriter* readerWriter() const = 0;
281 
286  virtual bool isSimilarProperty(const DtPropertyInterface* rhs, bool strict = true) const;
287 
297  //
299  virtual bool merge(const DtPropertyInterface& target, MergeFlags,
300  const DtMergePath& path = DtMergePath(), const std::set<DtString>& ignore = std::set<DtString>()) = 0;
301 
303  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
304  const DtVariableBindingsList& variableBindings) = 0;
305 
308  virtual bool isPublishedArg(DtlObjPtr arg, unsigned& disVarRecType) const;
309 
312  virtual bool isPublished() const = 0;
313  virtual void setIsPublished(bool isPub) = 0;
315 
319  virtual unsigned disRecordType() const = 0;
320  virtual void setDisRecordType(unsigned recType) = 0;
322 
324  virtual void reset() = 0;
325 
328  virtual bool isDebugEnabled() const = 0;
329  virtual void setDebugEnabled(bool en) = 0;
331 };
332 
333 #define propertyInterface_INL_
334 #include "propertyInterface.inl"
335 #undef propertyInterface_INL_
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
#define DT_DLL_readerWriter
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: readerWriterDefines.h:34
Definition: symbolString.h:20
const int DtPropertyVersion
Definition: propertyInterface.h:22
voidpf void uLong size
Definition: ioapi.h:39
Definition: readerWriter.h:85
boost::optional< T > findPropertyValue(const DtReaderWriter &properties, const DtString &propertyName)
Finds the ReaderWriter object in the given set of properties with the specified name and returns its ...
virtual bool removeProperty(const DtString &propertyName)
Definition: propertyInterface.h:232
Interface class used to define minimal interface for a property.
Definition: propertyInterface.h:48
const SpecificRwType * findProperty(const DtReaderWriter &properties, const DtString &propertyName)
Finds the ReaderWriter object in the given set of properties with the specified name.
virtual bool addProperty(DtPropertyInterface *property)
Definition: propertyInterface.h:211
virtual DtPropertyInterface * findPropertyInterface(const DtString &propertyName)
Definition: propertyInterface.h:120
std::list< const DtRwVariableBindings * > DtVariableBindingsList
Definition: readerWriterRegistry.h:29
std::vector< DtFilename > SearchPaths
Definition: readerWriter.h:92
virtual bool removeProperty(const DtPropertyInterface *property)
Definition: propertyInterface.h:237
std::vector< DtMergePathStruct > DtMergePath
Definition: readerWriterFactory.h:181
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer.
virtual const DtPropertyInterface * findPropertyInterface(const DtString &propertyName) const
Definition: propertyInterface.h:115
void setPropertyValue(DtReaderWriter *prop, T val)
Sets the value of the given ReaderWriter property.
DT_DLL_readerWriter const char * decode(DtString &val, const char *buffer)
Decodes a value from buffer and places the result in val of the type specified by val...
bool findAndSetPropertyValue(DtReaderWriter &properties, const DtString &propertyName, T val)
Finds the ReaderWriter object in the given set of properties with the specified name and sets its val...
File: rwVector.h.
MergeFlags
Determines how two lists of properties will be merged by the merge function.
Definition: propertyInterface.h:53

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)