VR-Engage  2.3
Loading...
Searching...
No Matches
ifAssignRolePlayer.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file ifAssignRolePlayer.h
7//! \ingroup vreVrfMessages
8//! \brief Interface message class for assigning role players to entities
9//!
10//! This file defines the DtIfAssignRolePlayer class, which is used to assign
11//! a player to an entity at a particular VREngage station with a specified role.
12
13#pragma once
14
16#include <vrfExtProtocol/simInterfaceContent.h>
17#include <vlutil/vlString.h>
18#include <vrfutil/uuid.h>
19
20//! \brief Current version of the assign role player message
22
23//! \brief Interface message for assigning role players to entities
24//!
25//! Instances of DtIfAssignRolePlayer messages are sent out by a VRF GUI
26//! application to assign a player to an entity at a particular VREngage station.
27//! This message includes information about the player's station/role, the entity
28//! to control, and viewing mode settings.
29
30class VRFMESSAGES_DLL DtIfAssignRolePlayer : public DtSimInterfaceContent
31{
32public:
33 //! \brief Default constructor
34 //!
35 //! Initializes an empty assign role player message.
37
38 //! \brief Virtual destructor
39 virtual ~DtIfAssignRolePlayer() override;
40
41 //! \brief Copy constructor
42 //! \param orig The assign role player message to copy from
43 //!
44 //! Creates a new assign role player message by copying an existing one.
46
47 //! \brief Assignment operator
48 //! \param orig The assign role player message to copy from
49 //! \return Reference to this object after assignment
50 //!
51 //! Copies the contents of another assign role player message into this one.
53
54 //! \brief Gets the interface message type
55 //! \return The message type identifier
56 //!
57 //! Returns DtAssignRolePlayerMessageType as defined in vreVrfMessageTypes.h.
58 virtual int type() const override;
59
60 //! \brief Creates a copy of this message
61 //! \return Pointer to the new copy
62 //!
63 //! Creates a dynamically allocated copy of this message.
64 virtual DtSimInterfaceContent* clone() const override;
65
66 //! \brief Sets the identifier of the VREngage application
67 //! \param id The unique identifier to set
68 //!
69 //! Sets the unique identifier for the VREngage application.
70 //! This must be unique across all VREngage stations in an exercise
71 //! and must not change over the lifetime of the application.
72 //! The ID is the initial station-name string resolved at startup.
73 virtual void setStationId(const DtString& id);
74
75 //! \brief Gets the identifier of the VREngage application
76 //! \return The VREngage application identifier
77 virtual DtString stationId() const;
78
79 //! \brief Sets the UUID of the entity to be controlled
80 //! \param uuid The entity UUID to set
81 //!
82 //! Sets the UUID of the entity to be controlled at the VREngage station.
83 virtual void setUUID(const DtUUID& uuid);
84
85 //! \brief Gets the UUID of the entity to be controlled
86 //! \return The entity UUID
87 virtual DtUUID uuid() const;
88
89 //! \brief Sets the station/role name for the player
90 //! \param name The station name to set
91 //!
92 //! Sets the station name (role) to be assumed by the player at the VREngage station.
93 //! Available string identifiers for roles are defined in the .entity file.
94 virtual void setStationName(const DtString& name);
95
96 //! \brief Gets the station/role name for the player
97 //! \return The station name
98 virtual DtString stationName() const;
99
100 //! \brief Sets the spectator mode flag
101 //! \param mode True for spectator mode, false for active player mode
102 //!
103 //! Sets whether the player at the VREngage station is in spectator mode.
104 //! In spectator mode, the player can observe but not interact with the entity.
105 virtual void setSpectatorMode(bool mode);
106
107 //! \brief Gets the spectator mode flag
108 //! \return True if in spectator mode, false otherwise
109 virtual bool spectatorMode() const;
110
111 //! \brief Marks an automatic restored-role replay for the frontend rewind policy.
112 //! \param value True for restored-role replay, false for an ordinary assignment.
113 virtual void setIsReengagement(bool value);
114
115 //! \brief Returns whether this assignment is an automatic restored-role replay.
116 //! \return False for ordinary assignments.
117 virtual bool isReengagement() const;
118
119 //! \brief Gets the network representation size
120 //! \return Size in bytes of the network representation
121 //!
122 //! Returns the size of the network buffer needed to store this message.
123 virtual int netRepSize() const override;
124
125 //! \brief Deserializes the message from a network buffer
126 //! \param contentBuffer Pointer to the network buffer
127 //! \param contentSize Size of the buffer in bytes
128 //! \return True if deserialization was successful
129 //!
130 //! Fills the message from the provided network buffer.
131 virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
132
133 //! \brief Serializes the message for network transmission
134 //! \return True if serialization was successful
135 //!
136 //! Prepares the message for network transmission.
137 virtual bool setToNet() override;
138
139 //! \brief Formats the message data as a string
140 //! \param str String to store the formatted message data
141 //!
142 //! Appends a human-readable representation of the message to the provided string.
143 virtual void printDataToString(DtString& str) override;
144
145 //! \brief Static creator function for factory registration
146 //! \return Pointer to a new instance of DtIfAssignRolePlayer
147 //!
148 //! This static function is used for registration with DtInterfaceContentFactory.
149 static DtSimInterfaceContent* creator();
150
151
152protected:
153 //! \brief Version information for the message
154 //!
155 //! The high word is a signal that the version exists, and the
156 //! low word is the actual version. If this information does not exist,
157 //! it is assumed to be an older status message.
159
160 //! \brief Unique identifier for the VREngage application
161 //!
162 //! Must be unique across all VREngage stations in an exercise
163 //! and must not change over the lifetime of the application.
164 //! Stored as the initial station-name string resolved at startup.
165 DtString myStationId;
166
167 //! \brief UUID of the entity to be controlled
168 DtUUID myUUID;
169
170 //! \brief Station/role name for the player
171 //!
172 //! Station name to be assumed by the player at the VREngage station
173 //! (defined in the .entity file).
175
176 //! \brief Flag indicating whether player is in spectator mode
177 //!
178 //! When true, the player can observe but not interact with the entity.
180
181 //! \brief True when the assignment is an automatic restored-role replay.
183};
DtUUID myUUID
UUID of the entity to be controlled.
Definition ifAssignRolePlayer.h:168
virtual int type() const override
Gets the interface message type.
bool mySpectatorMode
Flag indicating whether player is in spectator mode.
Definition ifAssignRolePlayer.h:179
DtString myStationName
Station/role name for the player.
Definition ifAssignRolePlayer.h:174
virtual void setIsReengagement(bool value)
Marks an automatic restored-role replay for the frontend rewind policy.
virtual DtString stationId() const
Gets the identifier of the VREngage application.
virtual bool isReengagement() const
Returns whether this assignment is an automatic restored-role replay.
DtIfAssignRolePlayer()
Default constructor.
virtual void setStationId(const DtString &id)
Sets the identifier of the VREngage application.
virtual DtSimInterfaceContent * clone() const override
Creates a copy of this message.
virtual void setStationName(const DtString &name)
Sets the station/role name for the player.
DtIfAssignRolePlayer & operator=(const DtIfAssignRolePlayer &orig)
Assignment operator.
virtual DtUUID uuid() const
Gets the UUID of the entity to be controlled.
DtIfAssignRolePlayer(const DtIfAssignRolePlayer &orig)
Copy constructor.
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Deserializes the message from a network buffer.
virtual bool setToNet() override
Serializes the message for network transmission.
virtual bool spectatorMode() const
Gets the spectator mode flag.
virtual DtString stationName() const
Gets the station/role name for the player.
bool myIsReengagement
True when the assignment is an automatic restored-role replay.
Definition ifAssignRolePlayer.h:182
virtual void setUUID(const DtUUID &uuid)
Sets the UUID of the entity to be controlled.
DtU32 myVersion
Version information for the message.
Definition ifAssignRolePlayer.h:158
virtual void printDataToString(DtString &str) override
Formats the message data as a string.
virtual void setSpectatorMode(bool mode)
Sets the spectator mode flag.
virtual ~DtIfAssignRolePlayer() override
Virtual destructor.
DtString myStationId
Unique identifier for the VREngage application.
Definition ifAssignRolePlayer.h:165
static DtSimInterfaceContent * creator()
Static creator function for factory registration.
virtual int netRepSize() const override
Gets the network representation size.
const int DtAssignRolePlayerVersion
Current version of the assign role player message.
Definition ifAssignRolePlayer.h:21
Export/import macros for the VRF Messages library.
#define VRFMESSAGES_DLL
Definition export.h:23