VR-Engage  2.2
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
19//! \brief Current version of the assign role player message
21
22//! \brief Interface message for assigning role players to entities
23//!
24//! Instances of DtIfAssignRolePlayer messages are sent out by a VRF GUI
25//! application to assign a player to an entity at a particular VREngage station.
26//! This message includes information about the player's station/role, the entity
27//! to control, and viewing mode settings.
28
29class VRFMESSAGES_DLL DtIfAssignRolePlayer : public DtSimInterfaceContent
30{
31public:
32 //! \brief Default constructor
33 //!
34 //! Initializes an empty assign role player message.
36
37 //! \brief Virtual destructor
38 virtual ~DtIfAssignRolePlayer() override;
39
40 //! \brief Copy constructor
41 //! \param orig The assign role player message to copy from
42 //!
43 //! Creates a new assign role player message by copying an existing one.
45
46 //! \brief Assignment operator
47 //! \param orig The assign role player message to copy from
48 //! \return Reference to this object after assignment
49 //!
50 //! Copies the contents of another assign role player message into this one.
52
53 //! \brief Gets the interface message type
54 //! \return The message type identifier
55 //!
56 //! Returns DtAssignRolePlayerMessageType as defined in vreVrfMessageTypes.h.
57 virtual int type() const override;
58
59 //! \brief Creates a copy of this message
60 //! \return Pointer to the new copy
61 //!
62 //! Creates a dynamically allocated copy of this message.
63 virtual DtSimInterfaceContent* clone() const override;
64
65 //! \brief Sets the identifier of the VREngage application
66 //! \param id The unique identifier to set
67 //!
68 //! Sets the unique identifier for the VREngage application.
69 //! This must be unique across all VREngage stations in an exercise
70 //! and must not change over the lifetime of the application.
71 virtual void setId(unsigned long id);
72
73 //! \brief Gets the identifier of the VREngage application
74 //! \return The VREngage application identifier
75 virtual unsigned long id() const;
76
77 //! \brief Sets the UUID of the entity to be controlled
78 //! \param uuid The entity UUID to set
79 //!
80 //! Sets the UUID of the entity to be controlled at the VREngage station.
81 virtual void setUUID(const DtString& uuid);
82
83 //! \brief Gets the UUID of the entity to be controlled
84 //! \return The entity UUID
85 virtual DtString uuid() const;
86
87 //! \brief Sets the station/role name for the player
88 //! \param name The station name to set
89 //!
90 //! Sets the station name (role) to be assumed by the player at the VREngage station.
91 //! Available string identifiers for roles are defined in the .entity file.
92 virtual void setStationName(const DtString& name);
93
94 //! \brief Gets the station/role name for the player
95 //! \return The station name
96 virtual DtString stationName() const;
97
98 //! \brief Sets the spectator mode flag
99 //! \param mode True for spectator mode, false for active player mode
100 //!
101 //! Sets whether the player at the VREngage station is in spectator mode.
102 //! In spectator mode, the player can observe but not interact with the entity.
103 virtual void setSpectatorMode(bool mode);
104
105 //! \brief Gets the spectator mode flag
106 //! \return True if in spectator mode, false otherwise
107 virtual bool spectatorMode() const;
108
109 //! \brief Gets the network representation size
110 //! \return Size in bytes of the network representation
111 //!
112 //! Returns the size of the network buffer needed to store this message.
113 virtual int netRepSize() const override;
114
115 //! \brief Deserializes the message from a network buffer
116 //! \param contentBuffer Pointer to the network buffer
117 //! \param contentSize Size of the buffer in bytes
118 //! \return True if deserialization was successful
119 //!
120 //! Fills the message from the provided network buffer.
121 virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
122
123 //! \brief Serializes the message for network transmission
124 //! \return True if serialization was successful
125 //!
126 //! Prepares the message for network transmission.
127 virtual bool setToNet() override;
128
129 //! \brief Formats the message data as a string
130 //! \param str String to store the formatted message data
131 //!
132 //! Appends a human-readable representation of the message to the provided string.
133 virtual void printDataToString(DtString& str) override;
134
135 //! \brief Static creator function for factory registration
136 //! \return Pointer to a new instance of DtIfAssignRolePlayer
137 //!
138 //! This static function is used for registration with DtInterfaceContentFactory.
139 static DtSimInterfaceContent* creator();
140
141
142protected:
143 //! \brief Version information for the message
144 //!
145 //! The high word is a signal that the version exists, and the
146 //! low word is the actual version. If this information does not exist,
147 //! it is assumed to be an older status message.
149
150 //! \brief Unique identifier for the VREngage application
151 //!
152 //! Must be unique across all VREngage stations in an exercise
153 //! and must not change over the lifetime of the application.
154 DtU64 myId;
155
156 //! \brief UUID of the entity to be controlled
157 DtString myUUID;
158
159 //! \brief Station/role name for the player
160 //!
161 //! Station name to be assumed by the player at the VREngage station
162 //! (defined in the .entity file).
164
165 //! \brief Flag indicating whether player is in spectator mode
166 //!
167 //! When true, the player can observe but not interact with the entity.
169};
DtString myUUID
UUID of the entity to be controlled.
Definition ifAssignRolePlayer.h:157
virtual int type() const override
Gets the interface message type.
bool mySpectatorMode
Flag indicating whether player is in spectator mode.
Definition ifAssignRolePlayer.h:168
DtString myStationName
Station/role name for the player.
Definition ifAssignRolePlayer.h:163
virtual DtString uuid() const
Gets the UUID of the entity to be controlled.
DtIfAssignRolePlayer()
Default constructor.
virtual void setId(unsigned long 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.
DtIfAssignRolePlayer(const DtIfAssignRolePlayer &orig)
Copy constructor.
virtual void setUUID(const DtString &uuid)
Sets the UUID of the entity to be controlled.
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.
virtual unsigned long id() const
Gets the identifier of the VREngage application.
DtU32 myVersion
Version information for the message.
Definition ifAssignRolePlayer.h:148
virtual void printDataToString(DtString &str) override
Formats the message data as a string.
DtU64 myId
Unique identifier for the VREngage application.
Definition ifAssignRolePlayer.h:154
virtual void setSpectatorMode(bool mode)
Sets the spectator mode flag.
virtual ~DtIfAssignRolePlayer() override
Virtual destructor.
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:20
Export/import macros for the VRF Messages library.
#define VRFMESSAGES_DLL
Definition export.h:23