VR-Forces Developer's Guide
 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) 2025 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 = 1;
23 
54 {
55 public:
56 
59  {
60  Replace = 0x00000001, // Replace contents wholesale
61  MinimalSimilarityCheck = 0x00000002, // Do not do a stringent compare on items -- allows for partial item replacement
62  RollUp = 0x00000004, // This will add up numerical items and keep string items if the values are similar, else it will remove.
63  // Any item that exists in the to be merged that does not exist in the source will be added as long as
64  // the structures are similar, else they will be ignored
65  AddMissing = 0x00000008,// Any items missing will be added to the target
66  KeepPublishedSettings = 0x00000010 // Keeps the current setting for whether the property is published
67  };
68 
69  virtual ~DtPropertyInterface();
70 
73 
88  template <typename ValueType>
89  boost::optional<ValueType> propertyValue() const;
90 
97  template <typename ValueType>
98  bool setPropertyValue(ValueType val);
100 
123 
124  virtual const DtPropertyInterface* findPropertyInterface(const DtString& propertyName) const
125  {
126  return 0;
127  }
128 
129  virtual DtPropertyInterface* findPropertyInterface(const DtString& propertyName)
130  {
131  return 0;
132  }
134 
156 
157  template <typename SpecificPropType>
158  const SpecificPropType* findProperty(const DtString& propertyName) const;
159  template <typename SpecificPropType>
160  SpecificPropType* findProperty(const DtString& propertyName);
162 
165 
187  template <typename ValueType>
188  boost::optional<ValueType> findPropertyValue(const DtString& propertyName) const;
189 
206  template <typename ValueType>
207  bool findAndSetPropertyValue(const DtString& propertyName, ValueType val);
209 
216 
223  virtual bool addProperty(DtPropertyInterface* property)
224  {
225  return false;
226  }
227 
234  template <typename SpecificPropType>
235  SpecificPropType* addNewProperty(const DtString& propertyName);
237 
244 
245  virtual bool removeProperty(const DtString& propertyName)
246  {
247  return false;
248  }
249 
250  virtual bool removeProperty(const DtPropertyInterface* property)
251  {
252  return false;
253  }
255 
258  virtual void copy(const DtPropertyInterface& rhs) = 0;
259 
262 
265  virtual char* encode(char*) const = 0;
266 
269  virtual const char* decode(const char*) = 0;
270 
273  virtual void getSize(int& size) const = 0;
274 
277  int getSize() const;
278 
280  virtual int hlaAlignment() const = 0;
282 
284  virtual const char* propertyType() const = 0;
285 
287  virtual DtSymbolString propertyName() const = 0;
288 
290  virtual void setPropertyName(const DtString& propertyName) = 0;
291 
292  virtual DtString stringRep(const DtString& root = "") const = 0;
293 
294 
296 
299  virtual DtReaderWriter* readerWriter() = 0;
300  virtual const DtReaderWriter* readerWriter() const = 0;
302 
307  virtual bool isSimilarProperty(const DtPropertyInterface* rhs, bool strict = true) const;
308 
318  //
320  virtual bool merge(const DtPropertyInterface& target, MergeFlags,
321  const DtMergePath& path = DtMergePath(), const std::set<DtString>& ignore = std::set<DtString>()) = 0;
322 
324  virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths& searchPaths,
325  const DtVariableBindingsList& variableBindings) = 0;
326 
328  virtual void writePublishInformation(std::string& fp, int indentLevel);
329 
332  virtual bool isPublishedArg(DtlObjPtr arg, unsigned& disVarRecType);
333 
335  virtual void copyPublishingSettings(const DtPropertyInterface& prop);
336 
339  virtual void setKeepPublishingSettings(bool keep) = 0;
340  virtual bool keepPublishingSettings() const = 0;
341 
344  virtual bool isUpdateNeeded(DtTime t) const = 0;
345 
347  virtual bool hasReceivedUpdateSince(DtTime t) const = 0;
348 
352  virtual DtTime updateClockTime() const = 0;
353 
356  virtual bool isPublished() const = 0;
357  virtual void setIsPublished(bool isPub) = 0;
359 
363  virtual unsigned disRecordType() const = 0;
364  virtual void setDisRecordType(unsigned recType) = 0;
366 
368  virtual void reset() = 0;
369 
372  virtual bool isDebugEnabled() const = 0;
373  virtual void setDebugEnabled(bool en) = 0;
375 
377  virtual void processPublicationArgs(DtlObjPtr arg);
378  virtual void processPublicationArg(DtlObjPtr arg);
379 };
380 
381 #define propertyInterface_INL_
382 #include "propertyInterface.inl"
383 #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
This class allows one to collect and compare strings using an index number instead of having to do st...
Definition: symbolString.h:27
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:245
Interface class used to define minimal interface for a property. The DtPropertyInterface class provid...
Definition: propertyInterface.h:53
const SpecificRwType * findProperty(const DtReaderWriter &properties, const DtString &propertyName)
Finds the ReaderWriter object in the given set of properties with the specified name. Then verifies that the ReaderWriter matches the type specified as the template argument. Returns a valid pointer if successful.
virtual bool addProperty(DtPropertyInterface *property)
Adds an existing property to the properties container. The container will take ownership of the given...
Definition: propertyInterface.h:223
virtual DtPropertyInterface * findPropertyInterface(const DtString &propertyName)
Definition: propertyInterface.h:129
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:250
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. buffer must have at least the number of bytes returned...
virtual const DtPropertyInterface * findPropertyInterface(const DtString &propertyName) const
Definition: propertyInterface.h:124
void setPropertyValue(DtReaderWriter *prop, T val)
Sets the value of the given ReaderWriter property. The template parameter type must be an appropriate...
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:58

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)