WSF
WsfVariable< T > Class Template Reference

#include <WsfVariable.hpp>

Inheritance diagram for WsfVariable< T >:
Collaboration diagram for WsfVariable< T >:

Public Member Functions

 WsfVariable ()=default
 WsfVariable (const T &aInitialValue)
 WsfVariable (const WsfVariable< T > &)=default
 operator T () const
GetValue () const
WsfVariable< T > & operator= (const T &aRhs)
WsfVariable< T > & operator= (const WsfVariable< T > &aRhs)
operator+ (const T &aRhs) const
operator- (const T &aRhs) const
T & operator+= (const T &aRhs)
T & operator-= (const T &aRhs)
bool Initialize (const std::string &aName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, WsfScriptContext &aGlobalContext)
void ReadValue (UtInput &aInput)
 Read a non-unitary value from an input stream.
void ReadValueOfType (UtInput &aInput, UtInput::ValueType aType)
 Read a unitary value from an input stream.
void ValueInClosedRange (UtInput &aInput, T aMinValue, T aMaxValue)
void ValueGreater (UtInput &aInput, T aMinValue)
void ValueGreaterOrEqual (UtInput &aInput, T aMinValue)
void ValueLess (UtInput &aInput, T aMaxValue)
void ValueLessOrEqual (UtInput &aInput, T aMaxValue)
Public Member Functions inherited from WsfVariableBase
 WsfVariableBase ()
bool HasDefaultValue () const
 Has a default value been defined for a reference.
bool IsReference () const
 Is the variable a reference to a script variable?

Additional Inherited Members

Protected Member Functions inherited from WsfVariableBase
bool DefaultOptionPresent (UtInput &aInput)
 Determine if the '/default' option is present.
std::string ObjectName (WsfComponent *aObjectPtr)
 Return the name of the object for messages.
bool ReadReference (UtInput &aInput)
bool ResolveReference (const std::string &aVariableName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, const UtScriptData *&aRefValuePtr, WsfScriptContext &aGlobalContext)
bool Initialize (const std::string &aName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, WsfStringId &aValue, WsfScriptContext &aGlobalContext)
void ReadValue (UtInput &aInput, WsfStringId &aValue)
bool Initialize (const std::string &aName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, double &aValue, WsfScriptContext &aGlobalContext)
void ReadValue (UtInput &aInput, double &aValue)
void ReadValueOfType (UtInput &aInput, UtInput::ValueType aType, double &aValue)
bool Initialize (const std::string &aName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, float &aValue, WsfScriptContext &aGlobalContext)
void ReadValue (UtInput &aInput, float &aValue)
void ReadValueOfType (UtInput &aInput, UtInput::ValueType aType, float &aValue)
bool Initialize (const std::string &aName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, int &aValue, WsfScriptContext &aGlobalContext)
void ReadValue (UtInput &aInput, int &aValue)
void ReadValueOfType (UtInput &aInput, UtInput::ValueType aType, int &aValue)
bool Initialize (const std::string &aName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, bool &aValue, WsfScriptContext &aGlobalContext)
void ReadValue (UtInput &aInput, bool &aValue)
bool Initialize (const std::string &aName, WsfComponent *aObjectPtr, WsfScriptContext *aContextPtr, std::string &aValue, WsfScriptContext &aGlobalContext)
void ReadValue (UtInput &aInput, std::string &aValue)
WsfStringId mRefVarNameId
 The name (ID) of the referenced variable. It is less than zero if the variable is not a reference.
bool mHasDefaultValue
 'true' if the '/default' option was provided

Detailed Description

template<typename T>
class WsfVariable< T >

A template that defines a variable of a specific type.

This template is primarily for numeric types.

Constructor & Destructor Documentation

◆ WsfVariable() [1/3]

template<typename T>
WsfVariable< T >::WsfVariable ( )
default

Referenced by operator=(), operator=(), and WsfVariable().

◆ WsfVariable() [2/3]

template<typename T>
WsfVariable< T >::WsfVariable ( const T & aInitialValue)
inline

◆ WsfVariable() [3/3]

template<typename T>
WsfVariable< T >::WsfVariable ( const WsfVariable< T > & )
default

References WsfVariable().

Member Function Documentation

◆ GetValue()

template<typename T>
T WsfVariable< T >::GetValue ( ) const
inline

◆ Initialize()

template<typename T>
bool WsfVariable< T >::Initialize ( const std::string & aName,
WsfComponent * aObjectPtr,
WsfScriptContext * aContextPtr,
WsfScriptContext & aGlobalContext )
inline

Initialize the variable.

Returns
'true' if successful, 'false' if not.

References WsfVariableBase::Initialize().

Referenced by WsfWeaponPlatformExtension::GetWeaponEffectsType().

◆ operator T()

template<typename T>
WsfVariable< T >::operator T ( ) const
inline

Return the fixed or resolved value of the variable.

Note
: This should not be called until after Initialize is called.

◆ operator+()

template<typename T>
T WsfVariable< T >::operator+ ( const T & aRhs) const
inline

◆ operator+=()

template<typename T>
T & WsfVariable< T >::operator+= ( const T & aRhs)
inline

◆ operator-()

template<typename T>
T WsfVariable< T >::operator- ( const T & aRhs) const
inline

◆ operator-=()

template<typename T>
T & WsfVariable< T >::operator-= ( const T & aRhs)
inline

◆ operator=() [1/2]

template<typename T>
WsfVariable< T > & WsfVariable< T >::operator= ( const T & aRhs)
inline

◆ operator=() [2/2]

template<typename T>
WsfVariable< T > & WsfVariable< T >::operator= ( const WsfVariable< T > & aRhs)
inline

◆ ReadValue()

template<typename T>
void WsfVariable< T >::ReadValue ( UtInput & aInput)
inline

Read a non-unitary value from an input stream.

References WsfVariableBase::ReadValue().

◆ ReadValueOfType()

template<typename T>
void WsfVariable< T >::ReadValueOfType ( UtInput & aInput,
UtInput::ValueType aType )
inline

Read a unitary value from an input stream.

References WsfVariableBase::ReadValueOfType().

Referenced by WsfRandomVariable::ProcessInput(), and WsfScriptContext::ProcessInput().

◆ ValueGreater()

template<typename T>
void WsfVariable< T >::ValueGreater ( UtInput & aInput,
T aMinValue )
inline

Interface to UtInput::ValueGreater. This checks a static or default value to see if it is valid. Nothing is done for a pure reference.

References WsfVariableBase::HasDefaultValue(), and WsfVariableBase::IsReference().

Referenced by WsfRandomVariable::ProcessInput(), and WsfScriptContext::ProcessInput().

◆ ValueGreaterOrEqual()

template<typename T>
void WsfVariable< T >::ValueGreaterOrEqual ( UtInput & aInput,
T aMinValue )
inline

Interface to UtInput::ValueGreaterOrEqual. This checks a static or default value to see if it is valid. Nothing is done for a pure reference.

References WsfVariableBase::HasDefaultValue(), and WsfVariableBase::IsReference().

Referenced by WsfRandomVariable::ProcessInput().

◆ ValueInClosedRange()

template<typename T>
void WsfVariable< T >::ValueInClosedRange ( UtInput & aInput,
T aMinValue,
T aMaxValue )
inline

Interface to UtInput::ValueInClosedRange. This checks a static or default value to see if it is valid. Nothing is done for a pure reference.

References WsfVariableBase::HasDefaultValue(), and WsfVariableBase::IsReference().

◆ ValueLess()

template<typename T>
void WsfVariable< T >::ValueLess ( UtInput & aInput,
T aMaxValue )
inline

Interface to UtInput::ValueLess. This checks a static or default value to see if it is valid. Nothing is done for a pure reference.

References WsfVariableBase::HasDefaultValue(), and WsfVariableBase::IsReference().

◆ ValueLessOrEqual()

template<typename T>
void WsfVariable< T >::ValueLessOrEqual ( UtInput & aInput,
T aMaxValue )
inline

Interface to UtInput::ValueLessOrEqual. This checks a static or default value to see if it is valid. Nothing is done for a pure reference.

References WsfVariableBase::HasDefaultValue(), and WsfVariableBase::IsReference().


The documentation for this class was generated from the following file:
Copyrights Multiple, All Rights Reserved