![]() |
VR-Forces Developer's Guide
|
This class will be responsible for handling requests to return resources for a particular entity (or entities) on either a one time basis or on a continual basis.
If the request is made on a one time basis the response will be one resource update packet for each entity requested to have resource returned for. If the request is for a continual update, a response will be sent immediately for each entity requested and then a queue will be set up to return information for each entity at the requested update period.
Note that the continuous update requests are additive. Counters will be kept for each entity that has a specific resource request made of it, but, all users that are listening in on this exercise will receive resource updates for all entities that have been requested to be updated. This means if user A requests an update for a particular tank, then users B and C will see the response to that request.
Public Member Functions | |
| DtResourceMonitor (DtSimulationServices *simManager, DtLocalObjectManager *) | |
| virtual | ~DtResourceMonitor () |
| virtual bool | init () |
| virtual bool | registerInterfaceCallbacks () |
| virtual void | tick (double simTime) |
| virtual void | restart () |
| virtual void | setEnabled (bool b) |
| bool | enabled () const |
| virtual void | processResourceMonitorRequest (DtSimInterfaceMessage *msg) |
| virtual void | processResourceNamesRequestCallback (DtSimInterfaceMessage *msg) |
| virtual void | processSimObjectAboutToBeRemoved (const DtSimObject *msg) |
| void | setUpdateOnTick (bool b) |
| bool | updateOnTick () const |
| virtual void | resourcesChangedFor (const DtSimObject *) |
| const std::set< DtUUID > & | resourcesChangedList () const |
Static Public Member Functions | |
| static void | resourceMonitorRequestCallback (DtSimMessage *msg, void *usr) |
| static void | resourceNamesRequestCallback (DtSimMessage *msg, void *usr) |
Protected Member Functions | |
| virtual void | publishResourcesFor (DtIfResourceMonitorResponse &response, const DtLocalObject *obj, const std::list< DtString > &resources) |
| virtual void | publishResourceNamesFor (DtIfResourceNamesResponse &response, const DtLocalObject *obj) |
| virtual void | addMonitorResource (DtLocalObject *, const DtString &resourceName, const DtSimulationAddress &sender, int iMonitorBy, const DtFloat64 &iMonitorPeriod, bool stopMonitoring) |
| virtual DtResourceMonitorList::iterator | resourceMonitorInfo (const DtUUID &) |
| virtual void | removeMonitorReference (const DtUUID &, const DtString &resourceName, const DtSimulationAddress &sender) |
| virtual void | removeMonitorReference (const DtUUID &) |
| virtual void | removeAllMonitorReferencesTo (const DtSimulationAddress &addr) |
| virtual bool | shouldAddResource (const DtSimResource *resourceItem) |
| virtual bool | resourceChanged (const DtUUID &) const |
| DtSimulationServices * | simulationServices () const |
Protected Attributes | |
| DtSimulationServices * | mySimulationServices |
| DtResourceMonitorList | myMonitoringResources |
| bool | myEnabled |
| bool | myUpdateOnTick |
| std::set< DtUUID > | myResourcesChangedList |
| tbb::spin_mutex | myMonitoringResourcesMutex |
| tbb::spin_mutex | myResourcesChangedListMutex |
| DtLocalObjectManager * | myObjectManager |
Private Member Functions | |
| DtResourceMonitor (const DtResourceMonitor &orig) | |
| const DtResourceMonitor & | operator= (const DtResourceMonitor &orig) |
| DtResourceMonitor () | |
| virtual void | processCurrentResourceRequest (DtSimInterfaceMessage *msg) |
| static void | currentResourceRequestCallback (DtSimMessage *msg, void *usr) |
|
private |
copy constructor; report timer is currently not copied.
|
private |
| DtResourceMonitor::DtResourceMonitor | ( | DtSimulationServices * | simManager, |
| DtLocalObjectManager * | |||
| ) |
standard constructor
|
virtual |
destructor
|
private |
assignment operator; see copy constructor above.
|
virtual |
Calls register callbacks.
|
virtual |
Only works if a valid simManager was provided at construction time.
|
virtual |
If the simulation is not in pause mode, go through all the monitored entries to see if they need to be updated. If they do, then send out a message that contains the resources that want to be updated by calling publishResourcesFor those items that want to be updated. If, during a tick, an object exists in the monitored list that does not exist in the object manager (as a local object) then it will be removed from the monitored list.
All resources published will also have their condition updated for the next publish period
|
virtual |
Clear out the array of requests and start over.
|
virtual |
Enables/disables monitor. Flag is checked in tick() call and tick will not be executed if monitor is disabled.
|
inline |
|
static |
Callbacks to do message processing for resource monitoring requests.
|
virtual |
|
static |
Callbacks to do message processing for immediate return of current resource values. Responses to this request will include the request ID from the DtIfCurrentResourceRequest.
|
virtual |
Callbacks to do message processing for immediate return of current resource values. Responses to this request will include the request ID from the DtIfCurrentResourceRequest.
|
static |
Callbacks to do message processing for immediate return of current resource names associated with supplied entities.
|
virtual |
|
virtual |
Remove entity from resource monitor list.
|
inline |
Set to make sure the resource monitor updates the network with any requested resources even if the simulation is paused. When the tick occurs, this value will be set back to false.
|
inline |
|
virtual |
Call to add an entity to the list (in between ticks) of resources that have been changed, so, if someone is monitoring the resources for that entity, it will be sent out right away. This list will be cleared each tick.
|
inline |
References myResourcesChangedList.
|
protectedvirtual |
If the specified object has a resource manager, then publish either all information associated with the resources or just the selected items.
|
protectedvirtual |
Adds resource names for the specified object to response structure.
|
protectedvirtual |
Adds a new resource item to be monitored and reported on by the system. If the item is already being monitored, it will take the better type of monitoring request. Sets myUpdateOnTick to be true so an update will be forced for the current request so the requesting user can see the current resources.
|
protectedvirtual |
Returns an iterator to the slot of the requested info. If the info does not exist, will return the end iterator of the monitor resource list.
|
protectedvirtual |
Removes the specified reference to the specified resource for the object name asked for by the sender. If no more references to the particular resource exist after removal the resource entry is removed. If no more resource monitoring items for the specified entity exist, that resource monitor info item is removed.
|
protectedvirtual |
Removes all references to the object specified.
|
protectedvirtual |
Removes all monitored items by the specified sender.
|
protectedvirtual |
Override to provide additional tests to see whether or not this resource item can be monitored. Currently only makes sure that the resource is a leaf node.
|
inlineprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by resourcesChangedList().
|
protected |
|
mutableprotected |
|
protected |