|
VR-Engage
2.2
|
DtObjectProximitySensorMonitor manages the communication of sensor contact information between a proximity sensor and visualization systems. It handles subscription requests from clients, maintains a list of current subscribers, and sends sensor data messages when the detected object list changes.
This class serves a similar purpose to DtObjectSensorMonitor in VR-Forces, but is specifically designed for the DtObjectProximitySensor which does not use a DtObjectSensorPSR.
#include <objectProximitySensorMonitor.h>
Public Member Functions | |
| DtObjectProximitySensorMonitor (DtLocalObject *hostObject, const DtSensorContactInfoList *contactInfoList, const DtString &sensorName, int sensorType) | |
| virtual | ~DtObjectProximitySensorMonitor () |
| virtual bool | init () |
| virtual void | registerMessageCallbacks () |
| virtual void | processSensorDataRequest (DtSimMessage *msg) |
| virtual void | createAndSendSensorDataMessage () |
| virtual void | notifyTargetsChanged () |
Static Public Member Functions | |
| static void | sensorDataRequestCallback (DtSimMessage *msg, void *usrData) |
Protected Types | |
| using | DtSubscriberList = std::list<DtU64> |
Protected Member Functions | |
| virtual bool | onSubscriberList (const DtU64 id) const |
| virtual void | addToSubscriberList (const DtU64 id) |
| virtual void | removeFromSubscriberList (const DtU64 id) |
| virtual int | numberOfSubscribers () |
Protected Attributes | |
| DtLocalObject * | myHostObject |
| const DtSensorContactInfoList * | mySensorContactInfoList |
| int | mySensorType |
| DtString | mySensorName |
| DtSubscriberList | mySubscriberList |
Private Member Functions | |
| DtObjectProximitySensorMonitor () | |
| DtObjectProximitySensorMonitor (const DtObjectProximitySensorMonitor &orig) | |
| const DtObjectProximitySensorMonitor & | operator= (const DtObjectProximitySensorMonitor &orig) |
|
protected |
Type definition for the subscriber list.
Defines the container type used to store the list of subscriber IDs.
|
private |
Default constructor (not implemented)
Default constructor is private and not implemented to prevent creation of instances without proper initialization.
Referenced by DtObjectProximitySensorMonitor(), and operator=().
|
private |
Copy constructor (not implemented)
Copy constructor is private and not implemented to prevent copy construction.
References DtObjectProximitySensorMonitor().
| makVre::DtObjectProximitySensorMonitor::DtObjectProximitySensorMonitor | ( | DtLocalObject * | hostObject, |
| const DtSensorContactInfoList * | contactInfoList, | ||
| const DtString & | sensorName, | ||
| int | sensorType ) |
Constructor.
| hostObject | The local object that owns the sensor this monitor is for |
| contactInfoList | Pointer to the list of sensor contacts maintained by the sensor |
| sensorName | The name of the sensor being monitored |
| sensorType | The type identifier for the sensor being monitored |
Creates a new sensor monitor that will handle communication between the specified sensor and visualization clients.
|
virtual |
Virtual destructor.
Cleans up resources used by the object proximity sensor monitor.
|
private |
Assignment operator (not implemented)
Assignment operator is private and not implemented to prevent assignment.
References DtObjectProximitySensorMonitor().
|
virtual |
Initializes the monitor.
Initializes the monitor by registering message callbacks to handle subscription requests from clients. Called after construction.
|
virtual |
Registers message callbacks for sensor data requests.
Registers callback functions to handle sensorDataRequest and sensorDataUnsubscribe messages from visualization clients.
|
static |
Static callback function for sensor data request messages.
| msg | The simulation message containing the request |
| usrData | User data pointer (contains the monitor instance) |
Static function registered as a callback to handle sensor data request messages. Forwards the request to the appropriate monitor instance.
|
virtual |
Processes a sensor data request message.
| msg | The simulation message containing the request |
Handles subscription or unsubscription requests for sensor data, updating the subscriber list and sending initial data when needed.
|
virtual |
Creates and sends a sensor data message to subscribers.
Constructs a DtSensorData message based on the current state of the sensor's contact list and sends it to all current subscribers. This provides visualization clients with up-to-date sensor contact information.
|
virtual |
Notifies that the sensor's target list has changed.
Called by the object proximity sensor whenever the list of detected objects changes. This triggers sensor data messages to be sent out to all current subscribers, ensuring they have the latest detection information.
|
protectedvirtual |
Checks if an address is on the subscriber list.
| id | The client identifier to check |
Determines if the specified client identifier is currently in the list of subscribers for this sensor's data.
|
protectedvirtual |
Adds a client to the subscriber list.
| id | The client identifier to add |
Adds the specified client identifier to the list of subscribers for this sensor's data.
|
protectedvirtual |
Removes a client from the subscriber list.
| id | The client identifier to remove |
Removes the specified client identifier from the list of subscribers for this sensor's data.
|
protectedvirtual |
Gets the number of current subscribers.
Returns the count of clients currently subscribed to receive sensor data updates.
|
protected |
Pointer to the local object that owns the sensor.
The entity object that owns the sensor this monitor is associated with.
|
protected |
Pointer to the sensor's contact information list.
Contains the current list of objects detected by the sensor.
|
protected |
Type identifier for the sensor.
Numeric identifier for the type of sensor being monitored.
|
protected |
Name of the sensor.
String identifier for the sensor being monitored.
|
protected |
List of current subscribers.
Contains the identifiers of all clients currently subscribed to receive sensor data updates.