VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtObjectProximitySensorMonitor Class Reference

Detailed Description

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 DtObjectProximitySensorMonitoroperator= (const DtObjectProximitySensorMonitor &orig)
 

Member Typedef Documentation

◆ DtSubscriberList

Type definition for the subscriber list.

Defines the container type used to store the list of subscriber IDs.

Constructor & Destructor Documentation

◆ DtObjectProximitySensorMonitor() [1/3]

makVre::DtObjectProximitySensorMonitor::DtObjectProximitySensorMonitor ( )
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=().

◆ DtObjectProximitySensorMonitor() [2/3]

makVre::DtObjectProximitySensorMonitor::DtObjectProximitySensorMonitor ( const DtObjectProximitySensorMonitor & orig)
private

Copy constructor (not implemented)

Copy constructor is private and not implemented to prevent copy construction.

References DtObjectProximitySensorMonitor().

◆ DtObjectProximitySensorMonitor() [3/3]

makVre::DtObjectProximitySensorMonitor::DtObjectProximitySensorMonitor ( DtLocalObject * hostObject,
const DtSensorContactInfoList * contactInfoList,
const DtString & sensorName,
int sensorType )

Constructor.

Parameters
hostObjectThe local object that owns the sensor this monitor is for
contactInfoListPointer to the list of sensor contacts maintained by the sensor
sensorNameThe name of the sensor being monitored
sensorTypeThe type identifier for the sensor being monitored

Creates a new sensor monitor that will handle communication between the specified sensor and visualization clients.

◆ ~DtObjectProximitySensorMonitor()

virtual makVre::DtObjectProximitySensorMonitor::~DtObjectProximitySensorMonitor ( )
virtual

Virtual destructor.

Cleans up resources used by the object proximity sensor monitor.

Member Function Documentation

◆ operator=()

const DtObjectProximitySensorMonitor & makVre::DtObjectProximitySensorMonitor::operator= ( const DtObjectProximitySensorMonitor & orig)
private

Assignment operator (not implemented)

Returns
Reference to this object

Assignment operator is private and not implemented to prevent assignment.

References DtObjectProximitySensorMonitor().

◆ init()

virtual bool makVre::DtObjectProximitySensorMonitor::init ( )
virtual

Initializes the monitor.

Returns
True if initialization is successful, false otherwise

Initializes the monitor by registering message callbacks to handle subscription requests from clients. Called after construction.

◆ registerMessageCallbacks()

virtual void makVre::DtObjectProximitySensorMonitor::registerMessageCallbacks ( )
virtual

Registers message callbacks for sensor data requests.

Registers callback functions to handle sensorDataRequest and sensorDataUnsubscribe messages from visualization clients.

◆ sensorDataRequestCallback()

static void makVre::DtObjectProximitySensorMonitor::sensorDataRequestCallback ( DtSimMessage * msg,
void * usrData )
static

Static callback function for sensor data request messages.

Parameters
msgThe simulation message containing the request
usrDataUser 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.

◆ processSensorDataRequest()

virtual void makVre::DtObjectProximitySensorMonitor::processSensorDataRequest ( DtSimMessage * msg)
virtual

Processes a sensor data request message.

Parameters
msgThe simulation message containing the request

Handles subscription or unsubscription requests for sensor data, updating the subscriber list and sending initial data when needed.

◆ createAndSendSensorDataMessage()

virtual void makVre::DtObjectProximitySensorMonitor::createAndSendSensorDataMessage ( )
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.

◆ notifyTargetsChanged()

virtual void makVre::DtObjectProximitySensorMonitor::notifyTargetsChanged ( )
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.

◆ onSubscriberList()

virtual bool makVre::DtObjectProximitySensorMonitor::onSubscriberList ( const DtU64 id) const
protectedvirtual

Checks if an address is on the subscriber list.

Parameters
idThe client identifier to check
Returns
True if the client is a current subscriber, false otherwise

Determines if the specified client identifier is currently in the list of subscribers for this sensor's data.

◆ addToSubscriberList()

virtual void makVre::DtObjectProximitySensorMonitor::addToSubscriberList ( const DtU64 id)
protectedvirtual

Adds a client to the subscriber list.

Parameters
idThe client identifier to add

Adds the specified client identifier to the list of subscribers for this sensor's data.

◆ removeFromSubscriberList()

virtual void makVre::DtObjectProximitySensorMonitor::removeFromSubscriberList ( const DtU64 id)
protectedvirtual

Removes a client from the subscriber list.

Parameters
idThe client identifier to remove

Removes the specified client identifier from the list of subscribers for this sensor's data.

◆ numberOfSubscribers()

virtual int makVre::DtObjectProximitySensorMonitor::numberOfSubscribers ( )
protectedvirtual

Gets the number of current subscribers.

Returns
The number of clients currently subscribed to this sensor's data

Returns the count of clients currently subscribed to receive sensor data updates.

Member Data Documentation

◆ myHostObject

DtLocalObject* makVre::DtObjectProximitySensorMonitor::myHostObject
protected

Pointer to the local object that owns the sensor.

The entity object that owns the sensor this monitor is associated with.

◆ mySensorContactInfoList

const DtSensorContactInfoList* makVre::DtObjectProximitySensorMonitor::mySensorContactInfoList
protected

Pointer to the sensor's contact information list.

Contains the current list of objects detected by the sensor.

◆ mySensorType

int makVre::DtObjectProximitySensorMonitor::mySensorType
protected

Type identifier for the sensor.

Numeric identifier for the type of sensor being monitored.

◆ mySensorName

DtString makVre::DtObjectProximitySensorMonitor::mySensorName
protected

Name of the sensor.

String identifier for the sensor being monitored.

◆ mySubscriberList

DtSubscriberList makVre::DtObjectProximitySensorMonitor::mySubscriberList
protected

List of current subscribers.

Contains the identifiers of all clients currently subscribed to receive sensor data updates.


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