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:
63 unsigned int GetMaxValue() const override final {
64 return (int)(ResetArgEnum::Invalid)-1; /* We don't accept invalid, want the next one down */
65 }
67 const char ** GetStringArray() const override final {
68 static const char *table[] = { "SOFT", "FULL", "HARD", 0 };
69 return table;
70 }
71 };
119 class Task : public drama::Task {
120 private:
121 std::string _logSysName;
122 std::string _simEnvName;
123 int _simLevels;
124
125 // I see issues if these don't have the underscores,
126 // various sub-classes have classes of the same name
127 // and having methods here causes problems.
128 drama::Request _InitialiseAction(MessageHandler *);
129 drama::Request _ResetAction(MessageHandler *);
130 drama::Request _SimulateLevelAction(MessageHandler *);
131
132 protected:
151
152 public:
200 Task(const std::string &taskName,
201 const std::string &logSysName,
202 const std::string &verNum,
203 const std::string &verDate,
204 const std::string &description,
205 const std::string &taskType="IDT",
206 const std::string &simVarName="",
209 int flags=0,
211
216 std::string GetLogSysName() const {
217 return _logSysName;
218 }
224 bool IsSimulating() const;
234 std::string GetSimulationStr();
239 double GetSimulationTimeBase();
240
244 virtual ~Task();
245
274
309
331
354
355
373 };
374
375 } // namespace git
376
377} // namespace drama
378
379#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:94
unsigned int GetMaxValue() const override final
Return the maximum enum value as an integer.
Definition gittask.hh:90
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:165
Parameter< std::string > _EnqDevDescr
Object for accessing the ENQ_DEV_DESCR parameter.
Definition gittask.hh:167
std::string GetLogSysName() const
Return the logging system name provided to the constructor.
Definition gittask.hh:243
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:161
Parameter< INT32 > _Initialised
Object for accessing the INITIALISED parameter.
Definition gittask.hh:175
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:169
Parameter< std::string > _EnqVerDate
Object for accessing the ENQ_VER_DATE parameter.
Definition gittask.hh:171
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:173
Parameter< float > _TimeBase
Object for accessing the TIME_BASE parameter.
Definition gittask.hh:163
Parameter< float > _PollPar
Object for accessing the POLL_PARAMETER parameter.
Definition gittask.hh:177
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:146
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.
@ 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