WSF
WsfModeList Class Reference

#include <WsfModeList.hpp>

Inheritance diagram for WsfModeList:
Collaboration diagram for WsfModeList:

Public Types

using ModeList = std::vector<WsfMode*>

Public Member Functions

 WsfModeList (WsfMode *aTemplatePtr)
 WsfModeList (const WsfModeList &aSrc)
 Copy constructor.
WsfModeListoperator= (const WsfModeList &)=delete
virtual ~WsfModeList ()
virtual void AddMode (WsfMode *aModePtr)
bool CanMultiSelect () const
size_t GetCurrentMode () const
size_t GetModeCount () const
WsfModeGetModeEntry (size_t aModeIndex) const
size_t GetModeByName (WsfStringId aModeNameId) const
WsfStringId GetModeNameId (size_t aModeIndex) const
WsfModeGetModeTemplate () const
 Returns the mode that is the 'mode_template' or the implicit mode.
virtual bool Initialize ()
virtual bool ProcessInput (UtInput &aInput)
 The standard ProcessInput method.
virtual void Deselect (double aSimTime, WsfStringId aModeNameId)
virtual void Select (double aSimTime, WsfStringId aModeNameId)
virtual void TurnOff (double aSimTime)
virtual void TurnOn (double aSimTime)
virtual double GetModeSelectDelay ()
virtual bool IsModeChangeScheduled () const
virtual void SetModeChangeScheduled (bool aModeChangeScheduled)
template<class T>
void GetDerivedModeList (std::vector< T > &aModeList) const

Static Public Member Functions

static WsfStringId GetDefaultModeNameId ()
 Return the string id of the 'default' mode name.

Protected Member Functions

void DeselectP (double aSimTime, size_t aModeIndex)
void SelectP (double aSimTime, size_t aModeIndex)

Protected Attributes

std::vector< WsfMode * > mModeList
 This list of modes.
WsfModemTemplatePtr
 The mode that is the 'mode_template' or the implicit mode.
bool mExplicitModeUsed
 'true' if 'mode' was or 'mode_template' has been used.
bool mImplicitModeUsed
 'true' if a mode was implicitly defined without using 'mode' or 'mode_template'.
bool mCanMultiSelect
WsfStringId mInitialModeNameId
bool mIsInitialized
 'true' if the system has been initialized
bool mIsTurnedOn
 'true' if the system is currently turned on.
size_t mCurrentModeIndex
 The vector index of the currently selected mode.
double mModeSelectDelay
bool mModeChangeScheduled
 The last successful mode selection time.

Detailed Description

A mode list is used to represent the various operating modes of platform subsystems (sensors, interferers, etc). A mode (base class WsfMode) is used to represent a single mode.

This class provides the interface to manipulate multi-mode systems.

Member Typedef Documentation

◆ ModeList

using WsfModeList::ModeList = std::vector<WsfMode*>

Constructor & Destructor Documentation

◆ WsfModeList() [1/2]

WsfModeList::WsfModeList ( WsfMode * aTemplatePtr)

Constructor.

Parameters
aTemplatePtrA pointer to the 'template' from which new modes will be created by ProcessInput(). The mode list assumes ownership of the 'template' and will delete it when the mode list is destroyed.

References mCanMultiSelect, mCurrentModeIndex, mExplicitModeUsed, mImplicitModeUsed, mInitialModeNameId, mIsInitialized, mIsTurnedOn, mModeChangeScheduled, mModeList, mModeSelectDelay, and mTemplatePtr.

Referenced by operator=(), WsfModeList(), WsfSensorModeList::WsfSensorModeList(), WsfSensorModeList::WsfSensorModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ WsfModeList() [2/2]

◆ ~WsfModeList()

WsfModeList::~WsfModeList ( )
virtual

Member Function Documentation

◆ AddMode()

void WsfModeList::AddMode ( WsfMode * aModePtr)
virtual

Add a mode to the mode list.

Parameters
aModePtrPointer to the mode object to be added. The mode list will assume ownership of the object and will delete it when the mode list is deleted.

Reimplemented in WsfSensorModeList.

References mModeList.

Referenced by WsfSensorModeList::AddMode(), Initialize(), operator=(), and ProcessInput().

◆ CanMultiSelect()

bool WsfModeList::CanMultiSelect ( ) const
inline

Can multiple modes can be selected simultaneously?

Returns
true if multiple modes can be selected simultaneously or 'false' if only one mode can be selected at a time.

References mCanMultiSelect.

Referenced by WsfDisEmission::UpdateSensor(), and UT_DEFINE_SCRIPT_METHOD().

◆ Deselect()

void WsfModeList::Deselect ( double aSimTime,
WsfStringId aModeNameId )
virtual

Deselect the mode with the specified mode name.

Parameters
aModeNameIdThe string ID of the mode name that is to be deselected.
aSimTimeThe current simulation time.
Note
This method should not be used for single-select mode lists as they require one mode to be selected at all times. Select is the only method that should be used on Single-select lists.
This does not alter the index that is returned by GetCurrentMode().

References DeselectP(), GetModeByName(), mIsTurnedOn, and mModeList.

◆ DeselectP()

void WsfModeList::DeselectP ( double aSimTime,
size_t aModeIndex )
protected

Deselect a mode.

Parameters
aSimTimeThe current simulation time.
aModeIndexThe index of the mode to be deselected.

References WsfMode::Deselect(), WsfMode::IsSelected(), and mModeList.

Referenced by Deselect(), Select(), and TurnOff().

◆ GetCurrentMode()

size_t WsfModeList::GetCurrentMode ( ) const
inline

Return the index of the current mode.

Note
This method returns the index of the last mode selected by Select(). Calling Deselect() does not alter this value even though the mode is not selected.
This method is not valid until Initialize() has been called.

References mCurrentModeIndex.

◆ GetDefaultModeNameId()

WsfStringId WsfModeList::GetDefaultModeNameId ( )
static

◆ GetDerivedModeList()

template<class T>
void WsfModeList::GetDerivedModeList ( std::vector< T > & aModeList) const
inline

A helper template class to get a vector of mode pointers of the proper type. Classes that implement modes typically need pointers to their specific type of mode in order to call methods that aren't defined in the WsfMode base class. This method creates a copy of the mode list but the pointers are of the requested type. This allows the to eliminate a lot of dynamic casting.

Note
This list that is produced is just a copy. The source list still owns the modes and is responsible for their deletion.

References mModeList.

Referenced by WsfDefaultSensorScheduler::Initialize(), WsfDefaultSensorTracker::Initialize(), WsfPhysicalScanSensorScheduler::Initialize(), WsfRotorcraftMover::Initialize(), WsfSectorScanSensorScheduler::Initialize(), WsfSpinSensorScheduler::Initialize(), and WsfDisEmission::UpdateSensor().

◆ GetModeByName()

size_t WsfModeList::GetModeByName ( WsfStringId aModeNameId) const

Return the mode index of the mode with the specified name (ID).

Returns
If the requested mode is found the return value will be the mode index in the range [0, GetModeCount() - 1]. If the mode was not found then the value of GetModeCount() will be returned.
Note
This method is not valid until Initialize() has been called.

References GetModeCount(), and mModeList.

Referenced by Deselect(), Initialize(), WsfSensorMode::Initialize(), ProcessInput(), Select(), TurnOff(), and TurnOn().

◆ GetModeCount()

size_t WsfModeList::GetModeCount ( ) const
inline

Get the number of modes that are defined.

Note
This method is not valid until Initialize() has been called.

References mModeList.

Referenced by GetModeByName(), WsfCompositeSensor::Initialize(), WsfSensorMode::Initialize(), ProcessInput(), TurnOff(), TurnOn(), and WsfDisEmission::UpdateSensor().

◆ GetModeEntry()

WsfMode * WsfModeList::GetModeEntry ( size_t aModeIndex) const
inline

Return the pointer to mode with the specified index.

Parameters
aModeIndexThe index of the desired mode in the range [0, GetModeCount() - 1]. The results are undefined if the index is outside the allowable range.
Returns
The pointer to the desired mode.
Note
This method is not valid until Initialize() has been called.

References mModeList.

◆ GetModeNameId()

WsfStringId WsfModeList::GetModeNameId ( size_t aModeIndex) const

Return the string ID of the name associated with the mode with the specified index.

Parameters
aModeIndexThe index of the mode whose name is being requested. This must be in the range [0, GetModeCount() - 1].
Returns
The string ID of the name of the mode or 0 if the mode index was invalid.
Note
This method is not valid until Initialize() has been called.

References mModeList.

Referenced by WsfCompositeSensor::Initialize(), and WsfDisEmission::UpdateSensor().

◆ GetModeSelectDelay()

virtual double WsfModeList::GetModeSelectDelay ( )
inlinevirtual

Returns the mode select delay time in seconds.

Returns
The mode select delay time (sec).

References mModeSelectDelay.

◆ GetModeTemplate()

WsfMode * WsfModeList::GetModeTemplate ( ) const
inline

Returns the mode that is the 'mode_template' or the implicit mode.

References mTemplatePtr.

Referenced by WsfCompositeSensor::Initialize(), and WsfMoonLOS_SensorComponent::ProcessModeInput().

◆ Initialize()

bool WsfModeList::Initialize ( )
virtual

Initialize the mode list. This method ensures that the mode list is properly formed and prepares it for use.

Returns
'true' if successful or 'false' if not.
Note
This does NOT initialize each of the modes. It is the responsibility of the caller to initialize the individual modes. This tends to be very specific to the application and could not be done conveniently through a common interface (it could have been done, but it was simpler just to let the caller write their own loop).

References AddMode(), GetModeByName(), mCurrentModeIndex, mExplicitModeUsed, mImplicitModeUsed, mInitialModeNameId, mIsInitialized, mModeList, mTemplatePtr, and ok.

◆ IsModeChangeScheduled()

virtual bool WsfModeList::IsModeChangeScheduled ( ) const
inlinevirtual

Check is a mode change is scheduled.

Returns
Returns 'true' if a mode change is currently scheduled, returns 'false' otherwise.

References mModeChangeScheduled.

◆ operator=()

WsfModeList & WsfModeList::operator= ( const WsfModeList & )
delete

◆ ProcessInput()

bool WsfModeList::ProcessInput ( UtInput & aInput)
virtual

◆ Select()

void WsfModeList::Select ( double aSimTime,
WsfStringId aModeNameId )
virtual

Select the mode with the specified mode name (ID).

Parameters
aModeNameIdThe string ID of the mode name that is to be selected.
aSimTimeThe current simulation time.
Note
The index selected mode becomes the value that would be returned by GetCurrentMode().
The current implementation only allows the selection of EXACTLY one mode at any given point in time (while the system is on). The currently selected mode is deselected before selecting the new mode.

References DeselectP(), GetModeByName(), mCanMultiSelect, mCurrentModeIndex, mIsTurnedOn, mModeList, and SelectP().

◆ SelectP()

void WsfModeList::SelectP ( double aSimTime,
size_t aModeIndex )
protected

Select a mode.

Parameters
aSimTimeThe current simulation time.
aModeIndexThe index of the mode to be selected.

References WsfMode::IsSelected(), mModeList, and WsfMode::Select().

Referenced by Select(), and TurnOn().

◆ SetModeChangeScheduled()

virtual void WsfModeList::SetModeChangeScheduled ( bool aModeChangeScheduled)
inlinevirtual

Check is a mode change is scheduled.

Returns
Returns 'true' if a mode change is currently scheduled, returns 'false' otherwise.

References mModeChangeScheduled.

◆ TurnOff()

void WsfModeList::TurnOff ( double aSimTime)
virtual

The system is being turned off. This method invokes the 'Deselect' method for every selected mode.

Parameters
aSimTimeThe current simulation time.

References DeselectP(), GetModeByName(), GetModeCount(), mCanMultiSelect, mCurrentModeIndex, mInitialModeNameId, mIsTurnedOn, and mModeList.

◆ TurnOn()

void WsfModeList::TurnOn ( double aSimTime)
virtual

The system is being turned on. This method invokes the 'Select' method for every selected mode.

Parameters
aSimTimeThe current simulation time.

References GetModeByName(), GetModeCount(), mCanMultiSelect, mCurrentModeIndex, mInitialModeNameId, mIsTurnedOn, mModeList, and SelectP().

Member Data Documentation

◆ mCanMultiSelect

bool WsfModeList::mCanMultiSelect
protected

'true' if multiple modes can be simultaneously selected. If 'false' then only one mode can be selected at a time and selecting one mode will deselect the currently selected mode.

Referenced by CanMultiSelect(), ProcessInput(), Select(), TurnOff(), TurnOn(), WsfModeList(), WsfModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ mCurrentModeIndex

size_t WsfModeList::mCurrentModeIndex
protected

The vector index of the currently selected mode.

Referenced by GetCurrentMode(), Initialize(), Select(), TurnOff(), TurnOn(), WsfModeList(), WsfModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ mExplicitModeUsed

bool WsfModeList::mExplicitModeUsed
protected

'true' if 'mode' was or 'mode_template' has been used.

Referenced by Initialize(), ProcessInput(), WsfModeList(), WsfModeList(), WsfSensorModeList::WsfSensorModeList(), and ~WsfModeList().

◆ mImplicitModeUsed

bool WsfModeList::mImplicitModeUsed
protected

'true' if a mode was implicitly defined without using 'mode' or 'mode_template'.

Referenced by Initialize(), ProcessInput(), WsfModeList(), WsfModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ mInitialModeNameId

WsfStringId WsfModeList::mInitialModeNameId
protected

The string id of the mode to be selected when the system is FIRST turned on. In the current implementation a subsequent turn-on will use the last selected mode.

Referenced by Initialize(), ProcessInput(), TurnOff(), TurnOn(), WsfModeList(), WsfModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ mIsInitialized

bool WsfModeList::mIsInitialized
protected

'true' if the system has been initialized

Referenced by Initialize(), ProcessInput(), WsfModeList(), WsfModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ mIsTurnedOn

bool WsfModeList::mIsTurnedOn
protected

'true' if the system is currently turned on.

Referenced by Deselect(), Select(), TurnOff(), TurnOn(), WsfModeList(), WsfModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ mModeChangeScheduled

bool WsfModeList::mModeChangeScheduled
protected

◆ mModeList

◆ mModeSelectDelay

double WsfModeList::mModeSelectDelay
protected

The time in which a mode change is delayed before it is actually change upon the request.

Note
Currently only used by extension class and is not integrated locally.

Referenced by GetModeSelectDelay(), ProcessInput(), WsfModeList(), WsfModeList(), and WsfSensorModeList::WsfSensorModeList().

◆ mTemplatePtr

WsfMode* WsfModeList::mTemplatePtr
protected

The mode that is the 'mode_template' or the implicit mode.

Referenced by GetModeTemplate(), Initialize(), ProcessInput(), WsfModeList(), WsfModeList(), and ~WsfModeList().


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