VR-Engage  2.2
Loading...
Searching...
No Matches
ammoLoadTime.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file ammoLoadTime.h
7//! \ingroup vreVrfobjparam
8//! \brief Ammunition loading time parameter definitions for VREngage
9//!
10//! This file defines the DtAmmoLoadTime class and DtAmmoLoadTimeList type,
11//! which store ammunition type names and their corresponding load times for weapons.
12//! These parameters enable realistic weapon reload timing in VREngage simulations.
13
14#pragma once
15
17
18#include <vrfutil/rwTemplatedList.h>
19
20#include <readerWriter/rwReal.h>
21
22namespace makVre
23{
24//! \brief Type identifier string for DtAmmoLoadTime class
25const char DtAmmoLoadTimeType[] = "DtAmmoLoadTime";
26
27//! \brief Ammunition loading time parameter class for VREngage weapons
28//!
29//! This class defines the loading time parameters for specific ammunition types
30//! used by weapons in VREngage. It allows for realistic simulation of weapon
31//! reloading times based on ammunition type, enhancing combat simulation fidelity.
32class VREVRFOBJPARAM_DLL DtAmmoLoadTime : public DtReaderWriter
33{
34public:
35 //! \brief Default constructor
36 //!
37 //! Creates a new ammunition loading time parameter with default values.
39
40 //! \brief Constructor with ammunition name
41 //! \param name The name of the ammunition type
42 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
43 //!
44 //! Creates a new ammunition loading time parameter for the specified ammunition type.
45 DtAmmoLoadTime(const DtString& name, DtReaderWriterRegistry* const parentRegistry = NULL);
46
47 //! \brief Constructor with ammunition name as symbol string
48 //! \param name The name of the ammunition type as a symbol string
49 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
50 //!
51 //! Creates a new ammunition loading time parameter for the specified ammunition type.
52 DtAmmoLoadTime(const DtSymbolString& name, DtReaderWriterRegistry* const parentRegistry = NULL);
53
54 //! \brief Virtual destructor
55 //!
56 //! Cleans up resources used by the ammunition loading time parameter.
57 virtual ~DtAmmoLoadTime() override;
58
59 //! \brief Copy constructor
60 //! \param orig The source object to copy from
61 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
62 //!
63 //! Creates a new ammunition loading time parameter as a copy of the provided original.
64 DtAmmoLoadTime(const DtAmmoLoadTime& orig, DtReaderWriterRegistry* const parentRegistry = NULL);
65
66 //! \brief Assignment operator
67 //! \param orig The source object to copy from
68 //! \return Reference to this object after assignment
69 //!
70 //! Assigns the contents of the provided ammunition loading time parameter to this one.
72
73 //! \brief Creates a clone of this object
74 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
75 //! \return Pointer to a new object that is a clone of this one
76 //!
77 //! Creates a new ammunition loading time parameter as a deep copy of this one.
78 virtual DtAmmoLoadTime* clone(DtReaderWriterRegistry* parentRegistry = NULL) const;
79
80 //! \brief Sets the ammunition name
81 //! \param name The name of the ammunition type
82 //!
83 //! Sets the name that identifies this ammunition type.
84 virtual void setAmmoType(const DtEntityType& name);
85
86 //! \brief Gets the ammunition name
87 //! \return Reference to the ammunition name string
88 //!
89 //! Gets the name that identifies this ammunition type.
90 virtual const DtEntityType& ammoType() const;
91
92 //! \brief Sets the ammunition loading time
93 //! \param time The loading time in seconds
94 //!
95 //! Sets the time required to load this ammunition type into a weapon.
96 virtual void setLoadTime(double time);
97
98 //! \brief Gets the ammunition loading time
99 //! \return The loading time in seconds
100 //!
101 //! Gets the time required to load this ammunition type into a weapon.
102 virtual double loadTime() const;
103
104 /*virtual char* encode(char*) const;
105 virtual const char* decode(const char*);
106 virtual int getSize() const;*/
107
108 //! \brief Gets the reader/writer type identifier
109 //! \return String identifying this reader/writer type
110 //!
111 //! Returns the type identifier for this reader/writer class.
112 virtual const char* readerWriterType() const override;
113
114 //! \brief Gets the XML type identifier
115 //! \return String identifying this type in XML archives
116 //!
117 //! Returns the type identifier used when archiving to an XML stream.
118 static const char* theXmlType();
119
120 //! \brief Gets the XML type identifier for this instance
121 //! \return String identifying this type in XML archives
122 //!
123 //! Returns the type identifier used when archiving this instance to an XML stream.
124 virtual const char* xmlType() const override { return theXmlType(); }
125
126protected:
127 //! \brief The ammunition type name
128 //!
129 //! Stores the name that identifies this ammunition type.
130 DtRwEntityType myAmmoType;
131
132 //! \brief The ammunition loading time in seconds
133 //!
134 //! Stores the time required to load this ammunition type into a weapon.
135 DtRwReal myLoadTime;
136};
137
138//! \brief List of ammunition loading time parameters
139//!
140//! A templated list of ammunition loading time parameters for managing
141//! multiple ammunition types and their loading times for a weapon system.
142using DtAmmoLoadTimeList = DtRwTemplatedListPtr<DtAmmoLoadTime, true>;
143} // namespace makVre
144
145/*namespace DtBufferSerialize
146{
147 //! \return The number of bytes required to encode the specified spawn data.
148 //! \note Passing in a null set data request pointer is valid.
149 VREVRFOBJPARAM_DLL int getSize(const makVre::DtAmmoLoadTime& info);
150
151 //! Encodes the specified spawn data into the specified character array.
152 //! \return The pointer for buffer following the serialization.
153 //! This value may be passed into the next call to encode().
154 //! \note Passing in a null set data request pointer is valid.
155 VREVRFOBJPARAM_DLL char* encode(const makVre::DtAmmoLoadTime& info, char* buffer);
156
157 //! Decodes the buffer into the spawn data.
158 //! \return The pointer to buffer after the decode. This is appropriate to
159 //! pass into the next call of decode().
160 VREVRFOBJPARAM_DLL const char* decode(makVre::DtAmmoLoadTime& info, const char* buffer);
161}*/
virtual DtAmmoLoadTime * clone(DtReaderWriterRegistry *parentRegistry=NULL) const
Creates a clone of this object.
virtual const DtEntityType & ammoType() const
Gets the ammunition name.
DtAmmoLoadTime()
Default constructor.
virtual double loadTime() const
Gets the ammunition loading time.
static const char * theXmlType()
Gets the XML type identifier.
virtual const char * readerWriterType() const override
Gets the reader/writer type identifier.
DtAmmoLoadTime(const DtAmmoLoadTime &orig, DtReaderWriterRegistry *const parentRegistry=NULL)
Copy constructor.
DtAmmoLoadTime(const DtSymbolString &name, DtReaderWriterRegistry *const parentRegistry=NULL)
Constructor with ammunition name as symbol string.
DtAmmoLoadTime & operator=(const DtAmmoLoadTime &orig)
Assignment operator.
virtual const char * xmlType() const override
Gets the XML type identifier for this instance.
Definition ammoLoadTime.h:124
DtRwEntityType myAmmoType
The ammunition type name.
Definition ammoLoadTime.h:130
DtRwReal myLoadTime
The ammunition loading time in seconds.
Definition ammoLoadTime.h:135
virtual void setLoadTime(double time)
Sets the ammunition loading time.
virtual ~DtAmmoLoadTime() override
Virtual destructor.
DtAmmoLoadTime(const DtString &name, DtReaderWriterRegistry *const parentRegistry=NULL)
Constructor with ammunition name.
virtual void setAmmoType(const DtEntityType &name)
Sets the ammunition name.
Export macros for the VREngage Object Parameter library.
#define VREVRFOBJPARAM_DLL
Platform-specific DLL export/import declaration.
Definition export.h:27
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
DtRwTemplatedListPtr< DtAmmoLoadTime, true > DtAmmoLoadTimeList
List of ammunition loading time parameters.
Definition ammoLoadTime.h:142
const char DtAmmoLoadTimeType[]
Type identifier string for DtAmmoLoadTime class.
Definition ammoLoadTime.h:25