AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface
gitpathtest.cpp
/* G I T P A T H T E S T
* Module name:
gitpathtest.cpp
* Function:
DRAMA 2 GIT Path test.
* Description:
Test drama::git::Path interface.
* Language:
C++
* Copyright (c) Australian Astronomical Observatory, 2014.
Not to be used for commercial purposes without permission.
No warranty of any form unless subject to a specific agreement.
* Support: Tony Farrell, AAO
* "@(#) $Id$"
*/
static const char *rcsId="@(#) $Id$";
static void *use_rcsId = (0 ? (void *)(&use_rcsId) : (void *) &rcsId);
#include "drama.hh"
#include "drama/gitpath.hh"
class GitPathTest;
class InitAction : public drama::thread::TAction {
public:
InitAction(GitPathTest *theTask);
~InitAction() {}
private:
void ActionThread(const drama::sds::Id & /*obeyArg*/) override;
};
class ExitAction : public drama::thread::TAction {
public:
ExitAction(GitPathTest *theTask);
~ExitAction() {}
private:
void ActionThread(const drama::sds::Id & /*obeyArg*/) override;
};
class PollAction : public drama::thread::TAction {
public:
PollAction(GitPathTest *theTask);
~PollAction() {}
private:
void ActionThread(const drama::sds::Id & /*obeyArg*/) override;
};
class PollKickAction : public drama::thread::TAction {
public:
PollKickAction(GitPathTest *theTask);
~PollKickAction() {}
private:
void ActionThread(const drama::sds::Id & /*obeyArg*/) override;
};
class ReportAction : public drama::thread::TAction {
public:
ReportAction(GitPathTest *theTask);
~ReportAction() {}
private:
void ActionThread(const drama::sds::Id & /*obeyArg*/) override;
};
class GitPathTest : public drama::Task {
private:
InitAction InitActionObj;
ExitAction ExitActionObj;
PollAction PollActionObj;
PollKickAction PollKickActionObj;
ReportAction ReportActionObj;
public:
drama::git::Path & SubTask() {
return subTask;
}
GitPathTest() : drama::Task("GITPATHTEST"),
InitActionObj(this),
ExitActionObj(this),
PollActionObj(this),
PollKickActionObj(this),
ReportActionObj(this),
subTask(TaskPtr(),"GITTASKTEST", "", "./gittasktest") {
Add("INITIALISE",
Add("EXIT",
Add("POLL",
Add("POLLKICK",
drama::MessageHandlerPtr(&PollKickActionObj, drama::nodel()));
Add("REPORT",
drama::MessageHandlerPtr(&ReportActionObj, drama::nodel()));
}
~GitPathTest() {
}
};
int main()
{
return 0;
}
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* InitAction class implementation.
*/
void InitAction::ActionThread(const drama::sds::Id & /*obeyArg*/)
{
auto myTask(GetTask()->TaskPtrAs<GitPathTest>());
myTask->SubTask().SetSimulation("FULL");
myTask->SubTask().Initialise(this);
}
InitAction::InitAction(GitPathTest *theTask) :
drama::thread::TAction(theTask->TaskPtr())
{
}
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ExitAction class implementation.
*/
void ExitAction::ActionThread(const drama::sds::Id & /*obeyArg*/)
{
auto myTask(GetTask()->TaskPtrAs<GitPathTest>());
SetExitOnCompletion(); // Task will exit when action completes.
myTask->SubTask().Exit(this);
}
ExitAction::ExitAction(GitPathTest *theTask) :
drama::thread::TAction(theTask->TaskPtr())
{
}
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* PollAction class implementation.
*/
void PollAction::ActionThread(const drama::sds::Id & /*obeyArg*/)
{
auto myTask(GetTask()->TaskPtrAs<GitPathTest>());
myTask->SubTask().Poll(this);
}
PollAction::PollAction(GitPathTest *theTask) :
drama::thread::TAction(theTask->TaskPtr())
{
}
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* PollKickAction class implementation.
*/
void PollKickAction::ActionThread(const drama::sds::Id & /*obeyArg*/)
{
auto myTask(GetTask()->TaskPtrAs<GitPathTest>());
myTask->SubTask().PollCancel(this);
}
PollKickAction::PollKickAction(GitPathTest *theTask) :
drama::thread::TAction(theTask->TaskPtr())
{
}
/*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ReportAction class implementation.
*/
void ReportAction::ActionThread(const drama::sds::Id & /*obeyArg*/)
{
auto myTask(GetTask()->TaskPtrAs<GitPathTest>());
myTask->SubTask().Report(this);
}
ReportAction::ReportAction(GitPathTest *theTask) :
drama::thread::TAction(theTask->TaskPtr())
{
}
virtual void Add(const std::string &name, MessageHandlerPtr obj, const std::string &descr="")
Add an action to the task.
Definition task.hh:696
A class which implements a DRAMA task.
Definition task.hh:441
A path object for communicating with DRAMA GIT tasks.
Definition gitpath.hh:147
A C++ Interface to the handling SDS structures.
Definition sds.hh:428
A class which implements a DRAMA Action with runs a thread.
Definition threadaction.hh:199
DRAMA 2 main include file.
DRAMA 2 include file - GIT Path implementation.
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
std::shared_ptr< MessageHandler > MessageHandlerPtr
This type is used for passing MessageHandler object addresses around.
Definition messagehandler.hh:101
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93
Declare an operator to be used as a deletion operator by std::shared_ptr.
Definition task.hh:114