AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
drama::git::Task Class Reference

Detailed Description

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.

See also
Example gittasktest.cpp
Author
Tony Farrell, AAO $Revision$ $Date$ $Id$

#include "gittask.hh"

Inheritance diagram for drama::git::Task:
drama::Task

Public Types

typedef drama::Request(Task::* ActionMethod) (drama::MessageHandler *mh)
 This type is for methods the task which implement actions.
 
typedef std::lock_guard< mutexTypeguardType
 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< mutexTypeuniqueLockType
 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.
 
mutexTypeLock ()
 Reference the DRAMA Task lock.
 
logging::LoggerLogger ()
 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< TaskTaskPtr ()
 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.
 

The documentation for this class was generated from the following file: