WSF
WsfModeList.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFMODELIST_HPP
13#define WSFMODELIST_HPP
14
15#include "wsf_export.h"
16
17#include <cassert>
18#include <vector>
19
20class UtInput;
21#include "WsfStringId.hpp"
22class WsfMode;
23
29
31{
32public:
33 using ModeList = std::vector<WsfMode*>;
34
35 WsfModeList(WsfMode* aTemplatePtr);
36 WsfModeList(const WsfModeList& aSrc);
38 virtual ~WsfModeList();
39
41
42 virtual void AddMode(WsfMode* aModePtr);
43
47 bool CanMultiSelect() const { return mCanMultiSelect; }
48
53 size_t GetCurrentMode() const { return mCurrentModeIndex; }
54
57 size_t GetModeCount() const { return mModeList.size(); }
58
64 WsfMode* GetModeEntry(size_t aModeIndex) const { return mModeList[aModeIndex]; }
65
66 size_t GetModeByName(WsfStringId aModeNameId) const;
67
68 WsfStringId GetModeNameId(size_t aModeIndex) const;
69
72
73 virtual bool Initialize();
74
75 virtual bool ProcessInput(UtInput& aInput);
76
77 virtual void Deselect(double aSimTime, WsfStringId aModeNameId);
78
79 virtual void Select(double aSimTime, WsfStringId aModeNameId);
80
81 virtual void TurnOff(double aSimTime);
82
83 virtual void TurnOn(double aSimTime);
84
87 virtual double GetModeSelectDelay() { return mModeSelectDelay; }
88
91 virtual bool IsModeChangeScheduled() const { return mModeChangeScheduled; }
92
95 virtual void SetModeChangeScheduled(bool aModeChangeScheduled) { mModeChangeScheduled = aModeChangeScheduled; }
96
105 template<class T>
106 void GetDerivedModeList(std::vector<T>& aModeList) const
107 {
108 aModeList.resize(mModeList.size());
109 for (typename std::vector<WsfMode*>::size_type i = 0; i < mModeList.size(); ++i)
110 {
111 T modePtr = dynamic_cast<T>(mModeList[i]);
112 assert(modePtr != nullptr);
113 aModeList[i] = modePtr;
114 }
115 }
116
117protected:
118 void DeselectP(double aSimTime, size_t aModeIndex);
119 void SelectP(double aSimTime, size_t aModeIndex);
120
122 std::vector<WsfMode*> mModeList;
146};
147
148#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
void GetDerivedModeList(std::vector< T > &aModeList) const
Definition WsfModeList.hpp:106
bool mModeChangeScheduled
The last successful mode selection time.
Definition WsfModeList.hpp:145
double mModeSelectDelay
Definition WsfModeList.hpp:143
WsfStringId mInitialModeNameId
Definition WsfModeList.hpp:134
std::vector< WsfMode * > ModeList
Definition WsfModeList.hpp:33
WsfMode * GetModeTemplate() const
Returns the mode that is the 'mode_template' or the implicit mode.
Definition WsfModeList.hpp:71
WsfMode * mTemplatePtr
The mode that is the 'mode_template' or the implicit mode.
Definition WsfModeList.hpp:124
bool mCanMultiSelect
Definition WsfModeList.hpp:131
bool mIsTurnedOn
'true' if the system is currently turned on.
Definition WsfModeList.hpp:138
virtual void SetModeChangeScheduled(bool aModeChangeScheduled)
Definition WsfModeList.hpp:95
size_t GetModeCount() const
Definition WsfModeList.hpp:57
WsfModeList & operator=(const WsfModeList &)=delete
bool mIsInitialized
'true' if the system has been initialized
Definition WsfModeList.hpp:136
size_t mCurrentModeIndex
The vector index of the currently selected mode.
Definition WsfModeList.hpp:140
WsfMode * GetModeEntry(size_t aModeIndex) const
Definition WsfModeList.hpp:64
virtual bool IsModeChangeScheduled() const
Definition WsfModeList.hpp:91
WsfModeList(WsfMode *aTemplatePtr)
Definition WsfModeList.cpp:39
bool CanMultiSelect() const
Definition WsfModeList.hpp:47
virtual void AddMode(WsfMode *aModePtr)
Definition WsfModeList.cpp:116
bool mExplicitModeUsed
'true' if 'mode' was or 'mode_template' has been used.
Definition WsfModeList.hpp:126
bool mImplicitModeUsed
'true' if a mode was implicitly defined without using 'mode' or 'mode_template'.
Definition WsfModeList.hpp:128
std::vector< WsfMode * > mModeList
This list of modes.
Definition WsfModeList.hpp:122
static WsfStringId GetDefaultModeNameId()
Return the string id of the 'default' mode name.
Definition WsfModeList.cpp:107
size_t GetCurrentMode() const
Definition WsfModeList.hpp:53
virtual double GetModeSelectDelay()
Definition WsfModeList.hpp:87
Definition WsfMode.hpp:32
Copyrights Multiple, All Rights Reserved