#include <gittask.h>
Inheritance diagram for GitTask:

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.
Public Types | |
| enum | SelfPathType |
| Use to ensure the constructor knows it is constructing a self path. More... | |
Public Methods | |
| GitTask (const std::string &name, const std::string &node="", const std::string &file="") | |
| Construct a GitTask object. | |
| GitTask (SelfPathType self) | |
| Path to self constructor. | |
| virtual void | SetSimulation (const std::string &value, const float TimeBase, const std::string &string, StatusType *status) |
| Set simulation and timebase. | |
| virtual void | SetResetMode (GitResetType &mode, StatusType *status) |
| Set the reset mode. | |
| virtual DcppHandlerRet | Initialise (StatusType *status, GitTaskResponseHandler *responseHandler=0, bool freeResponse=false) |
| Perform the complete initialisation sequence for a GIT task. | |
| virtual DcppHandlerRet | Poll (StatusType *status, GitTaskResponseHandler *responseHandler=0, bool freeResponse=false) |
| Send POLL to the GIT task. | |
| virtual DcppHandlerRet | Exit (StatusType *status, GitTaskResponseHandler *responseHandler=0, bool freeResponse=false) |
| Cause a GIT task to exit. | |
| virtual void | Report (StatusType *status) |
| Dump details using MsgOut. | |
| virtual int | IsActive () const |
| Returns true if the task is active (on active list). | |
| virtual | ~GitTask () |
| Destructor. | |
Protected Methods | |
| virtual DcppHandlerRet | SendSimulate (StatusType *status) |
| Obey the SIMULATE_LEVEL action to the task. | |
| virtual DcppHandlerRet | GetVersionInfo (StatusType *status) |
| Send the parameter get message which fetchs the version details. | |
| virtual DcppHandlerRet | GetInitialisedPar (StatusType *status) |
| Send the parameter get message which fetchs the INITIALISED parameter. | |
| virtual DcppHandlerRet | HandleVerComp (StatusType *status) |
| Continue on after fetch version information. | |
| virtual DcppHandlerRet | HandleInitParGetComp (bool initialised, StatusType *status) |
| Continue on after fetching the INITIALISED parameter value. | |
| virtual DcppHandlerRet | SendInitialise (StatusType *status) |
| Actually send the initialise. | |
| virtual DcppHandlerRet | NoNetOnRemote (StatusType *status) |
| Invoked when the get path operation finds that there is no network on the remote node. | |
| 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 | SetPathWait (StatusType *status) |
| Indicate we are waiting for a path to the task. | |
| virtual void | SetInitialising (StatusType *status) |
| Indicate we are Initialising the task. | |
| virtual void | SetResetting (StatusType *status) |
| Indicate we are Restting the task. | |
| virtual void | SetIdle (StatusType *status) |
| Indicate the task is idle. | |
| virtual void | SetExiting (StatusType *status) |
| Indicate the task is exiting. | |
| virtual void | SetFailed () |
| Indicate an operation has failed. | |
| virtual void | SetDied () |
| Indicate the task has died. | |
| 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 bool | RecoveryNeeded () |
| Returns true if recovery is needed. | |
Static Protected Methods | |
| DcppHandlerRet | HandleSimSuccess (DcppVoidPnt ClientData, StatusType *status) |
| To be invoked when the SIMULATE_LEVEL action completes ok. | |
| DcppHandlerRet | HandleSimError (DcppVoidPnt ClientData, StatusType *status) |
| To be invoked when the SIMULATE_LEVEL action fails. | |
| DcppHandlerRet | HandleInitSuccess (DcppVoidPnt ClientData, StatusType *status) |
| To be invoked when the INITIAISE/RESET action completes ok. | |
| DcppHandlerRet | HandleInitError (DcppVoidPnt ClientData, StatusType *status) |
| To be invoked when the INITIAISE/RESET action fails. | |
Protected Attributes | |
| int | pollDont |
| If > PollRetry, don't poll. | |
| bool | pollCancelling |
| Polling is being cancelled. | |
| GitResetType | resetMode |
| Mode of reset. | |
| std::string | simulationLevel |
| Simulate level. | |
| std::string | simulationArg |
| Extra simulation level argument. | |
| float | timeBase |
| Timebase for simulation. | |
| bool | havePath |
| Set true when we have the path. | |
| bool | failed |
| Task has failed in some way and should be reset on Initiailse(). | |
| bool | amExiting |
| Set true when the EXIT message is sent. | |
| bool | resetting |
| Set true if we are resetting. | |
| bool | firstTime |
| Set true for first init attempt. | |
| std::string | verDate |
| From ENQ_VER_DATE parameter. | |
| std::string | verNum |
| From ENQ_VER_NUM parameter. | |
| std::string | taskDescr |
| From ENQ_DEV_DESCR parameter. | |
Static Protected Attributes | |
| const int | PollRetry = 5 |
| How many times to try poll. | |
|
|
Use to ensure the constructor knows it is constructing a self path. This enum has one value, which is passed to the SelfPath constructor to ensure it |
|
||||||||||||||||
|
Construct a GitTask object. Allows the the task name, location and file to be set. Details are the same as the DcppTask:: standard constructor.
|
|
|
Path to self constructor. Constructor a GitTask object which can be used to send messages to the invoking task itself.
|
|
|
Destructor.
|
|
||||||||||||||||
|
Cause a GIT task to exit. This method sends the EXIT action to the task This function returns DcppReschedule if it sent a message. In that case, replies are expected and should be dispatched using DcppDispatch() when they arrive. This will ensure that future processing occurs correctly and the the appropaite handler is invoked when the operation completes.
|
|
|
Send the parameter get message which fetchs the INITIALISED parameter. This method fetchs the parameter named INITIALISED from the task. The default version sends a MGET message to the task to fetch the value of the INITIALISED parameter. parameters. It then returns DcppReschedule. On completion, it sets the values appropiately and invokes HandleInitParGetComp() to continue the operation. Inheritors which send the message themselves should also do this. This call is only invoked the first time an attempt is made to initialise this task, any only if the task was not loaded.
|
|
|
Send the parameter get message which fetchs the version details. This method fetchs the task version details The default version sends a MGET message to the task to fetch the value of the ENQ_VER_DATE, ENQ_VER_NUM and ENQ_VER_DESCR parameters. It then returns DcppReschedule. On completion, it sets the values appropiately and invokes HandleVerComp() to continue the operation. Inheritors which send the message themselves should also do this.
|
|
||||||||||||
|
To be invoked when the INITIAISE/RESET action fails. This function is a DcppTask callback which is invoked when the INITIALISE/RESET action completes with an error.
|
|
||||||||||||
|
Continue on after fetching the INITIALISED parameter value. This function is used to continue after the value of the INITIALISED parameter is fetched. It is not normally overriden, but instead invoked by inheriting classes when they have completed the get operation. The returned value is returned to the caller.
|
|
||||||||||||
|
To be invoked when the INITIAISE/RESET action completes ok. This function is a DcppTask callback which is invoked when the INITIALISE/RESET action completes successfully.
|
|
||||||||||||
|
To be invoked when the SIMULATE_LEVEL action fails. This function is a DcppTask callback which is invoked when the SIMULATE_LEVEL action completes with an error.
|
|
||||||||||||
|
To be invoked when the SIMULATE_LEVEL action completes ok. This function is a DcppTask callback which is invoked when the SIMULATE_LEVEL action completes successfully.
|
|
|
Continue on after fetch version information. This function is used to continue after the version details message is invoked. It is not normally overriden, but instead invoked by inheriting classes when they have completed the version get operation. The returned value is returned to the caller.
|
|
||||||||||||||||
|
Perform the complete initialisation sequence for a GIT task. Initiate the sequence of operations required to Initialise/Reset a DRAMA task obeying the GIT spec. The sequence is as follows
|
|
|
Returns true if the task is active (on active list).
|
|
|
Invoked when the get path operation finds that there is no network on the remote node. Invoked if during a get path operation, it is discovered the DRAMA networking is not running on the remote node. By default, this does nothing and the get path operation will fail. But if an inheritor has some way of starting the remote DRAMA networking (say using the DRAMA Unix Start Server) then it should initiate that operation at this point and return DcppReschedule. It should then invoke either GitTask::RemoteNetStarted or GitTask::RemoteNetStartErr when it had ether started the networking or it has failed.
|
|
||||||||||||||||
|
Send POLL to the GIT task. The POLL action is sent to the task. This function returns DcppReschedule if it sent a message. In that case, replies are expected and should be dispatched using DcppDispatch() when they arrive. This will ensure that future processing occurs correctly and the the appropaite handler is invoked when the operation completes.
|
|
|
Returns true if recovery is needed. This function is invoked if GitTask is resetting the task and the reset mode is recover. In this case, this function should return true if a reset operation should be sent (argument to the RESET will be (RECOVER). Otherwise it should return false, and no RESET command will be sent to the task. The default version of this function returns false all the time, such that we do not RESET tasks which we are already talking to, if the reset mode is RECOVER. An inheritor should consider the current state of the task. |
|
|
To be invoked when a REMOTE DRAMA network has started. If an inheritor is trying to start a REMOTE DRAMA network, after overriding GitTask::NoNetOnRemote it must invoke this method to tell GitTask that the remote DRAMA network has been started and GitTask can now try again to load the task
|
|
|
To be invoked when a REMOTE DRAMA network start has failed. If an inheritor is trying to start a REMOTE DRAMA network after overriding GitTask::NoNetOnRemote, and that operation has failed, it must invoke this method to tell GitTask of the failure. The failure status should be available in DitsGetEntStatus()
|
|
|
Dump details using MsgOut. This call causes details of this object to be output using MsgOut(). (This adds the GIT task version details to the details normally output by the DcppTask::Report - hiding that function.) |
|
|
Actually send the initialise. Actually sends the INITIALISE/RESET action to the task. If the task is being reset, then the default vesion sends the RESET action with an appropiate argument. Otherwise, it sends the INITIALISE action. A task is RESET if it was already running (it did not have to be loaded). If a inheritor sends the message itself, then it should invoke GitTask::HandleInitSuccess / GitTask::HandleInitError when the operation completes, with the object address as the client data item. This will ensure the chain continues. If an inheritor is not sending a message it can just return DcppFinished.
|
|
|
Obey the SIMULATE_LEVEL action to the task. This method sends the SIMULATE_LEVEL action to the task. The default version fetches the simulation string and timebase and sends these as parameters of a SIMULATE_LEVEL action. If a inheritor sends the message itself, then it should invoke GitTask::HandlerSimSuccess / GitTask::HandleSimError when the operation completes, with the object address as the client data item. This will ensure the chain continues. If an inheritor is not sending a message it can just return DcppFinished immediately.
|
|
|
Indicate the task has died.
|
|
|
Indicate the task is exiting. Invoked when an exit has been invoked.
|
|
|
Indicate an operation has failed.
|
|
|
Indicate the task is idle. Invoke when Initialise/Reset has completed.
|
|
||||||||||||
|
Set the version information for the sub-tasks. Invoked when the task details from the ENQ_VER_NUM, ENQ_VER_DATE and ENQ_TASK_DESCR parameters has been fetch. The argument contains the relevant values, which are by default put into the verNum, verData and taskDescr variables.
|
|
|
Set task to its Initial state. Invoked when GitTask does not know if has the a valid path to the task or if a GetPath operation has failed.
|
|
|
Indicate we are Initialising the task. Invoked when we start initialising a loaded task.
|
|
|
Indicate we are waiting for a path to the task. Invoked while we are waiting for the path to the task.
|
|
||||||||||||
|
Set the reset mode. This Should be done prior to calling GitTask::Initialise
|
|
|
Indicate we are Restting the task. Invoked when we start the reset procedure.
|
|
||||||||||||||||||||
|
Set simulation and timebase. Set the simulation level and timebase values to be used when the SIMULATE_LEVEL action is sent to the task.
|
|
|
Set true when the EXIT message is sent.
|
|
|
Task has failed in some way and should be reset on Initiailse().
|
|
|
Set true for first init attempt.
|
|
|
Set true when we have the path.
|
|
|
Polling is being cancelled.
|
|
|
If > PollRetry, don't poll.
|
|
|
How many times to try poll.
|
|
|
Mode of reset.
|
|
|
Set true if we are resetting.
|
|
|
Extra simulation level argument.
|
|
|
Simulate level.
|
|
|
From ENQ_DEV_DESCR parameter.
|
|
|
Timebase for simulation.
|
|
|
From ENQ_VER_DATE parameter.
|
|
|
From ENQ_VER_NUM parameter.
|
Click here for the DRAMA home page and here for the AAO home page.
For more information, contact tjf@aaoepp.aao.gov.au Generated on Tue Nov 3 09:09:56 2009 for AAO DRAMA C++ Interfaces by
1.2.18