AAO DRAMA/DRAMA2 C++ Interface
|
Create a DRAMA task which obeys the GIT specification.
Provides default implementations of the INITIALISE, CTRLC, DUMP_LOG, EXIT, LOG_LEVEL, POLL, POLL_PARAMETER, RESET, SIMULATE_LEVEL, STATUS and UPDATE_NBD actions.
Implements the LOG_LEVEL, SIMULATE_LEVEL, TIME_BASE, ENQ_DEV_TYPE, ENQ_DEV_DESCR, ENQ_VER_NUM, ENQ_VER_DATE, ENQ_DEV_NUMITEM, INITIALISED and POLL_PARAMETER parameters.
Note - some of the above are well out of date, having been originally required for the AAO VAX/VMS ADAM systems, but their existence is maintained for compatibility reasons.
The default INTIALISE and RESET actions will open the logger and set the INITIALISED parameter to true.
The default SIMULATE_LEVEL parameter will accept the standard GIT Simulation levels and set the SIMULATE_LEVEL and TIMEBASE parameters.
The default LOG_LEVEL action is actually provided by drama::logging::Logger.
The default POLL action is currently very limited. To be expanded.
Other actions are null actions that return immediately.
#include "gittask.hh"
Public Member Functions | |
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) | |
Create a DRAMA task which implements the AAO GIT Specification. More... | |
virtual | ~Task () |
Destructor. More... | |
std::string | GetLogSysName () const |
Return the logging system name provided to the constructor. More... | |
GitSimulationType | GetSimulationLevel () const |
Returns the simulation level. More... | |
std::string | GetSimulationStr () |
Returns the simulation level as a string. More... | |
double | GetSimulationTimeBase () |
Returns the simulation timebase. More... | |
bool | IsSimulating () const |
Returns true if the task is simulating. More... | |
![]() | |
Task (const std::string &name, int buffer=DefBufSize, int flags=0, int selfBytes=DefSelfBufSize) | |
Create a new DRAMA task of the specified name. More... | |
virtual void | _MessageUser (const std::string &text) const |
Use DRAMA to send a message to the user. More... | |
virtual void | Add (const std::string &name, MessageHandlerPtr obj) |
Add an action to the task. More... | |
virtual void | Add (const std::string &name, MessageHandler *obj) |
Add an action to the task. More... | |
virtual void | Add (const std::string &name, MessageReceiveFunction func) |
Add an action to the task. More... | |
void | AddOrphanToQueue (const OrphanDetails &orphan) |
Add an orphan to the queue of orphans to be processed before we next look at the DRAMA message queue. More... | |
virtual void | AddSpawnable (const std::string &name, SpawnablePtr obj) |
Add a spawnable action to the task. More... | |
virtual void | AddSpawnable (const std::string &name, Spawnable *obj) |
Add an action to the task. More... | |
void | CancelNotifyOnRunDramaExit (RunDramaExitNotifier *notifier) |
Cancel notification for when the DRAMA RunDrama() exits. More... | |
virtual double | GetJoinTimeout () const |
Get the thread join timeout. More... | |
std::thread::id | GetTaskThreadId () const |
Return the thread ID of the thread running RunDrama() More... | |
mutexType & | Lock () |
Reference the DRAMA Task lock. More... | |
logging::Logger & | Logger () |
Reference to DRAMA 2 Logger. More... | |
void | NotifyOnRunDramaExit (RunDramaExitNotifier *notifier) |
Arrange notification for when the DRAMA RunDrama() exits. More... | |
virtual void | RunDrama () |
Run the DRAMA message loop in the current thread. More... | |
void | Signal (const std::string &name, sds::Id *arg=nullptr, void *data=nullptr) |
Trigger the rescheduling of an action, specifing the name of the action. More... | |
void | Signal (long int index, sds::Id *arg=nullptr, void *data=nullptr) |
Trigger the rescheduling of an action, specifying the index of the action. More... | |
std::string | TaskName () const |
Return task name. More... | |
std::weak_ptr< Task > | TaskPtr () |
Returns a weak pointer to the task. More... | |
template<typename T > | |
std::shared_ptr< T > | TaskPtrAs () |
Returns a shared pointer to the task, dynamically case to the template type. More... | |
Protected Attributes | |
Parameter< std::string > | _EnqDevDescr |
Object for accessing the ENQ_DEV_DESCR parameter. More... | |
Parameter< INT32 > | _EnqDevNumItem |
Object for accessing the ENQ_DEV_NUM_ITEM parameter. More... | |
Parameter< std::string > | _EnqDevType |
Object for accessing the ENQ_DEV_TYPE parameter. More... | |
Parameter< std::string > | _EnqVerDate |
Object for accessing the ENQ_VER_DATE parameter. More... | |
Parameter< std::string > | _EnqVerNum |
Object for accessing the ENQ_VER_NUM parameter. More... | |
Parameter< INT32 > | _Initialised |
Object for accessing the INITIALISED parameter. More... | |
Parameter< float > | _PollPar |
Object for accessing the POLL_PARAMETER parameter. More... | |
Parameter< std::string > | _SimulateLevel |
Object for accessing the SIMULATE_LEVEL parameter. More... | |
Parameter< float > | _TimeBase |
Object for accessing the TIME_BASE parameter. More... | |
Additional Inherited Members | |
![]() | |
typedef std::lock_guard< mutexType > | guardType |
Defines the type of a lock guard using our mutex type. More... | |
typedef std::recursive_timed_mutex | mutexType |
Defines the type of our mutex. More... | |
typedef std::unique_lock< mutexType > | uniqueLockType |
Defines the type of a unique_lock type using our mutex type. More... | |
![]() | |
static const int | DefBufSize =20000 |
Default global buffer size. More... | |
static const int | DefSelfBufSize =2000 |
Default self buffer size. More... | |
![]() | |
virtual void | OrphanHandler (const OrphanDetails &details) |
Orphan transaction handler. More... | |
drama::git::Task::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 |
||
) |
Create a DRAMA task which implements the AAO GIT Specification.
taskName | The name for the task. |
logSysName | Logging system name - used to access environment variables used in setting up logging. See drama::logging::Logger. |
verNum | The task version number as a string. For AAO tasks, this is normally dervied from the ACMM Version number, e.g r1_4 for ACMM Version 1.4. AAO dmakefile's can use standard code to generate this. This value is placed in the ENQ_VER_NUM parameter. |
verDate | The task build date. The AAO normally used the command "date +%d-%b-%Y" to generate this string and AAO dmakefile's can use standard code to generate this. This value value is placed in the ENQ_VER_DATE parameter. |
description | A string to be placed in the GIT ENQ_DEV_DESCR parameter. |
taskType | A string to be placed in the GIT ENQ_DEV_TYPE parameter. See the GIT documentation for defined types. |
simVarName | IF not empty, then this is the name of a environment variable which is used to determine the simulation level when the simulation not been set by the SIMULATE_LEVEL command or by setting the SIMULATE_LEVEL parameter |
simLevels | A bit mask indicate the acceptable simulation levels. The possible values are GIT_M_SIM_BASIC, GIT_M_SIM_COMMANDS, GIT_M_SIM_STATUS. FULL simulation and NONE are always allowed. Set to GIT_M_SIM_ALLLEVELS to accept all values. |
|
virtual |
Destructor.
Reimplemented from drama::Task.
|
inline |
Return the logging system name provided to the constructor.
GitSimulationType drama::git::Task::GetSimulationLevel | ( | ) | const |
Returns the simulation level.
std::string drama::git::Task::GetSimulationStr | ( | ) |
Returns the simulation level as a string.
double drama::git::Task::GetSimulationTimeBase | ( | ) |
Returns the simulation timebase.
bool drama::git::Task::IsSimulating | ( | ) | const |
Returns true if the task is simulating.
|
protected |
Object for accessing the ENQ_DEV_DESCR parameter.
|
protected |
Object for accessing the ENQ_DEV_NUM_ITEM parameter.
|
protected |
Object for accessing the ENQ_DEV_TYPE parameter.
|
protected |
Object for accessing the ENQ_VER_DATE parameter.
|
protected |
Object for accessing the ENQ_VER_NUM parameter.
|
protected |
Object for accessing the INITIALISED parameter.
|
protected |
Object for accessing the POLL_PARAMETER parameter.
|
protected |
Object for accessing the SIMULATE_LEVEL parameter.
|
protected |
Object for accessing the TIME_BASE parameter.
Click here for the DRAMA home page and here for the AAO home page.
For more information, contact tjf@aao.gov.au Generated on Mon Feb 22 2016 15:57:53 for AAO DRAMA/DRAMA2 C++ Interface by