![]() |
VR-Forces 4.6 Class Documentation
|
Class: DtResourceMonitor. More...
Public Member Functions | |
| DtResourceMonitor () | |
| Default constructor; note that if this form is used and a sim manager is not set, reports will not be sent (but console output can still be generated.) | |
| virtual | ~DtResourceMonitor () |
| destructor | |
| DtResourceMonitor (DtSimManager *simManager) | |
| standard constructor | |
| DtResourceMonitor (const DtResourceMonitor &orig) | |
| copy constructor; report timer is currently not copied. | |
| const DtResourceMonitor & | operator= (const DtResourceMonitor &orig) |
| assignment operator; see copy constructor above. | |
| virtual bool | init () |
| Calls register callbacks. | |
| void | setSimManager (DtSimManager *simManager) |
| If the default constructor was used, you can supply a sim manager later; however, if you do, you must also call registerInterfaceCallbacks(). | |
| DtSimManager * | simManager () const |
| virtual bool | registerInterfaceCallbacks () |
| Only works if a valid simManager was provided at construction time. | |
| virtual void | tick (double simTime) |
| If the simulation is not in pause mode, go through all the monitored entries to see if they need to be updated. | |
| virtual void | restart () |
| Clear out the array of requests and start over. | |
| virtual void | setEnabled (bool b) |
| Enables/disables monitor. | |
| bool | enabled () const |
| virtual void | processResourceMonitorRequest (DtSimInterfaceMessage *msg) |
| virtual void | processResourceNamesRequestCallback (DtSimInterfaceMessage *msg) |
| virtual void | processSimObjectAboutToBeRemoved (DtVrfObject *msg) |
| void | setUpdateOnTick (bool b) |
| Set to make sure the resource monitor updates the network with any requested resources even if the simulation is paused. | |
| bool | updateOnTick () const |
| virtual void | resourcesChangedFor (const DtVrfObject *) |
| 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. | |
| const std::set< DtUUID > & | resourcesChangedList () const |
Static Public Member Functions | |
| static void | resourceMonitorRequestCallback (DtSimMessage *msg, void *usr) |
| Callbacks to do message processing for resource monitoring requests. | |
| static void | resourceNamesRequestCallback (DtSimMessage *msg, void *usr) |
| Callbacks to do message processing for immediate return of current resource names associated with supplied entities. | |
| static void | simObjectAboutToBeRemoved (DtVrfObject *msg, void *usr) |
| Remove entity from resource monitor list. | |
Protected Member Functions | |
| virtual void | publishResourcesFor (DtIfResourceMonitorResponse &response, DtVrfObject *obj, const std::list< DtString > &resources) |
| If the specified object has a resource manager, then publish either all information associated with the resources or just the selected items. | |
| virtual void | publishResourceNamesFor (DtIfResourceNamesResponse &response, DtVrfObject *obj) |
| Adds resource names for the specified object to response structure. | |
| virtual void | addMonitorResource (const DtUUID &, const DtString &resourceName, const DtSimulationAddress &sender, int iMonitorBy, const DtFloat64 &iMonitorPeriod, bool stopMonitoring) |
| Adds a new resource item to be monitored and reported on by the system. | |
| virtual DtResourceMonitorList::iterator | resourceMonitorInfo (const DtUUID &) |
| Returns an iterator to the slot of the requested info. | |
| virtual void | removeMonitorReference (const DtUUID &, const DtString &resourceName, const DtSimulationAddress &sender) |
| Removes the specified reference to the specified resource for the object name asked for by the sender. | |
| virtual void | removeMonitorReference (const DtUUID &) |
| Removes all references to the object specified. | |
| virtual void | removeAllMonitorReferencesTo (const DtSimulationAddress &addr) |
| Removes all monitored items by the specified sender. | |
| virtual bool | shouldAddResource (const DtSimResource *resourceItem) |
| Override to provide additional tests to see whether or not this resource item can be monitored. | |
| virtual bool | resourceChanged (const DtUUID &) const |
Protected Attributes | |
| DtSimManager * | mySimManager |
| DtResourceMonitorList | myMonitoringResources |
| bool | myEnabled |
| bool | myUpdateOnTick |
| std::set< DtUUID > | myResourcesChangedList |
| virtual void | processCurrentResourceRequest (DtSimInterfaceMessage *msg) |
| static void | currentResourceRequestCallback (DtSimMessage *msg, void *usr) |
| Callbacks to do message processing for immediate return of current resource values. | |
Class: DtResourceMonitor.
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.
| DtResourceMonitor::DtResourceMonitor | ( | ) |
Default constructor; note that if this form is used and a sim manager is not set, reports will not be sent (but console output can still be generated.)
|
virtual |
destructor
| DtResourceMonitor::DtResourceMonitor | ( | DtSimManager * | simManager | ) |
standard constructor
| DtResourceMonitor::DtResourceMonitor | ( | const DtResourceMonitor & | orig | ) |
copy constructor; report timer is currently not copied.
| const DtResourceMonitor& DtResourceMonitor::operator= | ( | const DtResourceMonitor & | orig | ) |
assignment operator; see copy constructor above.
|
virtual |
Calls register callbacks.
|
inline |
If the default constructor was used, you can supply a sim manager later; however, if you do, you must also call registerInterfaceCallbacks().
|
inline |
|
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 |
|
static |
Callbacks to do message processing for immediate return of current resource names associated with supplied entities.
|
virtual |
|
static |
Remove entity from resource monitor list.
|
virtual |
|
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
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by resourcesChangedList().