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

Detailed Description

A Class which provides access to DRAMA's message sending facilities.

An object of the drama::Path class provides an methods allowing you to send messages to other DRAMA tasks. They can only be used within threaded actions (or UFACE threads).

You must first "Get" the path - using GetPath(). From that point, various methods to send the assorted DRAMA messages are available.

The GetPath() operation can also load the target task, if it is not currently running and details on where to find it have been loaded.

Most of the "Set*" methods need to be invoked before calling GetPath(), to have any impact.

The are methods to send the DRAMA messages with endless wait for waiting until a time has passed.

See also
DcppTask
drama::sds
DitsInitiateMessage()
DitsInitMessBulk()
DRAMA DITS Specification
Examples
monitor1.cpp, monitor2.cpp, and tocker.cpp.

#include "path.hh"

Inheritance diagram for drama::Path:
drama::git::Path

Public Member Functions

 Path ()
 Construct a null object.
 
 Path (Path &&source)=default
 Move copy constructor.
 
 Path (std::weak_ptr< Task > theTask)
 Path to self constructor.
 
 Path (std::weak_ptr< Task > theTask, DitsPathType path)
 Construct from existing DITS path.
 
virtual ~Path ()
 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.
 
void Control (thread::TMessHandler *action, const std::string &name, const sds::Id &argIn=sds::Id::CreateNullItem(), sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a control message to a task and blocks the current thread until the reply is received.
 
bool ControlWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, const sds::Id &argIn=sds::Id::CreateNullItem(), sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a control message to a task and block the current thread until the reply is received or a timeout has occurred.
 
virtual void Delete (int force)
 Delete the task.
 
virtual void Died ()
 Note that a task has died.
 
const std::string & GetArgument () const
 Fetch the load argument.
 
virtual DitsPathType GetDitsPath (bool nothrow=false)
 Return the underlying DITS path object.
 
const std::string & GetHost () const
 Fetch the task host name.
 
void GetParam (thread::TMessHandler *action, const std::initializer_list< std::string > names, sds::IdPtr *const argOut, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a get parameter message to a task and blocks the current thread until it completes.
 
void GetParam (thread::TMessHandler *action, const std::string &name, sds::IdPtr *const argOut, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a get parameter message to a task and blocks the current thread until it completes.
 
bool GetParamWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::initializer_list< std::string > names, sds::IdPtr *const argOut, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a get parameter message to a task and blocks the current thread until it completes.
 
bool GetParamWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, sds::IdPtr *const argOut, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a get parameter message to a task and blocks the current thread until it completes.
 
void GetPath (thread::TMessHandler *action, thread::TransEvtProcessor *const eventProcessor=&_getPathEventProcessor)
 Get a path to a the task.
 
virtual void GetPathImmed ()
 Get a path to a task if DITS already has it.
 
bool GetPathLoaded () const
 Indicate if a the task was loaded.
 
bool GetPathWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, thread::TransEvtProcessor *const eventProcessor=&_getPathEventProcessor)
 Get a path to a the task.
 
virtual std::shared_ptr< TaskGetTask () const
 Get a reference to the DRAMA task we are part of.
 
const std::string GetTaskName () const
 Fetch the task name.
 
virtual bool Initial () const
 Return true if a GetPath operation is required.
 
virtual bool IsDead () const
 Return true if a previously active task has disconnected.
 
void Kick (thread::TMessHandler *action, const std::string &name, const sds::Id &argIn=sds::Id::CreateNullItem(), sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a kick message to a task and blocks the current thread until the reply is received.
 
void KickBulk (thread::TMessHandler *action, const std::string &name, BulkData *argIn, bool isSds, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a kick message, with bulk data argument, to a task and blocks the current thread until the reply is received.
 
void KickBulk (thread::TMessHandler *action, const std::string &name, BulkDataSds *argIn, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a kick message, with SDS bulk data argument, to a task and blocks the current thread until the reply is received.
 
bool KickBulkWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, BulkData *argIn, bool isSds, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a kick message to a task and block the current thread until the reply is received or a timeout has occurred.
 
bool KickBulkWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, BulkDataSds *argIn, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a kick message to a task and block the current thread until the reply is received or a timeout has occurred.
 
bool KickWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, const sds::Id &argIn=sds::Id::CreateNullItem(), sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a kick message to a task and block the current thread until the reply is received or a timeout has occurred.
 
virtual void LogLoad (const bool Flag=true)
 Load use MsgOut() a lines indicating the load operations.
 
virtual void LosePath ()
 Lose the path and then set as if the task has died.
 
void MonitorCancel (thread::TMessHandler *action, int monId, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Send a Monitor Cancel message to a task and block until it is complete.
 
void MonitorForward (thread::TMessHandler *action, const sds::Id &argIn, MessageEventHandler *const eventProcessor=&_simpleMonEventProcessor)
 Send a Monitor Forward message to a task and block until it is complete.
 
template<typename ContainerType >
void MonitorForward (thread::TMessHandler *taction, const std::string &task, const std::string action, const ContainerType &pars, MessageEventHandler *const eventProcessor=&_simpleMonEventProcessor)
 Send a Monitor Forward message to a task and block until it is complete.
 
void MonitorForward (thread::TMessHandler *taction, const std::string &task, const std::string action, std::initializer_list< std::string > pars, MessageEventHandler *const eventProcessor=&_simpleMonEventProcessor)
 Send a Monitor Forward message to a task and block until it is complete.
 
void MonitorStart (thread::TMessHandler *action, const sds::Id &argIn, MessageEventHandler *const eventProcessor)
 Send a Monitor Start message to a task and block until is it is complete.
 
void Obey (thread::TMessHandler *action, const std::string &name, const sds::Id &argIn=sds::Id::CreateNullItem(), sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends an obey message to a task and blocks the current thread until the action is complete.
 
void ObeyBulk (thread::TMessHandler *action, const std::string &name, BulkData *argIn, bool isSds, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends an obey message to a task, with bulk data argument, and blocks the current thread until the action is complete.
 
void ObeyBulk (thread::TMessHandler *action, const std::string &name, BulkDataSds *argIn, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends an obey message to a task, with SDS bulk data argument, and blocks the current thread until the action is complete.
 
bool ObeyBulkWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, BulkData *argIn, bool isSds, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends an obey message to a task, with a bulk data argument, and blocks the current thread until the action is complete or a timeout has occurred.
 
bool ObeyBulkWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, BulkDataSds *argIn, unsigned notifyBytes=1024 *1024, sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends an obey message to a task, with a SDS bulk data argument, and blocks the current thread until the action is complete or a timeout has occurred.
 
bool ObeyWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, const sds::Id &argIn=sds::Id::CreateNullItem(), sds::IdPtr *const argOut=nullptr, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends an obey message to a task and blocks the current thread until the action is complete or a timeout has occurred.
 
Pathoperator= (Path &&rhs)=default
 Move assignment operator.
 
void Report (thread::TMessHandler *action) const
 Dump details using MsgOut().
 
virtual void SetArgument (const std::string &LoadArg, bool const Append=false)
 Set the load time argument string.
 
virtual void SetBuffers (const Buffers &buffs)
 Set the DRAMA path buffers.
 
virtual void SetFile (const std::string &File)
 Set the executable file name.
 
virtual void SetFlowControl ()
 Set the FLOW control flag.
 
virtual void SetHost (const std::string &Host)
 Set the task host name.
 
virtual void SetName (const std::string &TaskName)
 Set the task name.
 
virtual void SetNames (const bool Flag=true)
 Insist that symbols known to IMP_Master be known to the task.
 
void SetParam (thread::TMessHandler *action, const std::string &name, const sds::Id &argIn, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a set parameter message to a task and blocks the current thread until it completes.
 
bool SetParamWaitUntil (std::chrono::steady_clock::time_point until, thread::TMessHandler *action, const std::string &name, const sds::Id &argIn, MessageEventHandler *const eventProcessor=&_simpleEventProcessor)
 Sends a set parameter message to a task and blocks the current thread until it completes or a timeout has occurred.
 
virtual void SetPriority (const int Priority, const bool Absolute=false)
 Set the load time priority for a task when loaded.
 
virtual void SetProcess (const std::string &ProcessName)
 Set the process names.
 
virtual void SetProg (const bool Flag=true)
 Interpert file name as a program name.
 
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)
 

Static Public Member Functions

static std::chrono::steady_clock::time_point DeltaToTimePoint (int secs)
 Given a number of seconds, return a time point that number of seconds into the future.
 
static void HandleDisconnected (const char *task, DitsPathType path, StatusType *status)
 Handle task disconnection.
 
static drama::sds::Id SpawnKickArg (DitsTransIdType tid)
 Create an SDS argument structure for kicking a Spawned transaction.
 
static void SpawnKickArgUpdate (drama::sds::Id *arg, DitsTransIdType tid)
 update an SDS argument structure for kicking a Spawned transaction
 

Protected Member Functions

virtual void Disconnected ()
 Invoked when the task we are talking to disappears.
 

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