1#ifndef _DRAMA2_ACTION_INC
2#define _DRAMA2_ACTION_INC
37#include "drama/action.hh"
57 using ActionHandlerPtr = std::shared_ptr<ActionHandler> ;
68 friend class drama::Action;
75 virtual Request MessageEvent(std::weak_ptr<Task>
task, Action *
action) = 0;
79 virtual void InvokeActionEnd(std::weak_ptr<Task>
task, Action *
action,
86 Action *_actionPtr =
nullptr;
93 virtual ~ActionHandler();
102 void SetAction( Action *
action);
122 static const long int ID_CODE = 0x2398434;
123 const long int _checkIdCode = ID_CODE;
131 std::weak_ptr<Task> _theTask;
135 const std::string _actionName;
148 ActionHandlerPtr _origActionHandler=
nullptr;
153 ActionHandlerPtr _currentObeyHandler=
nullptr;
158 ActionHandlerPtr _currentKickHandler=
nullptr;
163 bool _runningAction=
false;
189 Request InvokeCurrentObey();
217 Action(ActionHandlerPtr
obj, std::weak_ptr<Task>
task,
const std::string &name) :
220 _origActionHandler(
obj),
221 _currentObeyHandler(
obj)
223 obj->SetAction(
this);
229 virtual void ActEndHandler(
bool taskExit,
239 void PutObeyHandler(ActionHandlerPtr
obj) {
242 "Tried to change Obey handler when not in action.");
243 _currentObeyHandler =
obj;
249 void PutKickHandler(ActionHandlerPtr
obj) {
252 "Tried to change Kick handler when not in action.");
253 _currentKickHandler =
obj;
261 void _HandlerGone() {
263 fprintf(
stderr,
"Action:_HandlerGone - %p\n", (
void *)(
this));
265 _origActionHandler =
nullptr;
271 std::string GetActionName()
const {
A class which implements a Spawnable DRAMA Message Handler.
Definition spawnable.hh:84
A class which implements a DRAMA task.
Definition task.hh:441
DRAMA 2 include file - implements a class providing access to details on an action entry.
#define DramaTHROW(status_, message_)
Throw a Drama exception.
Definition exception.hh:93
DRAMA 2 include file - Message Handler class definition.
void CreateRunDramaTask()
Create and run a DRAMA task, with standard exception handling.
Definition task.hh:1322
The drama namespace contains all the classes, types etc of the DRAMA 2 implementation.
Definition drama.hh:93
DRAMA 2 include file - Request class definition.
DRAMA 2 include file - Task class definition.