AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later 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 Types | |
typedef drama::Request(Task::* | ActionMethod) (drama::MessageHandler *mh) |
This type is for methods the task which implement actions. | |
typedef std::lock_guard< mutexType > | guardType |
Defines the type of a lock guard using our mutex type. | |
typedef std::recursive_timed_mutex | mutexType |
Defines the type of our mutex. | |
typedef void(Task::* | ThreadActionMethod) (drama::thread::TAction *taction, const drama::sds::Id &id) |
This type is for methods of the task which implement threaded actions. | |
typedef std::unique_lock< mutexType > | uniqueLockType |
Defines the type of a unique_lock type using our mutex type. | |
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, int buffer=drama::Task::DefBufSize, int flags=0, int selfBytes=drama::Task::DefSelfBufSize) | |
Create a DRAMA task which implements the AAO GIT Specification. | |
virtual | ~Task () |
Destructor. | |
virtual void | _MessageUser (const std::string &text) const |
Use DRAMA to send a message to the user. | |
virtual void | Add (const std::string &name, MessageHandler *obj, const std::string &descr="") |
Add an action to the task. | |
virtual void | Add (const std::string &name, MessageHandlerPtr obj, const std::string &descr="") |
Add an action to the task. | |
virtual void | Add (const std::string &name, MessageReceiveFunction func, const std::string &descr="") |
Add an action to the task. | |
template<typename T > | |
void | AddMth (const std::string &actionName, T method, const std::string &descr="") |
Add an action to the task, implemented by a method. | |
template<typename T > | |
void | AddMthThd (const std::string &actionName, T method, const std::string &descr="") |
Add an action to the task, implemented by a method. | |
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. | |
virtual void | AddSpawnable (const std::string &name, Spawnable *obj, const std::string &descr="") |
Add an action to the task. | |
virtual void | AddSpawnable (const std::string &name, SpawnablePtr obj, const std::string &descr="") |
Add a spawnable action to the task. | |
virtual void | AddTA (const std::string &name, thread::ThreadActionFunction func, const std::string &descr="") |
Add an threaded action to the task. | |
void | CancelNotifyOnRunDramaExit (RunDramaExitNotifier *notifier) |
Cancel notification for when the DRAMA RunDrama() exits. | |
virtual double | GetJoinTimeout () const |
Get the thread join timeout. | |
std::string | GetLogSysName () const |
Return the logging system name provided to the constructor. | |
GitSimulationType | GetSimulationLevel () const |
Returns the simulation level. | |
std::string | GetSimulationStr () |
Returns the simulation level as a string. | |
double | GetSimulationTimeBase () |
Returns the simulation timebase. | |
std::thread::id | GetTaskCreThreadId () const |
Return the thread ID of the thread on which the Task object was created. | |
std::string | GetTaskDescription (const std::string &taskName) const |
Get the description of a task. | |
std::thread::id | GetTaskRunThreadId () const |
Return the thread ID of the thread running RunDrama() | |
int | GetTaskType (const std::string &taskName) const |
Get the type of a task. | |
bool | IsSimulating () const |
Returns true if the task is simulating. | |
mutexType & | Lock () |
Reference the DRAMA Task lock. | |
logging::Logger & | Logger () |
Reference to DRAMA 2 Logger. | |
void | NotifyOnRunDramaExit (RunDramaExitNotifier *notifier) |
Arrange notification for when the DRAMA RunDrama() exits. | |
virtual bool | PollKick (MessageHandler *messageHandler) |
Poll action kick implementation. | |
virtual bool | PollObeyOverride (MessageHandler *messageHandler) |
Poll action obey implementation override. | |
virtual void | PollRescheduleEvent (MessageHandler *messageHandler) |
Poll action reschedule event handler. | |
virtual Request | PollRescheduleRequest () |
PollRescheduleRequest. | |
virtual void | PollSignalEvent (MessageHandler *messageHandler) |
Poll action signal event handler. | |
virtual void | RunDrama () |
Run the DRAMA message loop in the current thread. | |
void | SeparateThreadRunsDrama () |
Tell the task we are expecting a separate thread to run the DRAMA message loop. | |
void | SetDetails (const std::string &descr, int type=0) |
Set task details. | |
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. | |
void | Signal (long int index, sds::Id *arg=nullptr, void *data=nullptr) |
Trigger the rescheduling of an action, specifying the index of the action. | |
std::string | TaskName () const |
Return task name. | |
std::weak_ptr< Task > | TaskPtr () |
Returns a weak pointer to the task. | |
template<typename T > | |
std::shared_ptr< T > | TaskPtrAs () |
Returns a shared pointer to the task, dynamically cast to the template type. | |
Static Public Attributes | |
static const int | DefBufSize =20000 |
Default (minimum) global buffer size. | |
static const int | DefSelfBufSize =2000 |
Default (minimum) self buffer size. | |
Protected Member Functions | |
virtual void | OrphanHandler (const OrphanDetails &details) |
Orphan transaction handler. | |
Protected Attributes | |
Parameter< std::string > | _EnqDevDescr |
Object for accessing the ENQ_DEV_DESCR parameter. | |
Parameter< INT32 > | _EnqDevNumItem |
Object for accessing the ENQ_DEV_NUM_ITEM parameter. | |
Parameter< std::string > | _EnqDevType |
Object for accessing the ENQ_DEV_TYPE parameter. | |
Parameter< std::string > | _EnqVerDate |
Object for accessing the ENQ_VER_DATE parameter. | |
Parameter< std::string > | _EnqVerNum |
Object for accessing the ENQ_VER_NUM parameter. | |
Parameter< INT32 > | _Initialised |
Object for accessing the INITIALISED parameter. | |
Parameter< float > | _PollPar |
Object for accessing the POLL_PARAMETER parameter. | |
Parameter< std::string > | _SimulateLevel |
Object for accessing the SIMULATE_LEVEL parameter. | |
Parameter< float > | _TimeBase |
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 tony.farrell@mq.edu.au
Generated on Thu Dec 12 2024 23:07:35 for AAO DRAMA/DRAMA2 C++ Interface by 1.9.8