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 Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtStreamedSpeedTreeThread Class Reference

Thread object to convert tree marker requests into tree records in a worker thread. More...

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

Classes

struct  TreeRequestMsg
 A message to convert some tree requests into tree records. More...
struct  TreeRequestOutput
 Output of a processed set of marker requests. More...

Public Types

enum  RequestStatus { UNUSED, WORKING, DONE }
 Status of a request to convert markers. More...
typedef std::list
< TreeRequestOutput
RequestOutputList
 List type for output objects.
typedef boost::unordered_set
< const osg::Node * > 
NodeSet
 Set of request nodes.
typedef boost::unordered_set
< DtStreamedSpeedTreeForest * > 
ForestSet
 Set of forests.
typedef boost::unordered_set
< std::string > 
StringSet
 Set of model definition names.

Public Member Functions

virtual ~DtStreamedSpeedTreeThread ()
 DTOR.
RequestOutputListrequestOutput ()
 List of allocated output objects.
NodeSetunloaded ()
 Set of unloaded feature request nodes.
void setForestDeleted (DtStreamedSpeedTreeForest *forest)
 Add a forest object to the deleted set.
void setNodeUnloaded (const osg::Node *node)
 Add a node to the unloaded set.
void enqueue (const osgEarth::Features::CustomFeatureNode::MarkerRequestList &requests, TreeRequestOutput *out, DtStreamedSpeedTreeForest *forest, const osg::Node *dataNode, bool useScaleRandomization, bool useOrientationRandomization, float treeMinScale, float treeMaxScale)
 Enqueue a new request message.
virtual void run ()
 Thread main loop.
void handleRequest (const TreeRequestMsg &msg)
 Process the message into tree records.
bool isForestDeleted (DtStreamedSpeedTreeForest *forest)
 Check whether a forest is in the deleted set.
bool isNodeUnloaded (const osg::Node *node)
 Check whether a node is in the unloaded set.
void block ()
 Wait, don't process more trees.
void release ()
 Allow more tree processing.
virtual void updateBlock ()
 Tell the SpeedTreeThread there are more trees to process.
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 Do nothing constructor.
virtual ~DtVirtualBaseClass ()
 Virtual do nothing destructor.

Static Public Member Functions

static DtStreamedSpeedTreeThreadinstance (DtDe &de)
 Get the instance of the thread object from its owner de.
static std::size_t hash_value (const std::string &modelDefName, const osgEarth::Features::CustomFeatureNode::OsgEarthMarkerRequest &val)
 Marker request hash function.
static void mergeTreeRequests (DtDe &de)
 Callback to merge processed tree requests into a SpeedTree forest.

Protected Member Functions

 DtStreamedSpeedTreeThread (DtDe &de)
 CTOR.

Protected Attributes

DtDemyDe
std::deque< TreeRequestMsgmyMessageQueue
 Queue of marker request messages.
OpenThreads::Block myBlock
boost::mutex myMessageQueueMutex
 Mutex controlling access to q.
StringSet myValidModelDefinitions
 Cache of valid SpeedTree model definitions.
ForestSet myDeletedForests
 Set of deleted forest objects.
RequestOutputList myTreeRequestOutput
 List of allocated output objects.
NodeSet myUnloadedNodes
 Set of unloaded feature request nodes.
bool myTimeToStop
 Flag to tell the thread to stop.

Detailed Description

Thread object to convert tree marker requests into tree records in a worker thread.

Member Typedef Documentation

List type for output objects.

typedef boost::unordered_set<const osg::Node*> makVrv::DtStreamedSpeedTreeThread::NodeSet

Set of request nodes.

Set of forests.

typedef boost::unordered_set<std::string> makVrv::DtStreamedSpeedTreeThread::StringSet

Set of model definition names.

Member Enumeration Documentation

Status of a request to convert markers.

Enumerator:
UNUSED 
WORKING 
DONE 

Constructor & Destructor Documentation

virtual makVrv::DtStreamedSpeedTreeThread::~DtStreamedSpeedTreeThread ( )
virtual

DTOR.

makVrv::DtStreamedSpeedTreeThread::DtStreamedSpeedTreeThread ( DtDe de)
protected

CTOR.

Member Function Documentation

static DtStreamedSpeedTreeThread& makVrv::DtStreamedSpeedTreeThread::instance ( DtDe de)
static

Get the instance of the thread object from its owner de.

RequestOutputList& makVrv::DtStreamedSpeedTreeThread::requestOutput ( )

List of allocated output objects.

Requestors should find an unused output object if possible and if not, push a new one to the end of the list

NodeSet& makVrv::DtStreamedSpeedTreeThread::unloaded ( )

Set of unloaded feature request nodes.

Requestors should add nodes to this set when they are deleted to prevent adding trees after deletion

void makVrv::DtStreamedSpeedTreeThread::setForestDeleted ( DtStreamedSpeedTreeForest forest)

Add a forest object to the deleted set.

void makVrv::DtStreamedSpeedTreeThread::setNodeUnloaded ( const osg::Node *  node)

Add a node to the unloaded set.

void makVrv::DtStreamedSpeedTreeThread::enqueue ( const osgEarth::Features::CustomFeatureNode::MarkerRequestList requests,
TreeRequestOutput out,
DtStreamedSpeedTreeForest forest,
const osg::Node *  dataNode,
bool  useScaleRandomization,
bool  useOrientationRandomization,
float  treeMinScale,
float  treeMaxScale 
)

Enqueue a new request message.

virtual void makVrv::DtStreamedSpeedTreeThread::run ( )
virtual

Thread main loop.

void makVrv::DtStreamedSpeedTreeThread::handleRequest ( const TreeRequestMsg msg)

Process the message into tree records.

bool makVrv::DtStreamedSpeedTreeThread::isForestDeleted ( DtStreamedSpeedTreeForest forest)

Check whether a forest is in the deleted set.

bool makVrv::DtStreamedSpeedTreeThread::isNodeUnloaded ( const osg::Node *  node)

Check whether a node is in the unloaded set.

static std::size_t makVrv::DtStreamedSpeedTreeThread::hash_value ( const std::string &  modelDefName,
const osgEarth::Features::CustomFeatureNode::OsgEarthMarkerRequest val 
)
static

Marker request hash function.

Hashes on request name and XYZ position

static void makVrv::DtStreamedSpeedTreeThread::mergeTreeRequests ( DtDe de)
static

Callback to merge processed tree requests into a SpeedTree forest.

Connected to DtDe::signal_postTick

void makVrv::DtStreamedSpeedTreeThread::block ( )

Wait, don't process more trees.

void makVrv::DtStreamedSpeedTreeThread::release ( )

Allow more tree processing.

virtual void makVrv::DtStreamedSpeedTreeThread::updateBlock ( )
virtual

Tell the SpeedTreeThread there are more trees to process.

Member Data Documentation

DtDe& makVrv::DtStreamedSpeedTreeThread::myDe
protected
std::deque<TreeRequestMsg> makVrv::DtStreamedSpeedTreeThread::myMessageQueue
protected

Queue of marker request messages.

Lock qm before using

OpenThreads::Block makVrv::DtStreamedSpeedTreeThread::myBlock
protected
boost::mutex makVrv::DtStreamedSpeedTreeThread::myMessageQueueMutex
protected

Mutex controlling access to q.

StringSet makVrv::DtStreamedSpeedTreeThread::myValidModelDefinitions
protected

Cache of valid SpeedTree model definitions.

Allows filtering out requests with invalid model definitions

ForestSet makVrv::DtStreamedSpeedTreeThread::myDeletedForests
protected

Set of deleted forest objects.

The forest object adds itself here on deletion to avoid adding trees to a deleted forest

RequestOutputList makVrv::DtStreamedSpeedTreeThread::myTreeRequestOutput
protected

List of allocated output objects.

Requestors should find an unused output object if possible and if not, push a new one to the end of the list

NodeSet makVrv::DtStreamedSpeedTreeThread::myUnloadedNodes
protected

Set of unloaded feature request nodes.

Requestors should add nodes to this set when they are deleted to prevent adding trees after deletion

bool makVrv::DtStreamedSpeedTreeThread::myTimeToStop
protected

Flag to tell the thread to stop.


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)