AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface
gittask.hh
Go to the documentation of this file.
1#ifndef _DRAMA2_GITTASK_INC
2#define _DRAMA2_GITTASK_INC
3
22/*
23 * History:
24 04-Jul-2014 - TJF - Original version
25 30-Sep-2016 - TJF - Many changes before now.
26 Add buffer, flags, selfBytes arguments to Task
27 constructor.
28 Fix spelling error - PollRescheduleEvent().
29 19-Feb-2023 - TJF - Rework to make implementation actions by methods
30 rather then objects - code becomes simpler.
31 Add ResetArgType type.
32
33 * The above ID is for Doxygen, this one has the format ACMM is looking for.
34 * "@(#) $Id$"
35 */
36
37#include "drama.hh"
38#include "Git.h"
39
40namespace drama {
44 namespace git {
51 enum class ResetArgEnum { Soft=0,
52 Full,
53 Hard,
54 Invalid
55 } ;
60 class ResetArgLookup : drama::gitarg::EnumLookupClass {
61 public:
66 unsigned int GetMaxValue() const override final {
67 return (int)(ResetArgEnum::Invalid)-1; /* We don't accept invalid, want the next one down */
68 }
73 const char ** GetStringArray() const override final {
74 static const char *table[] = { "SOFT", "FULL", "HARD", 0 };
75 return table;
76 }
77 };
125 class Task : public drama::Task {
126 private:
127 std::string _logSysName;
128 std::string _simEnvName;
129 int _simLevels;
130
131 // I see issues if these don't have the underscores,
132 // various sub-classes have classes of the same name
133 // and having methods here causes problems.
134 drama::Request _InitialiseAction(MessageHandler *);
135 drama::Request _ResetAction(MessageHandler *);
136 drama::Request _SimulateLevelAction(MessageHandler *);
137
138 protected:
140 Parameter<std::string> _SimulateLevel;
142 Parameter<float> _TimeBase;
144 Parameter<std::string> _EnqDevType;
146 Parameter<std::string> _EnqDevDescr;
148 Parameter<std::string> _EnqVerNum;
150 Parameter<std::string> _EnqVerDate;
157
158 public:
206 Task(const std::string &taskName,
207 const std::string &logSysName,
208 const std::string &verNum,
209 const std::string &verDate,
210 const std::string &description,
211 const std::string &taskType="IDT",
212 const std::string &simVarName="",
215 int flags=0,
217
222 std::string GetLogSysName() const {
223 return _logSysName;
224 }
230 bool IsSimulating() const;
240 std::string GetSimulationStr();
245 double GetSimulationTimeBase();
246
250 virtual ~Task();
251
280
315
337
360
361
379 };
380
381 } // namespace git
382
383} // namespace drama
384
385#endif
A class which implements a DRAMA Message Handler.
Definition messagehandler.hh:138
The class Parameter is used to implement DRAMA parameters containing primitive items.
Definition parameter.hh:108
Class used by Obey and Kick handlers to indicate rescheduling requirements.
Definition request.hh:78
static const int DefBufSize
Default (minimum) global buffer size.
Definition task.hh:634
static const int DefSelfBufSize
Default (minimum) self buffer size.
Definition task.hh:635
A class which implements a DRAMA task.
Definition task.hh:441
const char ** GetStringArray() const override final
Return the a pointer to the set of string equivalents of each enum.
Definition gittask.hh:100
unsigned int GetMaxValue() const override final
Return the maximum enum value as an integer.
Definition gittask.hh:93
This lookup class is used with ResetArgNum as part of creating a drama::gitarg::Enum item.
Definition gittask.hh:87
Parameter< std::string > _EnqDevType
Object for accessing the ENQ_DEV_TYPE parameter.
Definition gittask.hh:171
Parameter< std::string > _EnqDevDescr
Object for accessing the ENQ_DEV_DESCR parameter.
Definition gittask.hh:173
std::string GetLogSysName() const
Return the logging system name provided to the constructor.
Definition gittask.hh:249
double GetSimulationTimeBase()
Returns the simulation timebase.
virtual void PollSignalEvent(MessageHandler *messageHandler)
Poll action signal event handler.
virtual bool PollKick(MessageHandler *messageHandler)
Poll action kick implementation.
Parameter< std::string > _SimulateLevel
Object for accessing the SIMULATE_LEVEL parameter.
Definition gittask.hh:167
Parameter< INT32 > _Initialised
Object for accessing the INITIALISED parameter.
Definition gittask.hh:181
virtual void PollRescheduleEvent(MessageHandler *messageHandler)
Poll action reschedule event handler.
bool IsSimulating() const
Returns true if the task is simulating.
Parameter< std::string > _EnqVerNum
Object for accessing the ENQ_VER_NUM parameter.
Definition gittask.hh:175
Parameter< std::string > _EnqVerDate
Object for accessing the ENQ_VER_DATE parameter.
Definition gittask.hh:177
virtual bool PollObeyOverride(MessageHandler *messageHandler)
Poll action obey implementation override.
Parameter< INT32 > _EnqDevNumItem
Object for accessing the ENQ_DEV_NUM_ITEM parameter.
Definition gittask.hh:179
Parameter< float > _TimeBase
Object for accessing the TIME_BASE parameter.
Definition gittask.hh:169
Parameter< float > _PollPar
Object for accessing the POLL_PARAMETER parameter.
Definition gittask.hh:183
Task(const std::string &taskName, const std::string &logSysName, const std::string &verNum, const std::string &verDate, const std::string &description, const std::string &taskType="IDT", const std::string &simVarName="", int simLevels=GIT_M_SIM_ALLLEVELS, int buffer=drama::Task::DefBufSize, int flags=0, int selfBytes=drama::Task::DefSelfBufSize)
Create a DRAMA task which implements the AAO GIT Specification.
GitSimulationType GetSimulationLevel() const
Returns the simulation level.
std::string GetSimulationStr()
Returns the simulation level as a string.
virtual Request PollRescheduleRequest()
PollRescheduleRequest.
virtual ~Task()
Destructor.
Create a DRAMA task which obeys the GIT specification.
Definition gittask.hh:152
An interface for the lookup class template arguments to drama::gitarg::Enum.
Definition gitarg.hh:186
A class which reads Enumerated values from a SDS argument structures.
Definition gitarg.hh:245
DRAMA 2 main include file.
ResetArgEnum
Enum values for the default arguments to the git::Task Reset action.
Definition gittask.hh:78
@ Invalid
Used for invalid argument values.
drama::gitarg::Enum< ResetArgLookup, ResetArgEnum > ResetArgType
ResetArgType is a type which can be used to represent a reset action argument.
Definition gittask.hh:111
@ Full
A full reset, but don't necessarily power cycle H/W.
Definition gitpath.hh:84
@ Invalid
Used by gitarg::Enum to indicate an invalid mode.
Definition gitpath.hh:87
@ Hard
A full reset with power cycling of hardware.
Definition gitpath.hh:85
@ Soft
A soft reset - tidy up software rather then hardware.
Definition gitpath.hh:83
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93