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

Detailed Description

A class which implements a DRAMA Message Handler.

Interface only. Users must sub-class and implement Request MessageReceived(). They may also want to implement ActionEnd().

A MessageHandler is used to handle Obey or Kick messages in particular. They might be used to implement an action or an action reschedule handler, or an action kick handler.

These objects can then be supplied to the drama::Task::Add() methods or the MessageHandler::PutObeyHandler() or MessageHandler::PutKickHandler() methods. One of these is also returned by drama::Spawnable::Spawn().

Note
The drama::MessageReceiveFunction function type provides alternative to creating one of these objects. It allows a function to be specified to drama::Task::Add() method or the MessageHandler::PutObeyHandler() or MessageHandler::PutKickHandler() methods.
Author
Tony Farrell, AAO $Revision$ $Date$
Examples
dramahello.cpp.

#include "messagehandler.hh"

Inheritance diagram for drama::MessageHandler:
drama::MessageHandlerViaFunctor drama::thread::TAction drama::thread::TActionViaFunctor

Public Member Functions

 MessageHandler ()
 Create a DRAMA action/message handler object.
 
 MessageHandler (const MessageHandler &source)=delete
 Assignment operator deleted.
 
 MessageHandler (MessageHandler &&source)=default
 Move assignment operator.
 
virtual ~MessageHandler ()
 MessageHandler destructor.
 
virtual const EntryInfoGetEntry ()
 Return the action entry details.
 
virtual std::shared_ptr< TaskGetTask () const
 Returns a pointer to the task.
 
template<typename... Types>
void MessageUser (const char *format, Types... args)
 Use DRAMA to send a message to the user - safe format.
 
virtual void MessageUser (const std::string &text) const
 Use DRAMA to send a message to the user.
 
MessageHandleroperator= (const MessageHandler &rhs)=delete
 Copy operator deleted.
 
MessageHandleroperator= (MessageHandler &&rhs)=default
 Move operator.
 
virtual void PutKickHandler (MessageHandlerPtr obj)
 Put a message handler object for the next Kick event.
 
virtual void PutKickHandler (MessageReceiveFunction func)
 Put a message handler function for the next Kick event.
 
virtual void PutObeyHandler (MessageHandlerPtr obj)
 Put a message handler object for the next Obey reschedule event.
 
virtual void PutObeyHandler (MessageReceiveFunction func)
 Put a message handler function for the next Obey reschedule event.
 
virtual const sds::PrintObjectCRSdsListToUser () const
 Get a reference to an SDS printer object which can be used to list an SDS object using MessageUser.
 
void SendBulkTrigger (BulkData *arg, DitsTransIdType *transId, bool isSds, unsigned notifyBytes=1024 *1024)
 Send a bulk data trigger message to the parent action.
 
void SendBulkTrigger (BulkDataSds *arg, DitsTransIdType *transId, unsigned notifyBytes=1024 *1024)
 Send a bulk data trigger message to the parent action.
 
void SendTrigger (const sds::Id &arg) const
 Send a trigger message to the parent action.
 
void SetAction (Action *action)
 Invoked when the ActionHandler is associated with a DRAMA action entry (object type Action).
 
void SetReturnArg (const sds::Id &arg, bool copy=true)
 Set the argument to be sent as part of the action completion message.
 
void SetReturnArg (sds::Id *arg)
 Set the argument to be sent as part of the action completion message.
 

Protected Member Functions

virtual void ActionEnd (bool taskExiting, StatusType actionEndStatus)
 Method Invoked when the action completes.
 
void GrabEntryInfo ()
 Fetch the DRAMA Entry information.
 
virtual Request MessageReceived ()=0
 Method invoked by DRAMA to handle the message.
 

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