VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
makVrv::DtDynamicTerrainFeature Class Reference

Interface which abstracts the concept of a individually identifiable "thing" in the terrain. More...

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

Classes

class  RequestHandle
 Resource handle for a change request which has been added to the system. More...

Public Member Functions

 DtDynamicTerrainFeature ()
 Default Constructor.
virtual ~DtDynamicTerrainFeature ()
 Virtual destructor.
virtual bool matches (const DtDynamicTerrainChange &, bool useOriginalGeometry=false) const =0
 Matching functions.
virtual bool matches (const DtDynamicTerrainGeometry &, bool useOriginalGeometry=false) const =0
virtual const
DtDynamicTerrainGeometry
geometry () const =0
 Geometry which represents this feature.
virtual const
DtDynamicTerrainGeometry
originalGeometry () const
 Unprocessed geometry.
virtual boost::optional< DtStringfeatureAttribute (const DtString &key) const
 Access attribute values encoded into features.
virtual bool isInDefaultState () const =0
 Is this feature in it's default (i.e. unchanged) state?
virtual bool lastStateWasDefaultState () const =0
 Was the previous state the feature was in immediately before the current state the default state?
virtual void changeState (const DtDynamicTerrainChanges &history)=0
 Called by the dynamic terrain system in order to notify a feature that it should change its state.
virtual void iterateCommands (const boost::function< void(const DtDynamicTerrainChange &)> &) const
 Call the supplied callback on commands which represent the commands a feature can respond to.
void changed ()
 Calls changeState and all attached query callbacks.
bool pageOut ()
 Remove all change requests links and remove feature from dynamic terrain world.
void changes (const boost::function< void(const DtDynamicTerrainChanges &)> &callback) const
 Calls supplied callback on this features DtDynamicTerrainChanges interface.
RequestHandle addChangeRequest (DtDynamicTerrainChange *change)
 Add a change request directly to this feature.
RequestHandle addChangeRequest (double time, DtDynamicTerrainChange *change)
virtual ~Link ()
RequestInforequest ()
DtDynamicTerrainFeaturefeature ()
 RequestInfo (DtDynamicTerrainChange *command)
virtual ~RequestInfo ()
const DtDynamicTerrainChangecommand () const
void pageOut ()
virtual DtString description () const =0
 Feature description functions Allows feature to describe itself (for a gui mostly).
virtual const
DtDynamicTerrainFeature
parentFeature () const
- Public Member Functions inherited from makVrv::DtDisconnectable
 DtDisconnectable ()
 Default constructor.
virtual ~DtDisconnectable ()
 Destructor.
virtual boost::signals2::connection addDisconnectFunction (const boost::function< void()> &callback)
 Add a function to be called when callDisconnectFunctions is called.
virtual bool callDisconnectFunctions ()
 Atomically call all the disconnect functions and mark this object as disconnected.

Static Public Member Functions

static unsigned long long GetObjectCount ()
static unsigned long long GetObjectCount ()
static bool Create (const boost::shared_ptr< DtDynamicTerrainFeature > &featureInfo, const boost::shared_ptr< RequestInfo > &reqInfo)
static unsigned long long GetObjectCount ()

Protected Member Functions

void indexDoubleAscending (const DtString &key)
 Key/value attribute indexing.
void indexDoubleDescending (const DtString &key)
void indexIntAscending (const DtString &key)
void indexIntDescending (const DtString &key)
void indexStringAscending (const DtString &key)
void indexStringDescending (const DtString &key)
void setupIndex (const DtString &key, DtDynamicTerrainIndex *index)

Private Types

typedef
boost::signals2::signal< void(const
DtDynamicTerrainFeature &)> 
Signal
typedef
boost::signals2::signal< void(const
DtDynamicTerrainFeature
&, const
DtDynamicTerrainChanges &) > 
ChangeSignal
typedef std::map< RequestInfo
*, boost::shared_ptr< Link > > 
LinkInfoMap
typedef tbb::spin_rw_mutex Mutex
typedef std::map< DtString,
DtDynamicTerrainIndex * > 
IndexMap
typedef std::list
< boost::shared_ptr< Link > > 
LinkList
typedef tbb::spin_mutex Mutex

Private Member Functions

bool makeLinkToRequest (const boost::shared_ptr< Link > &link)
void breakLinkToRequest (LinkInfoMap::iterator)
 Link (const boost::shared_ptr< DtDynamicTerrainFeature > &featureInfo, const boost::shared_ptr< RequestInfo > &reqInfo)
void makeLinkToFeature (const boost::shared_ptr< Link > &link)
void breakLinkToFeature (LinkList::iterator i)

Private Attributes

ChangeSignal myChangeSignal
Signal myPageOutSignal
Mutex myMutex
LinkInfoMap myLinkMap
IndexMap myIndices
const boost::shared_ptr
< RequestInfo
myRequestInfo
const boost::shared_ptr
< DtDynamicTerrainFeature
myFeatureInfo
boost::scoped_ptr
< DtDynamicTerrainChange
myCommand
LinkList myLinksToFeatures

Friends

class Link
typedef boost::function< void(const
DtDynamicTerrainFeature &)> 
Callback
 Signal notification.
typedef boost::function< void(const
DtDynamicTerrainFeature
&, const
DtDynamicTerrainChanges &)> 
ChangeCallback
virtual boost::signals2::connection connectToChangeSignal (const ChangeCallback &callback) const
 Call callback when feature state is changed.
virtual boost::signals2::connection connectToPageOutSignal (const Callback &callback) const
 Call callback when feature is removed.

Additional Inherited Members

- Protected Types inherited from makVrv::DtDisconnectable
enum  State { NotUsed, InUse, Disconnected }
typedef tbb::spin_mutex Mutex
- Protected Attributes inherited from makVrv::DtDisconnectable
Mutex myMutex
State myDisconnectedState
boost::signals2::signal< void()> myDisconnectSignal

Detailed Description

Interface which abstracts the concept of a individually identifiable "thing" in the terrain.

This is the object which must be implemented in order to add new kinds of terrain to the dynamic terrain system. While features are generally dynamic (that is, they have something about them that can be changed through this interface) they do not have to be and features which do not respond to changes can be added in order to found during querying.

The terrain world deciding the change the state of a feature causes it to call the changeState function on the feature and pass in a history interface which allows the feature to view the history time line of events (change requests) which are currently affecting this feature. This is generally allows the feature to view every piece of data it needs in order to faithfully reconstruct the terrain from whatever state it is in. The ordering of this history is the only thing the terrain world uses the change request times for.

Features respond to a combination of a command (DtDynamicTerrainChange) and a geometry (DtDynamicTerrainGeometry). DtDynamicTerranCommand is an interface into a key/value dictionary, the keys are strings and values can be strings, doubles, ints, or bools. The terrain world (DtDynamicTerrainWorld, which manages the features) never actually calls any of the command 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 commands mean. This allows the features to respond to a wide varied of commands. 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).

The geometry object is allows feature implementations which can construct terrain dynamically to access the geometry of the request (i.e. to create an odd shaped ditch) which features which don't have those abilities can ignore it. A null geometry pointer is considered to match all other geometries.

Features are added to the terrain world when terrain is paged in and the terrain world takes ownership of them. Features are removed from the terrain world when the terrain is paged out by calling functions in the handles returned by the terrain world when the feature was added.

There does not have to be a one to one relationship between features and whatever objects implement the terrain dynamics. Features are designed such that each one can represent a very small or very large part of the terrain. They can represent something like a single switch node, in which case a terrain may add many thousands of features, or a single feature can be used to encapsulate an entire terrain layer.

Member Typedef Documentation

Signal notification.

The functions can be used to install callbacks which are called when events happen. These changes will be called from inside the call that makes the change.

typedef boost::signals2::signal<void (const DtDynamicTerrainFeature&)> makVrv::DtDynamicTerrainFeature::Signal
private
typedef boost::signals2::signal< void (const DtDynamicTerrainFeature&, const DtDynamicTerrainChanges&) > makVrv::DtDynamicTerrainFeature::ChangeSignal
private
typedef std::map<RequestInfo*, boost::shared_ptr<Link> > makVrv::DtDynamicTerrainFeature::LinkInfoMap
private
typedef tbb::spin_rw_mutex makVrv::DtDynamicTerrainFeature::Mutex
private
typedef std::list<boost::shared_ptr<Link> > makVrv::DtDynamicTerrainFeature::LinkList
private
typedef tbb::spin_mutex makVrv::DtDynamicTerrainFeature::Mutex
private

Constructor & Destructor Documentation

makVrv::DtDynamicTerrainFeature::DtDynamicTerrainFeature ( )

Default Constructor.

virtual makVrv::DtDynamicTerrainFeature::~DtDynamicTerrainFeature ( )
virtual

Virtual destructor.

virtual makVrv::DtDynamicTerrainFeature::~Link ( )
virtual
virtual makVrv::DtDynamicTerrainFeature::~RequestInfo ( )
virtual

Member Function Documentation

static unsigned long long makVrv::DtDynamicTerrainFeature::GetObjectCount ( )
static
virtual bool makVrv::DtDynamicTerrainFeature::matches ( const DtDynamicTerrainChange ,
bool  useOriginalGeometry = false 
) const
pure virtual

Matching functions.

Allow for arbitrary matching against requests, queries, and spatial index subspaces. Setting useOriginalGeometry will match against the geometry without any changes made by this system (i.e. uses the original geometry obtained from the parser).

Implemented in DtEntityTerrainGeometryHandle::DynamicFeature, and makVrv::DtSwitchTerrainFeature.

virtual bool makVrv::DtDynamicTerrainFeature::matches ( const DtDynamicTerrainGeometry ,
bool  useOriginalGeometry = false 
) const
pure virtual
virtual const DtDynamicTerrainGeometry* makVrv::DtDynamicTerrainFeature::geometry ( ) const
pure virtual

Geometry which represents this feature.

Implemented in DtEntityTerrainGeometryHandle::DynamicFeature, and makVrv::DtSwitchTerrainFeature.

virtual const DtDynamicTerrainGeometry* makVrv::DtDynamicTerrainFeature::originalGeometry ( ) const
virtual
virtual boost::optional<DtString> makVrv::DtDynamicTerrainFeature::featureAttribute ( const DtString key) const
virtual

Access attribute values encoded into features.

virtual bool makVrv::DtDynamicTerrainFeature::isInDefaultState ( ) const
pure virtual

Is this feature in it's default (i.e. unchanged) state?

Implemented in DtEntityTerrainGeometryHandle::DynamicFeature, and makVrv::DtSwitchTerrainFeature.

virtual bool makVrv::DtDynamicTerrainFeature::lastStateWasDefaultState ( ) const
pure virtual

Was the previous state the feature was in immediately before the current state the default state?

Implemented in DtEntityTerrainGeometryHandle::DynamicFeature, and makVrv::DtSwitchTerrainFeature.

virtual void makVrv::DtDynamicTerrainFeature::changeState ( const DtDynamicTerrainChanges history)
pure virtual

Called by the dynamic terrain system in order to notify a feature that it should change its state.

The history is an interface into the all of the terrain state changes. This function may be called concurrently from multiple threads.

Parameters
historyHistory interface.

Implemented in DtEntityTerrainGeometryHandle::DynamicFeature, and makVrv::DtSwitchTerrainFeature.

virtual boost::signals2::connection makVrv::DtDynamicTerrainFeature::connectToChangeSignal ( const ChangeCallback callback) const
virtual

Call callback when feature state is changed.

Called immediately after changeState is called. This function may be called concurrently from multiple threads.

Parameters
callbackfunction object to be called.
Return values
Connectionobject which can be used to disconnect the connection.
virtual boost::signals2::connection makVrv::DtDynamicTerrainFeature::connectToPageOutSignal ( const Callback callback) const
virtual

Call callback when feature is removed.

The callback will only be called once.

Parameters
callbackfunction object to be called.
Return values
Connectionobject which can be used to disconnect the connection.
virtual DtString makVrv::DtDynamicTerrainFeature::description ( ) const
pure virtual

Feature description functions Allows feature to describe itself (for a gui mostly).

These can all be called from query callbacks. None of the values returned by these functions have any meaning besides informational. A description of what is in the feature, how it is setup, configuration, etc.

Implemented in DtEntityTerrainGeometryHandle::DynamicFeature, and makVrv::DtSwitchTerrainFeature.

virtual const DtDynamicTerrainFeature* makVrv::DtDynamicTerrainFeature::parentFeature ( ) const
virtual

Reimplemented in makVrv::DtSwitchTerrainFeature.

virtual void makVrv::DtDynamicTerrainFeature::iterateCommands ( const boost::function< void(const DtDynamicTerrainChange &)> &  ) const
virtual

Call the supplied callback on commands which represent the commands a feature can respond to.

This function is designed to be called from a query callback. The purpose of this function is supply a gui or other introspective tool with commands to issue (possibly modified) to this feature or to the terrain. A feature should create commands which they could respond to and would cause them to set themselves to the state they are in now. If there is some command a feature can respond to, outputting it in this function will allow a gui to do things like automatically create a menu with all the possibilities. The commands know the types of the attributes they contain, so the gui will know how to edit the values correctly in order to let the user change the commands before they are issued.

Reimplemented in DtEntityTerrainGeometryHandle::DynamicFeature, and makVrv::DtSwitchTerrainFeature.

void makVrv::DtDynamicTerrainFeature::changed ( )

Calls changeState and all attached query callbacks.

bool makVrv::DtDynamicTerrainFeature::pageOut ( )

Remove all change requests links and remove feature from dynamic terrain world.

Return values
trueif feature was paged out in this call, false otherwise.
void makVrv::DtDynamicTerrainFeature::changes ( const boost::function< void(const DtDynamicTerrainChanges &)> &  callback) const

Calls supplied callback on this features DtDynamicTerrainChanges interface.

Use this function to observer the current state of a feature.

RequestHandle makVrv::DtDynamicTerrainFeature::addChangeRequest ( DtDynamicTerrainChange change)

Add a change request directly to this feature.

RequestHandle makVrv::DtDynamicTerrainFeature::addChangeRequest ( double  time,
DtDynamicTerrainChange change 
)
void makVrv::DtDynamicTerrainFeature::indexDoubleAscending ( const DtString key)
protected

Key/value attribute indexing.

Non-virtual because these functions should be called from subclass constructors.

void makVrv::DtDynamicTerrainFeature::indexDoubleDescending ( const DtString key)
protected
void makVrv::DtDynamicTerrainFeature::indexIntAscending ( const DtString key)
protected
void makVrv::DtDynamicTerrainFeature::indexIntDescending ( const DtString key)
protected
void makVrv::DtDynamicTerrainFeature::indexStringAscending ( const DtString key)
protected
void makVrv::DtDynamicTerrainFeature::indexStringDescending ( const DtString key)
protected
void makVrv::DtDynamicTerrainFeature::setupIndex ( const DtString key,
DtDynamicTerrainIndex index 
)
protected
bool makVrv::DtDynamicTerrainFeature::makeLinkToRequest ( const boost::shared_ptr< Link > &  link)
private
void makVrv::DtDynamicTerrainFeature::breakLinkToRequest ( LinkInfoMap::iterator  )
private
static unsigned long long makVrv::DtDynamicTerrainFeature::GetObjectCount ( )
static
static bool makVrv::DtDynamicTerrainFeature::Create ( const boost::shared_ptr< DtDynamicTerrainFeature > &  featureInfo,
const boost::shared_ptr< RequestInfo > &  reqInfo 
)
static
RequestInfo& makVrv::DtDynamicTerrainFeature::request ( )
inline
DtDynamicTerrainFeature& makVrv::DtDynamicTerrainFeature::feature ( )
inline
makVrv::DtDynamicTerrainFeature::Link ( const boost::shared_ptr< DtDynamicTerrainFeature > &  featureInfo,
const boost::shared_ptr< RequestInfo > &  reqInfo 
)
private
static unsigned long long makVrv::DtDynamicTerrainFeature::GetObjectCount ( )
static
makVrv::DtDynamicTerrainFeature::RequestInfo ( DtDynamicTerrainChange command)
explicit
const DtDynamicTerrainChange& makVrv::DtDynamicTerrainFeature::command ( ) const
void makVrv::DtDynamicTerrainFeature::pageOut ( )
void makVrv::DtDynamicTerrainFeature::makeLinkToFeature ( const boost::shared_ptr< Link > &  link)
private
void makVrv::DtDynamicTerrainFeature::breakLinkToFeature ( LinkList::iterator  i)
private

Friends And Related Function Documentation

Link
friend

Member Data Documentation

ChangeSignal makVrv::DtDynamicTerrainFeature::myChangeSignal
mutableprivate
Signal makVrv::DtDynamicTerrainFeature::myPageOutSignal
mutableprivate
Mutex makVrv::DtDynamicTerrainFeature::myMutex
mutableprivate
LinkInfoMap makVrv::DtDynamicTerrainFeature::myLinkMap
private
IndexMap makVrv::DtDynamicTerrainFeature::myIndices
private
const boost::shared_ptr<RequestInfo> makVrv::DtDynamicTerrainFeature::myRequestInfo
private
const boost::shared_ptr<DtDynamicTerrainFeature> makVrv::DtDynamicTerrainFeature::myFeatureInfo
private
boost::scoped_ptr<DtDynamicTerrainChange> makVrv::DtDynamicTerrainFeature::myCommand
private
LinkList makVrv::DtDynamicTerrainFeature::myLinksToFeatures
private

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

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)