VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtRwPropertyWithThreshold< _RwType > Class Template Reference

This class is similar to DtRwProperty, but allows you to specify a threshold at which the value should be considered different enough to require an update. More...

Inheritance diagram for DtRwPropertyWithThreshold< _RwType >:
Inheritance graph
[legend]

Public Member Functions

 DtRwPropertyWithThreshold (const DtString &name, DtReaderWriterRegistry *parentRegistry=0)
 DtRwPropertyWithThreshold (const DtString &name, const DtRwPropertyWithThreshold &orig, DtReaderWriterRegistry *parentRegistry=0)
DtRwPropertyWithThresholdoperator= (const DtRwPropertyWithThreshold &orig)
virtual ~DtRwPropertyWithThreshold ()
virtual charencode (char *) const
 These methods are for network encoding/decoding for Hla encoding decoding reasons.
virtual bool wasUpdatedSince (DtTime t) const
 Returns true if an update occurred since the specified time and the current value is at least _Threshold percent away from the previous encoded value.
virtual void enableThresholding (bool enable)
 Enables or disables thresholding of this property. Enabled by default.
virtual void setThreshold (double percentage)
 Changes the threshold for when an update should be sent.
virtual void setMaxUpdateInterval (DtTime interval)
 Changes the maximum time between updates if data has changed but has not crossed the threshold for an update.
virtual void setMaxUnchangedUpdateInterval (DtTime interval)
 Changes the maximum time between updates if data has changed but has not crossed the threshold for an update, but seems to have settled on a new value.
- Public Member Functions inherited from DtRwProperty< _RwType >
 DtRwProperty (const DtString &name, DtReaderWriterRegistry *parentRegistry=0)
 DtRwProperty (const DtString &name, const DtRwProperty &orig, DtReaderWriterRegistry *parentRegistry=0)
DtRwPropertyoperator= (const DtRwProperty &orig)
virtual ~DtRwProperty ()
virtual const chardecode (const char *)
 Decodes the variable bindings from the specified buffer.
virtual DtString stringRep (const DtString &root="") const
virtual void getSize (int &size) const
 Returns the size of this item, iterating over all types.
virtual int hlaAlignment () const
 Returns hlaAlignment.
virtual const charpropertyType () const
 Typically returns reader/writer type.
virtual DtlObjPtr getData (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings)
 Override to allow a variable to be assigned to a property of derived type.
virtual bool merge (const DtPropertyInterface &target, MergeFlags, const DtMergePath &path=DtMergePath(), const std::set< DtString > &ignore=std::set< DtString >())
 In this case replace does not matter – will replace value regardless.
virtual void recordUpdateTime () const
 Stamps the time when updated.
virtual void reset ()
 Override to clear out variable value.
virtual DtReaderWriterreaderWriter ()
virtual const DtReaderWriterreaderWriter () const
virtual DtPropertyInterfaceproperty ()
virtual const DtPropertyInterfaceproperty () const
- Public Member Functions inherited from DtPropertyInterface
virtual ~DtPropertyInterface ()
int getSize () const
virtual bool isSimilarProperty (const DtPropertyInterface *rhs) const
 Returns true if the readerWriterType is the same.

Static Public Member Functions

static void setDefaultThreshold (double percentage)
 Changes the default threshold for cases when setThreshold() has not been called.
static void setDefaultMaxUpdateInterval (DtTime interval)
 Changes the default max update interval for cases when setMaxUpdateInterval() has not been called.
static void setDefaultMaxUnchangedUpdateInterval (DtTime interval)
 Changes the default max unchanged update interval for cases when setMaxUnchangedUpdateInterval() has not been called.

Protected Attributes

bool myThresholdingEnabled
 Whether thresholding is currently enabled.
_RwType myLastEncodedValue
 The value at the last time the value was encoded.
DtTime myLastEncodeTime
 The time the value was last encoded.
double myThreshold
DtTime myMaxUpdateInterval
DtTime myMaxUnchangedUpdateInterval
- Protected Attributes inherited from DtRwProperty< _RwType >
DtClock myClock
DtTime myUpdateTime

Static Protected Attributes

static double myDefaultThreshold
static DtTime myDefaultMaxUpdateInterval
static DtTime myDefaultMaxUnchangedUpdateInterval

Private Member Functions

 DtRwPropertyWithThreshold ()
 Not implemented.

Additional Inherited Members

- Public Types inherited from DtPropertyInterface
enum  MergeFlags { Replace = 0x00000001, MinimalSimilarityCheck = 0x00000002, RollUp = 0x00000004, AddMissing = 0x00000008 }

Detailed Description

template<typename _RwType>
class DtRwPropertyWithThreshold< _RwType >

This class is similar to DtRwProperty, but allows you to specify a threshold at which the value should be considered different enough to require an update.

wasUpdatedSince() will return false until the threshold is met. The threshold is defined as a percentage of the current value.

Constructor & Destructor Documentation

template<typename _RwType>
DtRwPropertyWithThreshold< _RwType >::DtRwPropertyWithThreshold ( )
private

Not implemented.

template<typename _RwType>
DtRwPropertyWithThreshold< _RwType >::DtRwPropertyWithThreshold ( const DtString name,
DtReaderWriterRegistry parentRegistry = 0 
)
template<typename _RwType>
DtRwPropertyWithThreshold< _RwType >::DtRwPropertyWithThreshold ( const DtString name,
const DtRwPropertyWithThreshold< _RwType > &  orig,
DtReaderWriterRegistry parentRegistry = 0 
)
template<typename _RwType>
virtual DtRwPropertyWithThreshold< _RwType >::~DtRwPropertyWithThreshold ( )
virtual

Member Function Documentation

template<typename _RwType>
DtRwPropertyWithThreshold& DtRwPropertyWithThreshold< _RwType >::operator= ( const DtRwPropertyWithThreshold< _RwType > &  orig)
template<typename _RwType>
virtual char* DtRwPropertyWithThreshold< _RwType >::encode ( char ) const
virtual

These methods are for network encoding/decoding for Hla encoding decoding reasons.

Implemented at templated rw level. Encodes the variable bindings into the supplied buffer. In addition, stores the value in myLastEncodedValue for threshold testing.

Reimplemented from DtRwProperty< _RwType >.

template<typename _RwType>
virtual bool DtRwPropertyWithThreshold< _RwType >::wasUpdatedSince ( DtTime  t) const
virtual

Returns true if an update occurred since the specified time and the current value is at least _Threshold percent away from the previous encoded value.

Reimplemented from DtRwProperty< _RwType >.

template<typename _RwType>
virtual void DtRwPropertyWithThreshold< _RwType >::enableThresholding ( bool  enable)
virtual

Enables or disables thresholding of this property. Enabled by default.

template<typename _RwType>
virtual void DtRwPropertyWithThreshold< _RwType >::setThreshold ( double  percentage)
virtual

Changes the threshold for when an update should be sent.

If the percentage change of the value is greater than this threshold, wasUpdatedSince() will return true.

template<typename _RwType>
static void DtRwPropertyWithThreshold< _RwType >::setDefaultThreshold ( double  percentage)
static

Changes the default threshold for cases when setThreshold() has not been called.

template<typename _RwType>
virtual void DtRwPropertyWithThreshold< _RwType >::setMaxUpdateInterval ( DtTime  interval)
virtual

Changes the maximum time between updates if data has changed but has not crossed the threshold for an update.

This ensures that periodically subscribers receive current data, even if the value has only changed a small amount.

template<typename _RwType>
static void DtRwPropertyWithThreshold< _RwType >::setDefaultMaxUpdateInterval ( DtTime  interval)
static

Changes the default max update interval for cases when setMaxUpdateInterval() has not been called.

template<typename _RwType>
virtual void DtRwPropertyWithThreshold< _RwType >::setMaxUnchangedUpdateInterval ( DtTime  interval)
virtual

Changes the maximum time between updates if data has changed but has not crossed the threshold for an update, but seems to have settled on a new value.

For instance, if the threshold his 2%, and a value goes from 99 to 100 where it caps out, it will never hit the 2% mark, and therefore an update would otherwise not be sent for a full minute. This setting indicates how long a value should stabilize, remaining unchanged, before we send it. Should be greater than the tick rate but less than the max update interval.

template<typename _RwType>
static void DtRwPropertyWithThreshold< _RwType >::setDefaultMaxUnchangedUpdateInterval ( DtTime  interval)
static

Changes the default max unchanged update interval for cases when setMaxUnchangedUpdateInterval() has not been called.

Member Data Documentation

template<typename _RwType>
bool DtRwPropertyWithThreshold< _RwType >::myThresholdingEnabled
protected

Whether thresholding is currently enabled.

template<typename _RwType>
_RwType DtRwPropertyWithThreshold< _RwType >::myLastEncodedValue
mutableprotected

The value at the last time the value was encoded.

template<typename _RwType>
DtTime DtRwPropertyWithThreshold< _RwType >::myLastEncodeTime
mutableprotected

The time the value was last encoded.

template<typename _RwType>
double DtRwPropertyWithThreshold< _RwType >::myDefaultThreshold
staticprotected
template<typename _RwType>
double DtRwPropertyWithThreshold< _RwType >::myThreshold
protected
template<typename _RwType>
DtTime DtRwPropertyWithThreshold< _RwType >::myDefaultMaxUpdateInterval
staticprotected
template<typename _RwType>
DtTime DtRwPropertyWithThreshold< _RwType >::myMaxUpdateInterval
protected
template<typename _RwType>
DtTime DtRwPropertyWithThreshold< _RwType >::myDefaultMaxUnchangedUpdateInterval
staticprotected
template<typename _RwType>
DtTime DtRwPropertyWithThreshold< _RwType >::myMaxUnchangedUpdateInterval
protected

The documentation for this class was generated from the following file:

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)