This page is the front page for the documentation for the DRAMA 2 C++ interfaces to DRAMA.
The core of DRAMA is written in C and was done well before C++ was available in a standard way on all the machines of interest. As a result, the C++ interfaces came later. There are a set of older C++ interfaces which have been distributed for some years, but which are a poor mapping to modern C++ and should not be used for new work.
DRAMA2 provides a new C++ interface to DRAMA, interfaces which presume C++11 or later is available and makes extensive use of features of the upgraded compilers.
This documentation is generated automatically from the source code headers using the doxygen tool.
There is also a set of examples and a document describing how to use these interfaces - the document is the preferred way to learn DRAMA2.
These are available in the DRAMA sub-system Drama2Examples. The Document as a PDF is available.
Below we have a quick introduction to each of the significant classes. There are various other minor classes and types. See the drama namespace namespace for the full contents.
Other classes documented are generally used to support one of the above classes.
The "Hello World" example is included below, but the document and its examples from the Drama2Examples module is probably the best way to learn DRAMA2.
static const char *rcsId="@(#) $Id$";
static void *use_rcsId = (0 ? (void *)(&use_rcsId) : (void *) &rcsId);
#include "drama2_err.h"
public:
private:
MessageUser(
"Hello World - from DRAMA 2, action %", GetActionName());
if (Arg)
{
Arg.
Get(
"Argument1", &MyArgument);
}
"Demonstration of error report with format of value %", 33);
}
};
private:
public:
}
}
};
int main()
{
try
{
DramaHello task;
task.RunDrama();
}
{
fprintf(stderr,"DRAMA Exception thrown and caught in main\n");
fprintf(stderr,
"%s\n", e.
toString().c_str());
fprintf(stderr,"DRAMA Status = 0X%lx, %s\n",
}
return 0;
}
sds::Id Argument() const
Return any SDS argument to the action entry.
Definition entryinfo.hh:147
virtual int statusAsSysExitCode() const
Return a system exit code based on the DRAMA Status.
Definition exception.hh:424
virtual std::string toString() const
Return the exception string.
virtual std::string dramaStatusStr() const
Return the DRAMA Status code converted to a DRAMA.
virtual StatusType dramaStatus() const
Return the DRAMA Status code associated with the exception.
Definition exception.hh:404
An Exception class for exceptions thrown by DRAMA V2 classes.
Definition exception.hh:164
virtual const EntryInfo & GetEntry()
Return the action entry details.
Definition messagehandler.hh:335
virtual Request MessageReceived()=0
Method invoked by DRAMA to handle the message.
virtual void MessageUser(const std::string &text) const
Use DRAMA to send a message to the user.
virtual const sds::PrintObjectCR & SdsListToUser() const
Get a reference to an SDS printer object which can be used to list an SDS object using MessageUser.
A class which implements a DRAMA Message Handler.
Definition messagehandler.hh:138
Class used by Obey and Kick handlers to indicate rescheduling requirements.
Definition request.hh:78
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
virtual void List() const
List the contents of the structure to standard output.
Definition sds.hh:2099
void Get(const unsigned long length, T *const data, unsigned long *actlen=nullptr, const unsigned long offset=0) const
Get data from an SDS item.
Definition sds.hh:1547
virtual std::string toString(int maxlen=200)
Convert the structure to a string.
Definition sds.hh:2918
A C++ Interface to the handling SDS structures.
Definition sds.hh:428
DRAMA 2 main include file.
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
void ErsReport(const std::string &mes, StatusType *status)
Report a std::string via ERS.
std::shared_ptr< MessageHandler > MessageHandlerPtr
This type is used for passing MessageHandler object addresses around.
Definition messagehandler.hh:101
@ End
Request that the action complete.
Request SimpleExitAction(drama::MessageHandler *messageHandler)
A function which implements a simple exit action.
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93
DRAMA 2 include file - Sds class definition.
Declare an operator to be used as a deletion operator by std::shared_ptr.
Definition task.hh:114