AAO DRAMA C++ Interface (Old style)
DRAMA C++, Depreciated, don't use for new code
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
GitTask Class Reference

A class built on DcppTask which control AAO GIT Tasks. More...

#include <gittask.h>

Inheritance diagram for GitTask:
DcppTask

Public Types

enum  SelfPathType { SelfPath }
 Use to ensure the constructor knows it is constructing a self path. More...
 

Public Member Functions

 GitTask (const std::string &name, const std::string &node="", const std::string &file="")
 Construct a GitTask object.
 
 GitTask (SelfPathType)
 Path to self constructor.
 
virtual ~GitTask ()
 Destructor.
 
virtual bool Active () const
 Indicate if a task is active.
 
virtual bool Busy () const
 Returns true if we can't send a message because path is busy.
 
virtual void ClearState ()
 Clear the task state.
 
virtual DcppHandlerRet Control (const char *const name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppHandlerRoutine TriggerHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0)
 Send a DRAMA Control message to the task.
 
virtual void Delete (int force, StatusType *status)
 Delete the task.
 
virtual void Died ()
 Note that a task has died.
 
virtual DcppHandlerRet Exit (StatusType *status, GitTaskResponseHandler *responseHandler=0, bool freeResponse=false)
 Cause a GIT task to exit.
 
virtual DcppHandlerRet Get (const char *const name, StatusType *const status, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0)
 Send a DRAMA message to the task to get the value of a parameter.
 
const char * GetArgument () const
 Fetch the load argument.
 
virtual void GetDitsPath (DitsPathType *path, StatusType *status)
 Return the underlying DITS path object.
 
virtual DcppHandlerRet GetPath (StatusType *const status, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppVoidPnt ClientData=0)
 Get a path to/load a the task.
 
virtual void GetPathImmed (StatusType *const status)
 Get a path to a task if DITS already has it.
 
bool GetPathLoaded () const
 Indicate if a the task was loaded.
 
DcppHandlerRet HandleMessage (DcppTransaction *transaction, StatusType *status)
 Function used by DcppDispatch in dispatching to handlers.
 
virtual bool Initial () const
 Return true if a GetPath operation is required.
 
virtual DcppHandlerRet Initialise (StatusType *status, GitTaskResponseHandler *responseHandler=0, bool freeResponse=false)
 Perform the complete initialisation sequence for a GIT task.
 
virtual int IsActive () const
 Returns true if the task is active (on active list)
 
virtual bool IsDead () const
 Return true if a previously active task has disconnected.
 
virtual DcppHandlerRet Kick (const char *const name, const DcppShared &SharedMem, const bool sds, const int NotifyBytes, StatusType *const status, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppBulkTransRoutine BulkTransHandler=0, const DcppHandlerRoutine BulkDoneHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0, const DcppHandlerRoutine MsgHandler=0)
 Send a DRAMA bulk data Kick message to the task.
 
virtual DcppHandlerRet Kick (const char *const name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0, const DcppHandlerRoutine MsgHandler=0)
 Send a DRAMA Kick message to the task.
 
virtual void KickForget (const char *const name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0, const DcppHandlerRoutine MsgHandler=0)
 Send a DRAMA OKick message to the task, forgetting the transaction.
 
const char * Location () const
 Fetch the task location.
 
virtual void LogLoad (const bool Flag=true)
 Load use MsgOut() a lines indicating the load operations.
 
virtual void LosePath (StatusType *const status)
 Lose the path and then set as if the task has died.
 
virtual DcppHandlerRet MGet (const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppHandlerRoutine ErsHandler, const DcppVoidPnt ClientData, unsigned count, StatusType *status,...)
 Send a DRAMA message to the task to get the value of multiple parameters.
 
virtual DcppHandlerRet MGet (const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppVoidPnt ClientData, unsigned count, StatusType *status,...)
 Send a DRAMA message to the task to get the value of multiple parameters.
 
virtual DcppHandlerRet Monitor (const char *name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppHandlerRoutine TriggerHandler=0, const DcppVoidPnt ClientData=0, const bool SendCurrent=false, const DcppHandlerRoutine ErsHandler=0)
 Send a DRAMA Monitor message to the task.
 
virtual void MonitorForget (const char *name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppHandlerRoutine TriggerHandler=0, const DcppVoidPnt ClientData=0, const bool SendCurrent=false, const DcppHandlerRoutine ErsHandler=0)
 Send a DRAMA Monitor message to the task, forgetting the transaction.
 
virtual DcppHandlerRet Obey (const char *const name, const DcppShared &SharedMem, const bool sds, const int NotifyBytes, StatusType *const status, const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppBulkTransRoutine BulkTransHandler, const DcppHandlerRoutine BulkDoneHandler, const DcppHandlerRoutine TriggerHandler, const DcppVoidPnt ClientData, const DcppHandlerRoutine ErsHandler, const DcppHandlerRoutine MsgHandler, const SdsId *const tidArg)
 Send a DRAMA Obey bulk data message to the task.
 
virtual DcppHandlerRet Obey (const char *const name, const DcppShared &SharedMem, const bool sds, const int NotifyBytes, StatusType *const status, const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppBulkTransRoutine BulkTransHandler, const DcppHandlerRoutine BulkDoneHandler, const DcppHandlerRoutine TriggerHandler, const DcppVoidPnt ClientData, const DcppHandlerRoutine ErsHandler, const DcppHandlerRoutine MsgHandler, SdsId *const tidArg)
 Send a DRAMA Obey bulk data message to the task.
 
virtual DcppHandlerRet Obey (const char *const name, const DcppShared &SharedMem, const bool sds, const int NotifyBytes, StatusType *const status, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppBulkTransRoutine BulkTransHandler=0, const DcppHandlerRoutine BulkDoneHandler=0, const DcppHandlerRoutine TriggerHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0, const DcppHandlerRoutine MsgHandler=0, DitsTransIdType *const transid=0)
 Send a DRAMA Obey bulk data message to the task.
 
virtual DcppHandlerRet Obey (const char *const name, StatusType *const status, const SdsId &arg, const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppHandlerRoutine TriggerHandler, const DcppVoidPnt ClientData, const DcppHandlerRoutine ErsHandler, const DcppHandlerRoutine MsgHandler, const SdsId *const tidArg)
 Send a DRAMA Obey message to the task.
 
virtual DcppHandlerRet Obey (const char *const name, StatusType *const status, const SdsId &arg, const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppHandlerRoutine TriggerHandler, const DcppVoidPnt ClientData, const DcppHandlerRoutine ErsHandler, const DcppHandlerRoutine MsgHandler, SdsId *const tidArg)
 Send a DRAMA Obey message to the task.
 
virtual DcppHandlerRet Obey (const char *const name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppHandlerRoutine TriggerHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0, const DcppHandlerRoutine MsgHandler=0, DitsTransIdType *const transid=0)
 Send a DRAMA Obey message to the task.
 
virtual void ObeyForget (const char *const name, StatusType *const status, const SdsId &arg, const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppHandlerRoutine TriggerHandler, const DcppVoidPnt ClientData, const DcppHandlerRoutine ErsHandler, const DcppHandlerRoutine MsgHandler, const SdsId *const tidArg)
 Send a DRAMA Obey message to the task, forgetting the transaction.
 
virtual void ObeyForget (const char *const name, StatusType *const status, const SdsId &arg, const DcppHandlerRoutine SuccessHandler, const DcppHandlerRoutine ErrorHandler, const DcppHandlerRoutine TriggerHandler, const DcppVoidPnt ClientData, const DcppHandlerRoutine ErsHandler, const DcppHandlerRoutine MsgHandler, SdsId *const tidArg)
 Send a DRAMA Obey message to the task, forgetting the transaction.
 
virtual void ObeyForget (const char *const name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppHandlerRoutine TriggerHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0, const DcppHandlerRoutine MsgHandler=0, DitsTransIdType *const transid=0)
 Send a DRAMA Obey message to the task, forgetting the transaction.
 
virtual DcppHandlerRet Poll (StatusType *status, GitTaskResponseHandler *responseHandler=0, bool freeResponse=false)
 Send POLL to the GIT task

 
virtual DisconHandlerPutDisconnectHandler (DisconHandler *p)
 Add a new disconnect handler for this task.
 
virtual void Report (StatusType *status)
 Dump details using MsgOut.
 
void Report (StatusType *status) const
 Dump details using MsgOut().
 
virtual DcppHandlerRet Set (const char *const name, StatusType *const status, const SdsId &arg=SdsNull, const DcppHandlerRoutine SuccessHandler=0, const DcppHandlerRoutine ErrorHandler=0, const DcppVoidPnt ClientData=0, const DcppHandlerRoutine ErsHandler=0)
 Send a DRAMA set message to the task.
 
virtual void SetArgument (const char *const LoadArg, bool const Append=false)
 Set the load time argument string.
 
virtual void SetBuffers (const DcppBuffers &Buffers)
 Set the DRAMA path buffers.
 
virtual void SetFile (const char *const File)
 Set the executable file name.
 
virtual void SetFlowControl ()
 Set the FLOW control flag.
 
virtual void SetLocation (const char *const Location)
 Set the task location.
 
virtual void SetName (const char *const TaskName)
 Set the task name.
 
virtual void SetNames (const bool Flag=true)
 Insist that symbols known to IMP_Master be known to the task.
 
virtual void SetPriority (const int Priority, const bool Absolute=false)
 Set the load time priority for a task when loaded.
 
virtual void SetProcess (const char *const ProcessName)
 Set the process names.
 
virtual void SetProg (const bool Flag=true)
 Interpert file name as a program name.
 
virtual void SetResetMode (GitResetType &mode, StatusType *status)
 Set the reset mode.
 
virtual void SetSimulation (const std::string &value, const float TimeBase, const std::string &string, StatusType *status)
 Set simulation and timebase

 
virtual void SetStackSize (unsigned bytes)
 Set the stack size for the load.
 
virtual void SetSymbols (const bool Flag=true)
 Interpert file name as a symbol (VMS Target only)
 
void TaskLoggingOff ()
 Turn logging off for this object.
 
void TaskLoggingOn ()
 Turn logging on for this object.
 
const char * TaskName () const
 Fetch the task name.
 

Static Public Member Functions

static DcppHandlerRet DiscardResponse (DcppVoidPnt ClientData, StatusType *status)
 Flag argument success handler indicating reponses are to be ignored.
 
static void HandleDisconnected (const char *task, DitsPathType path, StatusType *status)
 Handle task disconnection.
 
static void LoggingOff ()
 Disable logging for all tasks.
 
static void LoggingOn ()
 Enable logging for all DcppTask objects.
 

Protected Member Functions

virtual DcppHandlerRet GetInitialisedPar (StatusType *status)
 Send the parameter get message which fetchs the INITIALISED parameter.
 
virtual DcppHandlerRet GetVersionInfo (StatusType *status)
 Send the parameter get message which fetchs the version details.
 
virtual DcppHandlerRet HandleInitParGetComp (bool initialised, StatusType *status)
 Continue on after fetching the INITIALISED parameter value.
 
virtual DcppHandlerRet HandleVerComp (StatusType *status)
 Continue on after fetch version information.
 
virtual DcppHandlerRet NoNetOnRemote (StatusType *status)
 Invoked when the get path operation finds that there is no network on the remote node.
 
virtual bool RecoveryNeeded ()
 Returns true if recovery is needed.
 
virtual DcppHandlerRet RemoteNetStarted (StatusType *status)
 To be invoked when a REMOTE DRAMA network has started.
 
virtual DcppHandlerRet RemoteNetStartErr (StatusType *status)
 To be invoked when a REMOTE DRAMA network start has failed.
 
virtual DcppHandlerRet SendInitialise (StatusType *status)
 Actually send the initialise

 
virtual DcppHandlerRet SendSimulate (StatusType *status)
 Obey the SIMULATE_LEVEL action to the task.
 
virtual void SetDied ()
 Indicate the task has died.
 
virtual void SetExiting (StatusType *status)
 Indicate the task is exiting.
 
virtual void SetFailed ()
 Indicate an operation has failed.
 
virtual void SetIdle (StatusType *status)
 Indicate the task is idle.
 
virtual void SetInfo (const Arg &info, StatusType *status)
 Set the version information for the sub-tasks.
 
virtual void SetInitial (StatusType *status)
 Set task to its Initial state.
 
virtual void SetInitialising (StatusType *status)
 Indicate we are Initialising the task.
 
virtual void SetPathWait (StatusType *status)
 Indicate we are waiting for a path to the task.
 
virtual void SetResetting (StatusType *status)
 Indicate we are Restting the task.
 

Static Protected Member Functions

static DcppHandlerRet HandleInitError (DcppVoidPnt ClientData, StatusType *status)
 To be invoked when the INITIAISE/RESET action fails.
 
static DcppHandlerRet HandleInitSuccess (DcppVoidPnt ClientData, StatusType *status)
 To be invoked when the INITIAISE/RESET action completes ok.
 
static DcppHandlerRet HandleSimError (DcppVoidPnt ClientData, StatusType *status)
 To be invoked when the SIMULATE_LEVEL action fails.
 
static DcppHandlerRet HandleSimSuccess (DcppVoidPnt ClientData, StatusType *status)
 To be invoked when the SIMULATE_LEVEL action completes ok.
 

Protected Attributes

bool amExiting
 Set true when the EXIT message is sent.
 
bool failed
 Task has failed in some way and should be reset on Initiailse()
 
bool firstTime
 Set true for first init attempt.
 
bool havePath
 Set true when we have the path.
 
bool pollCancelling
 Polling is being cancelled.
 
int pollDont
 If > PollRetry, don't poll.
 
GitResetType resetMode
 Mode of reset

 
bool resetting
 Set true if we are resetting.
 
std::string simulationArg
 Extra simulation level argument.
 
std::string simulationLevel
 Simulate level

 
std::string taskDescr
 From ENQ_DEV_DESCR parameter.
 
float timeBase
 Timebase for simulation

 
std::string verDate
 From ENQ_VER_DATE parameter.
 
std::string verNum
 From ENQ_VER_NUM parameter.
 

Static Protected Attributes

static const int PollRetry = 5
 How many times to try poll.
 

Friends

class GitTaskActiveList
 
class GitTaskActiveListIterator
 
class GitTaskKnownList
 
class GitTaskKnownListIterator
 

Detailed Description

A class built on DcppTask which control AAO GIT Tasks.

DcppTask intended to abstract the control of tasks which obey the
  GIT specification.

The basic concept is that much of the time, we will want to
perform the same operation (say INITIALISE/RESET) on every task we
control.  This class can implement that operation using the
underlying DcppTask primitives providing us with a simple interface.

Then all we need to do to perform such an action is to loop round
a list of the tasks invoking the appropiate function for each task.

Now when a particular type of task needs to modify such an operation,
it can sub-class GitTask.  Thus the general parts of a control such
as Initialisation, are presented with a standard interface, regardless
of the types of tasks being controlled.

Each GitTask object may be put on one of two internally supported
  lists, classes for both of which are defined in the assocaited include 
  file.  An object of class GitTaskActiveList is used to maintain a list 
  of the currently controlled tasks.  GitTaskKnownList is used to
maintain a list of all known task objects, whether currently controlled
or not.  Note that both these lists are special purpose
lists that make use of data storage within the GitTask object type
and thus each task can only be on one of each type of this list at
a time (which is normally all the the program requires).  

We also define an Iterator class for each list type.


 For each method which returns a DcppHandlerType, action rescheduling
 should be handled using DcppDispatch() (or via a DcppHandler object).

 Each of these such methods also take an optional address of an object
 of type GitTaskResponseHandler.  The CompleteOk() method of this
 object is invoked if the operation completes ok, whilst the 
 CompleteWithError()method is invoked if it completes in error.  The
 Triggered() method is invoked if a trigger message is received.  This
 object is only used if the call returned DcppReschedule.  If not 
 supplied, then a default version is used with does nothing but return 
 DcppFinished such that DcppDispatch()/ DcppHandler() know the action 
 is complete.

 An optional third argument, freeHandler, can be used to indicate the
 GitTaskResponseHandler object, if any, should be deleted using the
 delete operator after the CompleteOk/CompleteError method is invoked.

 If you want notifiction of completion, you should subclass 
 GitTaskResponseHandler appropiately.


 There are a set of functions called when the state of the
 task is seen to change.  These may be overriden as required, but the
 GitTask version should also be invoked.   Most take a status argument, 
 but SetFailed() and SetDied() need to work regardless so don't take a
 status argument.

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