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

Detailed Description

This class is used to creating TAction objects referring to functions.

This class allow the user to specify a function to be used to implement threaded actions.

These are normally created as a result of a call to drama::Task::AddTA().

Author
Tony Farrell, AAO $Revision$ $Date$

#include "threadaction.hh"

Inheritance diagram for drama::thread::TActionViaFunctor:
drama::thread::TAction drama::MessageHandler drama::thread::TMessHandler drama::RunDramaExitNotifier

Public Member Functions

 TActionViaFunctor (std::weak_ptr< Task > dramaTask, const ThreadActionFunction func)
 Initialize object with the specified function, which meets the ThreadActionFunction prototype.
 
void AbortMessageWaits (StatusType status)
 Tells any thread waiting for messages to abort the wait event.
 
void ActionThread (const drama::sds::Id &obeyArg) override
 Invoke function.
 
void ClearExitOnCompletion ()
 Clear exit on completion.
 
bool DoWaitForKick (WaitEventDetails *waitEvent, sds::IdPtr *const arg=nullptr)
 Wait for a kick event with the waitEvent details given.
 
std::string GetActionName () const
 Return the name of the action this thread is implementing.
 
virtual const EntryInfoGetEntry ()
 Return the action entry details.
 
unsigned GetKickCount () const
 Returns the number of times this action has been kicked since started or the last reset of the count.
 
Dits___CurActType GetMessageContext () const override
 Get the DRAMA Context associated with the action event.
 
std::shared_ptr< TaskGetTask () const override
 Get a reference to the DRAMA task we are part of.
 
double GetTimeout () const
 Return the current action timeout.
 
Task::mutexTypeLock () const override
 Get a reference the DRAMA Task lock.
 
template<typename... Types>
void MessageUser (const char *format, Types... args)
 Use DRAMA to send a message to the user - safe format.
 
void MessageUser (const std::string &text) const override
 Use DRAMA to send a message to the user.
 
void PutKickHandler (MessageHandlerPtr obj) override final
 We cannot change the kick handler in a threaded action, it does not make sense.
 
virtual void PutKickHandler (MessageReceiveFunction func)
 Put a message handler function for the next Kick event.
 
void PutObeyHandler (MessageHandlerPtr obj) override final
 We cannot change the obey handler in a threaded action, it does not make sense as the action never reschedules (as viewed by the user code).
 
virtual void PutObeyHandler (MessageReceiveFunction func)
 Put a message handler function for the next Obey reschedule event.
 
void ResetKickCount ()
 Returns a shared pointer to the last kick message argument.
 
virtual const sds::PrintObjectCRSdsListToUser () const override
 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 SetExitOnCompletion ()
 Set exit on completion.
 
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.
 
void SetTimeout (double newTimeout)
 Set a new timeout.
 
void SetupWaitEvent (DitsTransIdType tid, drama::Path *pathObj) override
 Sets up a wait event for this thread.
 
WaitEventDetails * SetupWaitForKick ()
 Set up to wait for a kick message.
 
template<class Clock , class Duration >
bool WaitEventTimeoutAt (EntryCode *event, const std::chrono::time_point< Clock, Duration > &abs_time, sds::IdPtr *const arg=0)
 Block the current thread until a signal/kick for the action is received or until a given time.
 
void WaitForEvent (EntryCode *event, sds::IdPtr *const arg=nullptr)
 Block the current thread until a kick/signal message for the action is received.
 
template<class Rep , class Period >
bool WaitForEventTimeoutIn (EntryCode *event, const std::chrono::duration< Rep, Period > &rel_time, sds::IdPtr *const arg=0)
 Block the current thread until a signal/kick for the action is received or a duration has passed.
 
bool WaitForEventTimeoutIn (EntryCode *event, unsigned seconds, sds::IdPtr *const arg=0)
 Block the current thread until a signal/kick for the action is received or a duration in seconds has passed.
 
void WaitForKick (sds::IdPtr *const arg=nullptr)
 Block the current thread until a kick for the action is received.
 
template<class Rep , class Period >
bool WaitForKickTimeoutIn (const std::chrono::duration< Rep, Period > &rel_time, sds::IdPtr *const arg=0)
 Block the current thread until a kick for the action is received or a duration has passed.
 
bool WaitForKickTimeoutIn (unsigned seconds, sds::IdPtr *const arg=0)
 Block the current thread until a kick for the action is received or a duration in seconds has passed.
 
virtual void WaitForTransaction (std::weak_ptr< Task > theTask, TransEvtInfo *const eventInfo, TransEvtProcessor *const eventProcessor, sds::IdPtr *const arg=nullptr)
 Block the current thread until a message for the transaction specified to SetupWaitEvent() occurs.
 
virtual bool WaitForTransactionUntil (std::weak_ptr< Task > theTask, TransEvtInfo *const eventInfo, TransEvtProcessor *const eventProcessor, const std::chrono::steady_clock::time_point &until, sds::IdPtr *const arg=nullptr)
 Block the current thread until a message for the transaction specified to SetupWaitEvent() occurs or until a certain time has passed.
 
template<class Clock , class Duration >
bool WaitKickForTimeoutAt (const std::chrono::time_point< Clock, Duration > &abs_time, sds::IdPtr *const arg=0)
 Block the current thread until a kick for the action is received or until a given time.
 

Protected Member Functions

virtual void ActionEnd (bool taskExiting, StatusType actionEndStatus)
 Method Invoked when the action completes.
 
void GrabEntryInfo ()
 Fetch the DRAMA Entry information.
 

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