VR-Engage  2.2
Loading...
Searching...
No Matches
vreLaunchExpendableResourceController.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreLaunchExpendableResourceController.h
7//! \ingroup vreVrfmodel
8//! \brief Controller for launching expendable resources
9//!
10//! This file defines the DtVreLaunchExpendableResourceController class which extends
11//! the base launch expendable resource controller to publish auto-launch state information
12//! and provide additional countermeasure management capabilities.
13
14#pragma once
15
16#include <vreVrfmodel/export.h>
17#include <vreVrfModel/vreSimComponent.h>
18
20
21#include <vrfmodel/launchExpendableResourceController.h>
22
23namespace makVre
24{
25//! \brief Type identifier for the VRE launch expendable resource controller component
26const char DtVreLaunchExpendableResourceControllerType[] = "vre-launch-expendable-resource-controller";
27
28//! \brief Controller for managing and deploying expendable resources
29//!
30//! DtVreLaunchExpendableResourceController extends the base launch controller to publish
31//! whether auto-launch capability is enabled. It manages countermeasures such as chaff
32//! and flares, tracks their counts, and handles deployment logic based on threats and
33//! configuration settings. This controller provides additional state information for
34//! VR-Engage user interfaces.
35//!
36//! Uses Descriptor Type: DtLaunchExpendableResourceControllerDescriptor
38 : public DtVreSimComponent<DtLaunchExpendableResourceController>
39{
40public:
41 //! \brief Constructor
42 //! \param name The name of this component
43 //! \param owner The local object that owns this component
44 //! \param simManager The simulation services manager
45 //! \param desc Component descriptor with configuration parameters
46 //! \param parentRegistry Optional parent registry for reader/writer functionality
47 //!
48 //! Creates a new launch expendable resource controller with the specified parameters.
49 DtVreLaunchExpendableResourceController(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
50 DtComponentDescriptor* desc = NULL, DtReaderWriterRegistry* parentRegistry = 0);
51
52 //! \brief Virtual destructor
53 //!
54 //! Cleans up resources used by the launch expendable resource controller.
56
57 //! \brief Gets the type identifier for this component
58 //! \return String identifying the component type (DtVreLaunchExpendableResourceControllerType)
59 //!
60 //! Implements the DtSimComponent::type() method to return the
61 //! type identifier for this component.
62 virtual const char* type() const override;
63
64 //! \brief Copy constructor
65 //! \param orig The source object to copy from
66 //!
67 //! Creates a new controller as a copy of an existing one.
69
70 //! \brief Assignment operator
71 //! \param orig The source object to assign from
72 //! \return Reference to this object after assignment
73 //!
74 //! Assigns the state of another controller to this one.
76
77 //! \brief Handles countermeasure configuration request messages
78 //! \param msg The message containing configuration parameters
79 //! \return Message processing result indicating success or failure
80 //!
81 //! Processes countermeasure configuration request messages, which can
82 //! include settings for auto-launch capability and other countermeasure
83 //! deployment parameters.
85
86 //! \brief Performs initialization before the first simulation tick
87 //!
88 //! Overridden to set auto-launch on/off state as extended data.
89 //! This ensures that the auto-launch capability state is properly
90 //! initialized and published before simulation begins.
91 virtual void preFirstTickInit() override;
92 //! \brief Updates the controller state each simulation frame
93 //!
94 //! Processes expendable resource management operations during each simulation frame.
95 //! This includes checking for threats that might trigger automatic countermeasure
96 //! deployment and updating counters for available countermeasures.
97 virtual void tick() override;
98
99 //! \brief Initializes the launch expendable resource controller
100 //! \return True if initialization is successful, false otherwise
101 //!
102 //! Performs initial setup of the controller, including setting up
103 //! initial countermeasure counts and auto-launch state. This method
104 //! is called during component initialization.
105 virtual bool init() override;
106
107 //! \brief Factory method to create a new instance of this component
108 //! \param name The name for the new component
109 //! \param owner The local object that will own this component
110 //! \param simManager The simulation services manager
111 //! \param desc Component descriptor with configuration parameters
112 //! \param parentRegistry Optional parent registry for reader/writer functionality
113 //! \return Pointer to the newly created component
114 //!
115 //! Static factory method used by the component creation system to instantiate
116 //! new instances of this component type.
117 static DtSimComponent* creator(const DtString& name, DtLocalObject* owner, DtSimulationServices* simManager,
118 DtComponentDescriptor* desc, DtReaderWriterRegistry* parentRegistry);
119
120protected:
121 //! \brief Sends countermeasure state update to clients
122 //!
123 //! Updates relevant systems with the current countermeasure configuration
124 //! and state information. This includes auto-launch status and available
125 //! countermeasure counts, allowing user interfaces and other components
126 //! to display accurate information.
127 virtual void sendCmUpdate();
128
129 //! \brief Looks up resources by old resource style name string and converts to entity type
130 virtual DtSimResource* lookupExpendableResource(const DtString& resourceName, int& quantity);
131
132protected:
133 //! \brief Flag indicating whether automatic countermeasure launch is enabled
134 //!
135 //! When true, indicates that the system will automatically deploy countermeasures
136 //! in response to detected threats without requiring explicit user action.
138
139 //! \brief Current count of available chaff countermeasures
140 //!
141 //! Tracks the number of chaff countermeasures available for deployment.
142 //! Chaff is typically used to counter radar-guided threats.
144
145 //! \brief Current count of available flare countermeasures
146 //!
147 //! Tracks the number of flare countermeasures available for deployment.
148 //! Flares are typically used to counter infrared-guided threats.
150};
151
152} // namespace makVre
int myFlareCount
Current count of available flare countermeasures.
Definition vreLaunchExpendableResourceController.h:149
bool myAutoLaunchEnabled
Flag indicating whether automatic countermeasure launch is enabled.
Definition vreLaunchExpendableResourceController.h:137
int myChaffCount
Current count of available chaff countermeasures.
Definition vreLaunchExpendableResourceController.h:143
DtVreLaunchExpendableResourceController & operator=(const DtVreLaunchExpendableResourceController &orig)
Assignment operator.
virtual const char * type() const override
Gets the type identifier for this component.
virtual DtVreMessageResult handleCmConfigRequest(DtVreMessage *msg)
Handles countermeasure configuration request messages.
virtual void tick() override
Updates the controller state each simulation frame.
DtVreLaunchExpendableResourceController(const DtVreLaunchExpendableResourceController &orig)
Copy constructor.
virtual bool init() override
Initializes the launch expendable resource controller.
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc, DtReaderWriterRegistry *parentRegistry)
Factory method to create a new instance of this component.
DtVreLaunchExpendableResourceController(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=NULL, DtReaderWriterRegistry *parentRegistry=0)
Constructor.
virtual void sendCmUpdate()
Sends countermeasure state update to clients.
virtual DtSimResource * lookupExpendableResource(const DtString &resourceName, int &quantity)
Looks up resources by old resource style name string and converts to entity type.
virtual void preFirstTickInit() override
Performs initialization before the first simulation tick.
virtual ~DtVreLaunchExpendableResourceController() override
Virtual destructor.
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
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 DtVreLaunchExpendableResourceControllerType[]
Type identifier for the VRE launch expendable resource controller component.
Definition vreLaunchExpendableResourceController.h:26
DtVreMessageResult
Enumeration of possible message handling results.
Definition vreMessage.h:33
Defines the base class for all VREngage messages.