VR-Engage  2.2
Loading...
Searching...
No Matches
vreLauncherController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies, Inc.
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreLauncherController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for missile launcher systems
9//!
10//! This file defines the DtVreLauncherController class which extends
11//! the base launcher controller to add VR-Engage specific functionality,
12//! including equipment status tracking and resource management.
13
14#pragma once
15
16#include "vreVrfmodel/export.h"
18
19#include <vrfmodel/launcherController.h>
20
21class DtSimResource;
22
23namespace makVre
24{
25//! \brief Type identifier for the VRE launcher controller component
26const char* DtVreLauncherControllerType = "vre-missile-launcher-controller";
27
29
30//! \brief Controller for missile launcher systems with equipment status tracking
31//!
32//! DtVreLauncherController extends the base launcher controller to add
33//! equipment status monitoring functionality. It tracks the state of
34//! associated equipment resources and updates weapon availability based
35//! on the equipment status. This allows for disabling missile systems
36//! when the associated equipment is damaged or unavailable.
37class VREVRFMODEL_DLL DtVreLauncherController : public DtVreSimComponent<DtLauncherController>
38{
39public:
40 //! \brief Constructor
41 //! \param name The name of this component
42 //! \param owner The local object that owns this component
43 //! \param simManager The simulation services manager
44 //! \param desc Component descriptor with configuration parameters
45 //! \param parentRegistry Optional parent registry for reader/writer functionality
46 //!
47 //! Creates a new launcher controller component with the specified parameters.
48 DtVreLauncherController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
49 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
50
51 //! \brief Virtual destructor
52 //!
53 //! Cleans up resources used by the launcher controller component.
54 virtual ~DtVreLauncherController() override;
55
56 //! \brief Default constructor (deleted)
57 //!
58 //! Default constructor is deleted to prevent creation of instances
59 //! without proper initialization.
61
62 //! \brief Copy constructor (deleted)
63 //!
64 //! Copy constructor is deleted to prevent copy construction.
66
67 //! \brief Assignment operator (deleted)
68 //! \return Reference to this object
69 //!
70 //! Assignment operator is deleted to prevent assignment.
72
73 //! \brief Gets the type identifier for this component
74 //! \return String identifying the component type (DtVreLauncherControllerType)
75 //!
76 //! Implements the DtSimComponent::type() method to return the
77 //! type identifier for this component.
78 virtual const char* type() const override;
79
80 //! \brief Updates the controller state each simulation frame
81 //!
82 //! Checks myEquipmentResource. If it's null, attempts to look it up and cache it,
83 //! which will happen after a reset. If myEquipmentResource is non-null, updates
84 //! the DtWeaponComponentInterface::DT_WEAPON_DISABLED flag based on whether or not
85 //! the value of this resource is non-zero. This allows the weapon system to be
86 //! disabled when the associated equipment is damaged or unavailable.
87 virtual void tick() override;
88
89 //! \brief Factory method to create a new instance of this component
90 //! \param name The name for the new component
91 //! \param owner The local object that will own this component
92 //! \param simManager The simulation services manager
93 //! \param desc Optional component descriptor
94 //! \param parentRegistry Optional parent registry for reader/writer functionality
95 //! \return Pointer to the newly created component
96 //!
97 //! Static factory method used by the component creation system to instantiate
98 //! new instances of this component type.
99 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
100 DtComponentDescriptor* desc = 0, DtReaderWriterRegistry* parentRegistry = 0);
101
102 //! \brief Handles component restoration
103 //!
104 //! Called whenever a component is restored from a saved state.
105 //! Sets myEquipmentResource to null, forcing it to be looked up
106 //! again on the next tick. This ensures proper initialization
107 //! after scenario restoration.
108 virtual void onRestore() override;
109
110protected:
111 //! \brief Performs initialization before the first simulation tick
112 //!
113 //! Initializes the myMissileSimObjectFacadeMap and performs other
114 //! one-time initialization tasks that must be completed before the
115 //! first simulation tick occurs.
116 virtual void preFirstTickInit() override;
117
118protected:
119 //! \brief Pointer to the equipment resource being monitored
120 //!
121 //! Stores a reference to the equipment resource that affects the availability
122 //! of this launcher system. When this resource value becomes zero (indicating
123 //! damaged or unavailable equipment), the launcher is disabled.
124 DtSimResource* myEquipmentResource;
125
126private:
127 //! \brief Looks up the appropriate equipment resource
128 //! \return Pointer to the equipment resource, or nullptr if not found
129 //!
130 //! Searches for and returns a pointer to the equipment resource that
131 //! affects this launcher's availability. This method is called when
132 //! the resource pointer is null, typically after initialization or reset.
133 virtual DtSimResource* lookupEquipmentResource();
134};
135} // namespace makVre
virtual void onRestore() override
Handles component restoration.
virtual void tick() override
Updates the controller state each simulation frame.
virtual void preFirstTickInit() override
Performs initialization before the first simulation tick.
virtual DtSimResource * lookupEquipmentResource()
Looks up the appropriate equipment resource.
const DtVreLauncherController & operator=(const DtVreLauncherController &orig)=delete
Assignment operator (deleted)
virtual const char * type() const override
Gets the type identifier for this component.
DtVreLauncherController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual ~DtVreLauncherController() override
Virtual destructor.
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.
DtVreLauncherController(const DtVreLauncherController &orig)=delete
Copy constructor (deleted)
DtVreLauncherController()=delete
Default constructor (deleted)
DtSimResource * myEquipmentResource
Pointer to the equipment resource being monitored.
Definition vreLauncherController.h:124
DtVreSimComponent(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
Definition vreSimComponent.h:54
Weapon controller descriptor for VREngage.
Definition vreWeaponControllerDescriptor.h:34
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 * DtVreLauncherControllerType
Type identifier for the VRE launcher controller component.
Definition vreLauncherController.h:26
Base template class for VR-Engage simulation components.