VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
makVrv::DtDynamicTerrainChange Class Referenceabstract

Command which can be given to the dynamic terrain system to perform some change. This class is a simple interface to a key/value dictionary.

See DtDynamicTerrainChange::CreateBuilder().

These objects can be backed by anything but are treated as constant objects by the system. The terrain world (DtDynamicTerrainWorld) is generic enough to use the data in any incoming change requests to call the state change functionality on the right feature objects.

The terrain world never actually calls any of the data member functions, only the features themselves. In this way drivers (writers of code that inserts change requests or code that inserts features) only need to agree amongst themselves about what the data mean. This allows the features to respond to a wide varied of data. Simple features like switch nodes and DOF nodes can respond to direct commands (i.e. state=1 or rotation=90) or they can use configuration to respond to higher levels commands (i.e. damage=true or state=open), or (and most importantly for the simulation) they can respond to generic events (i.e. event=explosion,force=50 or event=ditch,width=10).

Inheritance diagram for makVrv::DtDynamicTerrainChange:
Inheritance graph
[legend]

Public Types

enum  TypeEnum {
  UnknownType, StringType, DoubleType, IntType,
  BoolType
}
 

Public Member Functions

DtString print () const
 
virtual ~DtDynamicTerrainChange ()
 
virtual DtDynamicTerrainChange * clone () const
 
virtual const
DtDynamicTerrainGeometry * 
geometry () const =0
 
virtual unsigned int size () const =0
 
virtual DtString key (unsigned int index=0) const =0
 
virtual TypeEnum type (unsigned int index=0) const
 
template<typename T >
boost::optional< T > getValue (const DtString &key) const
 
 Builder ()
 
virtual Builder * setGeometry (DtDynamicTerrainGeometry *geometry)
 
virtual Builder * setGeometry (const DtDynamicTerrainGeometry *geometry)
 
virtual Builder * addAllFrom (const DtDynamicTerrainChange &data)
 
virtual Builder * addAllFrom (const DtDynamicTerrainChange *change)
 
virtual Builder * addKeyValue (const DtString &key, const DtString &value)
 
virtual Builder * addKeyValue (const DtString &key, double value)
 
virtual Builder * addKeyValue (const DtString &key, int value)
 
virtual Builder * addKeyValue (const DtString &key, bool value)
 
virtual const
DtDynamicTerrainGeometry * 
geometry () const override
 
virtual unsigned int size () const override
 
virtual DtString key (unsigned int index) const override
 
virtual TypeEnum type (unsigned int index) const override
 
virtual boost::optional< DtString > stringValue (const DtString &key) const override
 
virtual boost::optional< double > doubleValue (const DtString &key) const override
 
virtual boost::optional< int > intValue (const DtString &key) const override
 
virtual boost::optional< bool > boolValue (const DtString &key) const override
 
template<>
boost::optional< DtString > getValue (const DtString &key) const
 
template<>
boost::optional< double > getValue (const DtString &key) const
 
template<>
boost::optional< int > getValue (const DtString &key) const
 
template<>
boost::optional< bool > getValue (const DtString &key) const
 
virtual boost::optional< DtString > stringValue (const DtString &key) const =0
 
virtual boost::optional< double > doubleValue (const DtString &key) const =0
 
virtual boost::optional< int > intValue (const DtString &key) const =0
 
virtual boost::optional< bool > boolValue (const DtString &key) const =0
 
DtString stringValue (const DtString &key, const DtString &def) const
 
double doubleValue (const DtString &key, double def) const
 
int intValue (const DtString &key, int def) const
 
bool boolValue (const DtString &key, bool def) const
 

Static Public Member Functions

static DtString ToString (TypeEnum t)
 
static TypeEnum ToEnum (const DtString &str)
 
static Builder * CreateBuilder ()
 
static DtDynamicTerrainChange * Merge (const DtDynamicTerrainChange &data1, const DtDynamicTerrainChange &data2)
 
static DtDynamicTerrainChange * Create (DtDynamicTerrainGeometry *geometry, const DtString &key, const DtString &value)
 
static DtDynamicTerrainChange * Create (DtDynamicTerrainGeometry *geometry, const DtString &key, double value)
 
static DtDynamicTerrainChange * Create (DtDynamicTerrainGeometry *geometry, const DtString &key, int value)
 
static DtDynamicTerrainChange * Create (DtDynamicTerrainGeometry *geometry, const DtString &ket, bool value)
 

Protected Types

typedef boost::variant
< DtString, double, int, bool > 
Variant
 
typedef std::map< DtString,
Variant > 
AttributeMap
 

Protected Member Functions

template<typename T >
boost::optional< T > getTValue (const DtString &key) const
 
void addValuesFrom (const DtDynamicTerrainChange &command)
 

Protected Attributes

AttributeMap myAttributes
 
std::unique_ptr
< DtDynamicTerrainGeometry > 
myGeometry
 

Member Typedef Documentation

typedef boost::variant<DtString, double, int, bool> makVrv::DtDynamicTerrainChange::Variant
protected

Member Enumeration Documentation

Enumeration representing the type of an attribute. UnknownType is a catchall for values that have some unique backing or don't exist.

Enumerator
UnknownType 
StringType 
DoubleType 
IntType 
BoolType 

Constructor & Destructor Documentation

virtual makVrv::DtDynamicTerrainChange::~DtDynamicTerrainChange ( )
virtual

Virtual destructor.

Member Function Documentation

static DtString makVrv::DtDynamicTerrainChange::ToString ( TypeEnum  t)
static

Get printable value of type enum.

static TypeEnum makVrv::DtDynamicTerrainChange::ToEnum ( const DtString &  str)
static

Get type enum from readable string value.

DtString makVrv::DtDynamicTerrainChange::print ( ) const

Print for debugging.

static DtDynamicTerrainChange* makVrv::DtDynamicTerrainChange::Create ( DtDynamicTerrainGeometry *  geometry,
const DtString &  key,
const DtString &  value 
)
static

Factory functions. These all create a dictionary with a single key/value Ownership returned to caller.

static DtDynamicTerrainChange* makVrv::DtDynamicTerrainChange::Create ( DtDynamicTerrainGeometry *  geometry,
const DtString &  key,
double  value 
)
static

Factory functions. These all create a dictionary with a single key/value Ownership returned to caller.

static DtDynamicTerrainChange* makVrv::DtDynamicTerrainChange::Create ( DtDynamicTerrainGeometry *  geometry,
const DtString &  key,
int  value 
)
static

Factory functions. These all create a dictionary with a single key/value Ownership returned to caller.

static DtDynamicTerrainChange* makVrv::DtDynamicTerrainChange::Create ( DtDynamicTerrainGeometry *  geometry,
const DtString &  ket,
bool  value 
)
static

Factory functions. These all create a dictionary with a single key/value Ownership returned to caller.

static Builder* makVrv::DtDynamicTerrainChange::CreateBuilder ( )
static

Builder object for constructing data. DtDynamicTerrainChange *p = CreateBuilder() ->addKeyValue("key1", value1)->addKeyValue("key2", value2);.

static DtDynamicTerrainChange* makVrv::DtDynamicTerrainChange::Merge ( const DtDynamicTerrainChange &  data1,
const DtDynamicTerrainChange &  data2 
)
static

Merge the attributes from each dictionary into a single dictionary. Repeated attributes will be overwritten by the second.

virtual DtDynamicTerrainChange* makVrv::DtDynamicTerrainChange::clone ( ) const
virtual

Create a clone of this object. Ownership returned to caller. Default implementation will create an object backed by a map. UnknownType values will not be included.

virtual const DtDynamicTerrainGeometry* makVrv::DtDynamicTerrainChange::geometry ( ) const
pure virtual
virtual unsigned int makVrv::DtDynamicTerrainChange::size ( ) const
pure virtual

Return the number of attributes (key/value pairs) in this dictionary.

virtual DtString makVrv::DtDynamicTerrainChange::key ( unsigned int  index = 0) const
pure virtual

Get the key of the nth key/value pair. Calling this function with an index greater than or equal to the value returned by size() should return an empty string.

Parameters
indexIndex of the key/value pair to return.
Return values
Valueof the key of the key/value pair.
virtual TypeEnum makVrv::DtDynamicTerrainChange::type ( unsigned int  index = 0) const
virtual

Return the type of the nth attribute attribute. Calling this function with an index greater than or equal to the value returned by attributeCount() should return UnknownType.

Parameters
indexIndex of the key/value pair type to return.
Return values
Typeof the value of the key/value pair.
virtual boost::optional<DtString> makVrv::DtDynamicTerrainChange::stringValue ( const DtString &  key) const
pure virtual

Get the value of the attribute the a specific key.

virtual boost::optional<double> makVrv::DtDynamicTerrainChange::doubleValue ( const DtString &  key) const
pure virtual

Get the value of the attribute the a specific key.

virtual boost::optional<int> makVrv::DtDynamicTerrainChange::intValue ( const DtString &  key) const
pure virtual

Get the value of the attribute the a specific key.

virtual boost::optional<bool> makVrv::DtDynamicTerrainChange::boolValue ( const DtString &  key) const
pure virtual

Get the value of the attribute the a specific key.

DtString makVrv::DtDynamicTerrainChange::stringValue ( const DtString &  key,
const DtString &  def 
) const

Get the value of the attribute at a specific index. fixme - implement.

Convenience functions which substitute a default a value doesn't exist. Not virtual b/c these just call directly into the virtual versions and the implementations of the two sets of functions are must be consistent. Implement one of the above functions to change the functionality.

double makVrv::DtDynamicTerrainChange::doubleValue ( const DtString &  key,
double  def 
) const

Get the value of the attribute at a specific index. fixme - implement.

Convenience functions which substitute a default a value doesn't exist. Not virtual b/c these just call directly into the virtual versions and the implementations of the two sets of functions are must be consistent. Implement one of the above functions to change the functionality.

int makVrv::DtDynamicTerrainChange::intValue ( const DtString &  key,
int  def 
) const

Get the value of the attribute at a specific index. fixme - implement.

Convenience functions which substitute a default a value doesn't exist. Not virtual b/c these just call directly into the virtual versions and the implementations of the two sets of functions are must be consistent. Implement one of the above functions to change the functionality.

bool makVrv::DtDynamicTerrainChange::boolValue ( const DtString &  key,
bool  def 
) const

Get the value of the attribute at a specific index. fixme - implement.

Convenience functions which substitute a default a value doesn't exist. Not virtual b/c these just call directly into the virtual versions and the implementations of the two sets of functions are must be consistent. Implement one of the above functions to change the functionality.

template<typename T >
boost::optional<T> makVrv::DtDynamicTerrainChange::getValue ( const DtString &  key) const

Accessor function which will call the correct virtual function for the template parameter.

makVrv::DtDynamicTerrainChange::Builder ( )
virtual Builder* makVrv::DtDynamicTerrainChange::setGeometry ( DtDynamicTerrainGeometry *  geometry)
virtual
virtual Builder* makVrv::DtDynamicTerrainChange::setGeometry ( const DtDynamicTerrainGeometry *  geometry)
virtual
virtual Builder* makVrv::DtDynamicTerrainChange::addAllFrom ( const DtDynamicTerrainChange &  data)
virtual
virtual Builder* makVrv::DtDynamicTerrainChange::addAllFrom ( const DtDynamicTerrainChange *  change)
virtual
virtual Builder* makVrv::DtDynamicTerrainChange::addKeyValue ( const DtString &  key,
const DtString &  value 
)
virtual
virtual Builder* makVrv::DtDynamicTerrainChange::addKeyValue ( const DtString &  key,
double  value 
)
virtual
virtual Builder* makVrv::DtDynamicTerrainChange::addKeyValue ( const DtString &  key,
int  value 
)
virtual
virtual Builder* makVrv::DtDynamicTerrainChange::addKeyValue ( const DtString &  key,
bool  value 
)
virtual
virtual const DtDynamicTerrainGeometry* makVrv::DtDynamicTerrainChange::geometry ( ) const
overridevirtual
virtual unsigned int makVrv::DtDynamicTerrainChange::size ( ) const
overridevirtual
virtual DtString makVrv::DtDynamicTerrainChange::key ( unsigned int  index) const
overridevirtual
virtual TypeEnum makVrv::DtDynamicTerrainChange::type ( unsigned int  index) const
overridevirtual
virtual boost::optional<DtString> makVrv::DtDynamicTerrainChange::stringValue ( const DtString &  key) const
overridevirtual
virtual boost::optional<double> makVrv::DtDynamicTerrainChange::doubleValue ( const DtString &  key) const
overridevirtual
virtual boost::optional<int> makVrv::DtDynamicTerrainChange::intValue ( const DtString &  key) const
overridevirtual
virtual boost::optional<bool> makVrv::DtDynamicTerrainChange::boolValue ( const DtString &  key) const
overridevirtual
template<typename T >
boost::optional<T> makVrv::DtDynamicTerrainChange::getTValue ( const DtString &  key) const
protected
void makVrv::DtDynamicTerrainChange::addValuesFrom ( const DtDynamicTerrainChange &  command)
protected
template<>
boost::optional<DtString> makVrv::DtDynamicTerrainChange::getValue ( const DtString &  key) const
inline
template<>
boost::optional<double> makVrv::DtDynamicTerrainChange::getValue ( const DtString &  key) const
inline
template<>
boost::optional<int> makVrv::DtDynamicTerrainChange::getValue ( const DtString &  key) const
inline
template<>
boost::optional<bool> makVrv::DtDynamicTerrainChange::getValue ( const DtString &  key) const
inline

Member Data Documentation

AttributeMap makVrv::DtDynamicTerrainChange::myAttributes
protected
std::unique_ptr<DtDynamicTerrainGeometry> makVrv::DtDynamicTerrainChange::myGeometry
protected

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

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)