VR-Engage  2.2
Loading...
Searching...
No Matches
setVreEmbarkedRole.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file setVreEmbarkedRole.h
7//! \ingroup vreVrfMessages
8//! \brief Defines a request message for setting entity embarked roles
9//!
10//! This file contains the DtSetVreEmbarkedRoleRequest class which is used to
11//! save information about the role (gunner, driver, commander, etc.) that a
12//! VREngage station has embarked an entity as. This information is used to select
13//! the appropriate role when an Engage station (re)attaches to this entity.
14
15#pragma once
16
18#include <vrftasks/setDataRequest.h>
19#include <readerWriter/rwString.h>
20#include <vrftasks/radioMessageTypes.h>
21
22namespace makVre
23{
24//! \brief Class for storing entity embarked role information
25//!
26//! This class is used to save the role (gunner, driver, commander, passenger, etc.)
27//! which the VREngage station embarked the entity as. This information is used to select
28//! the correct role when a VREngage station (re)attaches to this entity and ensures
29//! consistent role assignment between sessions.
30
31//! \brief Message type identifier for embarked role settings
32//!
33//! DtSetPlayerStationControlledString must be a unique string representing the message type.
34//! Existing string types are defined in msgTypes.h.
35const DtSetMessageType DtSetVreEmbarkedRoleType("set-vre-embarked-role");
36
37//! \brief Request message for setting entity embarked roles
38//!
39//! This class provides a mechanism for setting and persisting information about
40//! the role a user has selected when embarking an entity. This ensures consistent
41//! role allocation when the same user reconnects to the simulation.
42class VRFMESSAGES_DLL DtSetVreEmbarkedRoleRequest : public DtSetDataRequest
43{
44public:
45 //! \brief Default constructor
46 //!
47 //! Initializes an empty embarked role request message.
49
50 //! \brief Constructor with write name
51 //! \param writeName The name to identify this request
52 //! \param parentRegistry Optional reader-writer registry for serialization
53 //!
54 //! If you have a request 'put' itself, the writeName will preface it.
55 DtSetVreEmbarkedRoleRequest(const DtString& writeName, DtReaderWriterRegistry* parentRegistry = 0);
56
57 //! \brief Copy constructor with new name
58 //! \param writeName The name to identify this request
59 //! \param orig The embarked role request to copy from
60 //! \param parentRegistry Optional reader-writer registry for serialization
61 //!
62 //! Creates a new embarked role request by copying an existing one.
64 const DtString& writeName, const DtSetVreEmbarkedRoleRequest& orig, DtReaderWriterRegistry* parentRegistry = 0);
65
66 //! \brief Assignment operator
67 //! \param orig The embarked role request to copy from
68 //! \return Reference to this object after assignment
69 //!
70 //! Copies the contents of another embarked role request into this one.
72
73 //! \brief Virtual destructor
74 virtual ~DtSetVreEmbarkedRoleRequest() override;
75
76 //! \brief Gets the request message type
77 //! \return The message type identifier
78 //!
79 //! Returns DtSetVreEmbarkedRoleType as defined in this file.
80 virtual const DtSetMessageType& type() const override;
81
82 //! \brief Creates a copy of this request
83 //! \param name The name to assign to the new request
84 //! \param parentRegistry Optional reader-writer registry for serialization
85 //! \return Pointer to the newly created request
86 //!
87 //! Creates a dynamically allocated copy of this request with a new name.
88 virtual DtSetDataRequest* clone(const DtString& name, DtReaderWriterRegistry* parentRegistry = 0) const override;
89
90 //! \brief Gets a readable string representation of this request
91 //! \return String representation of the request
92 //!
93 //! Returns a human-readable representation of the request contents.
94 virtual DtString stringRep() const override;
95
96 //! \brief Gets the role in which the entity was embarked
97 //! \return The embarked station/role name
98 //!
99 //! Returns the name of the role (e.g., "gunner", "driver", "commander") that
100 //! was used when embarking the entity.
101 virtual DtString engageEmbarkedStation() const;
102
103 //! \brief Sets the role in which the entity was embarked
104 //! \param station The embarked station/role name to set
105 //!
106 //! Sets the name of the role (e.g., "gunner", "driver", "commander") that
107 //! was used when embarking the entity.
108 virtual void setEngageEmbarkedStation(const DtString& station);
109
110 //! \brief Gets the network representation size
111 //! \return Size in bytes of the network representation
112 //!
113 //! Returns the size of the full network representation padded to an 8-byte boundary.
114 virtual int netRepSize() const override;
115
116 //! \brief Deserializes the request from a network buffer
117 //! \param contentBuffer Pointer to the network buffer
118 //! \param contentSize Size of the buffer in bytes
119 //! \return True if deserialization was successful
120 //!
121 //! Fills in the request from the provided network buffer.
122 virtual bool setFromNet(const char* contentBuffer, unsigned contentSize) override;
123
124 //! \brief Serializes the request for network transmission
125 //! \return True if serialization was successful
126 //!
127 //! Fills in the network buffer (created by base class setDataRequest) with
128 //! the set data request contents.
129 virtual bool setToNet() override;
130
131 //! \brief Static creator function for factory registration
132 //! \return Pointer to a new instance of DtSetVreEmbarkedRoleRequest
133 //!
134 //! This static function is used for registration with the message factory.
135 static DtSetDataRequest* creator();
136
137protected:
138 //! \brief The embarked station/role name
139 //!
140 //! Stores the name of the role (e.g., "gunner", "driver", "commander")
141 //! that was used when embarking the entity.
142 DtRwString myStation;
143};
144} // namespace makVre
virtual int netRepSize() const override
Gets the network representation size.
virtual const DtSetMessageType & type() const override
Gets the request message type.
static DtSetDataRequest * creator()
Static creator function for factory registration.
DtRwString myStation
The embarked station/role name.
Definition setVreEmbarkedRole.h:142
DtSetVreEmbarkedRoleRequest()
Default constructor.
const DtSetVreEmbarkedRoleRequest & operator=(const DtSetVreEmbarkedRoleRequest &orig)
Assignment operator.
virtual ~DtSetVreEmbarkedRoleRequest() override
Virtual destructor.
virtual bool setFromNet(const char *contentBuffer, unsigned contentSize) override
Deserializes the request from a network buffer.
virtual DtSetDataRequest * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=0) const override
Creates a copy of this request.
DtSetVreEmbarkedRoleRequest(const DtString &writeName, DtReaderWriterRegistry *parentRegistry=0)
Constructor with write name.
virtual DtString engageEmbarkedStation() const
Gets the role in which the entity was embarked.
virtual DtString stringRep() const override
Gets a readable string representation of this request.
virtual bool setToNet() override
Serializes the request for network transmission.
DtSetVreEmbarkedRoleRequest(const DtString &writeName, const DtSetVreEmbarkedRoleRequest &orig, DtReaderWriterRegistry *parentRegistry=0)
Copy constructor with new name.
virtual void setEngageEmbarkedStation(const DtString &station)
Sets the role in which the entity was embarked.
Export/import macros for the VRF Messages library.
#define VRFMESSAGES_DLL
Definition export.h:23
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const DtSetMessageType DtSetVreEmbarkedRoleType("set-vre-embarked-role")
Class for storing entity embarked role information.