VR-Engage  2.2
Loading...
Searching...
No Matches
vreOccupancyDirectorController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreOccupancyDirectorController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for managing entity embarkation and occupancy
9//!
10//! This file defines the DtVreOccupancyDirectorController class which extends
11//! the occupancy director controller to provide VR-Engage specific functionality
12//! for managing embarkation slots, entity roles, and ingress/egress points.
13//! It handles information requests about embarkation possibilities and manages
14//! slot assignments for entities.
15
16#pragma once
17
18#include "vreVrfmodel/export.h"
20
23
24#include <vrfmodel/occupancyDirectorController.h>
25
26namespace makVre
27{
28//! \brief Type identifier for the VRE occupancy director controller component
29const char DtVreOccupancyDirectorControllerType[] = "vre-occupancy-director-controller";
30
31//! \brief Controller for managing entity embarkation and occupancy within vehicles
32//!
33//! DtVreOccupancyDirectorController extends the base occupancy director to provide
34//! VR-Engage specific functionality for managing embarkation slots and entity roles.
35//! It handles entity embarkation requests, manages slot assignments, and provides
36//! information about available ingress/egress points and actions.
37//!
38//! This controller is particularly useful for managing complex vehicles with multiple
39//! occupancy positions, each with potentially different roles, such as driver, gunner,
40//! commander, or passengers. It supports both scripted and interactive embarkation/disembarkation.
41//!
42//! Uses Descriptor Type: DtOccupancyDirectorControllerDescriptor
43class VREVRFMODEL_DLL DtVreOccupancyDirectorController : public DtVreSimComponent<DtOccupancyDirectorController>
44{
45public:
46 //! \brief Constructor
47 //! \param name The name of this component
48 //! \param owner The local object that owns this component
49 //! \param simManager The simulation services manager
50 //! \param desc Component descriptor with configuration parameters
51 //! \param parentRegistry Optional parent registry for reader/writer functionality
52 //!
53 //! Creates a new occupancy director controller component with the specified parameters.
54 //! Initializes the embarkation slot management and message handling functionality.
55 DtVreOccupancyDirectorController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
56 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
57
58 //! \brief Virtual destructor
59 //!
60 //! Cleans up resources used by the occupancy director controller component.
62
63 //! \brief Gets the type identifier for this component
64 //! \return String identifying the component type (DtVreOccupancyDirectorControllerType)
65 //!
66 //! Implements the DtSimComponent::type() method to return the
67 //! type identifier for this component.
68 virtual const char* type() const override;
69
70 //! \brief Factory method to create a new instance of this component
71 //! \param name The name for the new component
72 //! \param owner The local object that will own this component
73 //! \param simManager The simulation services manager
74 //! \param desc Optional component descriptor
75 //! \param parentRegistry Optional parent registry for reader/writer functionality
76 //! \return Pointer to the newly created component
77 //!
78 //! Static factory method used by the component creation system to instantiate
79 //! new instances of this component type.
80 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
81 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
82
83protected:
84 //! \brief Reserves an embarkation slot for an entity
85 //! \param entry Information about the embarkation slot to reserve
86 //! \param uuid UUID of the entity reserving the slot
87 //! \return True if the slot was successfully reserved, false otherwise
88 //!
89 //! Extends the base class reserveSlot to assign the slot-defined role name to the
90 //! entity (typically a human player) when embarking. This allows proper role assignment
91 //! for entity appearance and functionality within the vehicle.
92 virtual bool reserveSlot(const DtEmbarkationSlotInformation& entry, const DtUUID& uuid) override;
93 //! \brief Releases a previously reserved embarkation slot
94 //! \param iSlot Index of the slot to release
95 //! \param name UUID of the entity giving up the slot
96 //!
97 //! Releases a previously reserved embarkation slot, making it available for other
98 //! entities to occupy. Also handles any role changes needed when the entity
99 //! disembarks from the vehicle.
100 virtual void giveUpSlot(int iSlot, const DtUUID& name) override;
101
102 //! \brief Handles entity embarkation information request messages
103 //! \param msg The message containing the embarkation information request
104 //! \return Message processing result indicating success or failure
105 //!
106 //! Processes messages requesting information about embarkation possibilities
107 //! for a specific entity. Generates and returns information about available
108 //! slots, ingress points, and associated actions.
110
111 //! \brief Generates a list of actionable points for an embarked entity
112 //! \param forType The entity type to generate action points for
113 //! \param actionPoints Output vector to be filled with generated action points
114 //!
115 //! Generates a list of actionable points for an entity that is already embarked
116 //! in the vehicle. Points can be either unoccupied slots (for changing positions)
117 //! or egress points that map to a slot with a defined egressTechnique.
118 //!
119 //! The egressTechnique string should be a script task name that opens the appropriate
120 //! door for disembarkation. The egress point used is the first point in the route.
122 const DtEntityType& forType, std::vector<EntityEmbarkationInformationMessage::ActionPoint>& actionPoints);
123
124 //! \brief Generates a list of actionable points for an entity wishing to embark
125 //! \param forType The entity type to generate action points for
126 //! \param actionPoints Output vector to be filled with generated action points
127 //! \return True if applicable points exist (even if all occupied), false if no points exist for the entity type
128 //!
129 //! Generates a list of actionable points for entities of the given type that wish
130 //! to embark on the vehicle. Points are ingress points that either map to a single slot,
131 //! or map to more than one slot where at least one slot defines an ingressTechnique.
132 //!
133 //! The ingressTechnique string should be a script task name that opens the appropriate
134 //! door for embarkation. The egress point used is the last point in the route.
135 //!
136 //! Returns true if points were found, although the list may be empty if all are occupied.
137 //! Returns false if no points exist for the given entity type.
139 const DtEntityType& forType, std::vector<EntityEmbarkationInformationMessage::ActionPoint>& actionPoints);
140};
141
142} // namespace makVre
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
virtual bool generateUnembarkedActionPoints(const DtEntityType &forType, std::vector< EntityEmbarkationInformationMessage::ActionPoint > &actionPoints)
Generates a list of actionable points for an entity wishing to embark.
virtual void generateEmbarkedActionPoints(const DtEntityType &forType, std::vector< EntityEmbarkationInformationMessage::ActionPoint > &actionPoints)
Generates a list of actionable points for an embarked entity.
virtual void giveUpSlot(int iSlot, const DtUUID &name) override
Releases a previously reserved embarkation slot.
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Factory method to create a new instance of this component.
virtual ~DtVreOccupancyDirectorController() override
Virtual destructor.
DtVreOccupancyDirectorController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual bool reserveSlot(const DtEmbarkationSlotInformation &entry, const DtUUID &uuid) override
Reserves an embarkation slot for an entity.
virtual makVre::DtVreMessageResult handleEntityEmbarkationInformationRequestMessage(makVre::DtVreMessage *msg)
Handles entity embarkation information request messages.
virtual const char * type() const override
Gets the type identifier for this component.
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:54
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtVreOccupancyDirectorControllerType[]
Type identifier for the VRE occupancy director controller component.
Definition vreOccupancyDirectorController.h:29
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the base class for all VREngage messages.
Base template class for VR-Engage simulation components.