C++ TargetRTS
|
A controller manages a group of capsule instances that all run in the same physical thread (i.e. More...
#include <RTController.h>
Public Types | |
enum | Primitive { CommDefer , CommDeliver , CommInvoke , CommPurge , CommRecall , CommRecallAll , CommReply , CommSend , ExceptionRaise , FrameDeport , FrameDestroy , FrameImport , FrameIncarnate , LayerBind , LayerRegisterSAP , LayerDeregisterSAP , LayerRegisterSPP , LayerDeregisterSPP , LayerResize , LayerResizeSAP , LayerResizeSPP , TimerCancel , TimerInform , SystemService } |
enum | Error { ok , alreadyDeferred , badActor , badClass , badId , badIndex , badInterface , badOperation , badRef , badSignal , badValue , deferInvoke , dereg , imported , noConnect , noFreePorts , noMem , noReply , notImported , notOptional , notOwner , prio , protocolSignal , protocolType , recursiveInvoke , refFull , reg , replRef , smallInterface , tooManySAPs , xRtsInvoke } |
typedef Error | rtsErrors |
Public Types inherited from RTJob | |
enum | Phase { created , running , finished } |
Public Member Functions | |
RTController (RTDebugger *debug, const char *name) | |
Error | canPlugIn (const RTActorClass *, const RTComponentDescriptor *) |
Error | getError (void) const |
Get the most recent error that occurred in the controller's thread. | |
const char * | strerror (void) const |
Get an error message for the most recent error that occurred in the controller's thread. | |
void | perror (const char *s="error") |
Print an error message to stderr. | |
void | setError (Error error, Primitive primitive, const void *info, const void *detail) |
Set the most recent error for the controller's thread. | |
void | trace (Primitive, const void *, const void *) |
void | breakPoint (RTActor *, RTEventInfo *) |
void | evtMsgQueue (void) |
void | getMessages (const RTDaemonInfo &daemonInfo) |
Report all incoming messages satisfying actorPath in daemonInfo. | |
virtual const char * | name (void) const override |
Get the name of the controller, which is the name of its physical thread (as defined in the transformation configuration). | |
virtual void | kill (void) override |
Kill this controller. | |
virtual void | printStats (void) const |
Print various statistics to stdout about what has happened in the RT application (e.g. | |
void | abort (void) |
Abort the application. | |
RTDebugger * | debugger (void) |
Get the debugger associated with this controller, if any. | |
void | destroy (RTActor *actor, RTActor *owner) |
int | send (RTActor *receiver, int controlSignal, const void *data, const RTObject_class *type, int priority) |
void | receive (RTMessage *, RTController *sender) |
int | receiveMsgCopy (const RTMessage *, RTController *sender) |
void | peer_receive (RTMessage *) |
void | requeueMsg (RTMessage *, int front) |
RTMessage * | newMsg (void) |
void | freeMsg (RTMessage *) |
RTTimerNode * | newTimerNode (void) |
void | freeTimerNode (RTTimerNode *node) |
RTMessage * | getReplyBuffer (void) |
RTMessage * | setReplyBuffer (RTMessage *) |
void | restoreReplyBuffer (RTMessage *) |
void | countActorDestroy (void) |
void | countActorIncarnate (void) |
void | countMessageTransfer (RTMessage *) |
void | countPortDestroy (int) |
void | countPortIncarnate (int) |
void | countTimerCancel (void) |
void | countTimerExpire (void) |
void | countTimerStart (void) |
Public Member Functions inherited from RTJob | |
virtual const char * | name (void) const =0 |
Phase | phase (void) const |
virtual void | mainLoop (void)=0 |
virtual void | kill (void)=0 |
Protected Types | |
enum | { OneDelivered , PermissionDenied , NoneToDeliver } |
Protected Member Functions | |
int | dispatch (int priorityLimit) |
void | awaitResponse (void) |
virtual void | waitForEvents (void)=0 |
virtual void | wakeup (void) |
Protected Member Functions inherited from RTJob | |
void | enter (Phase) |
Protected Attributes | |
RTSyncObject * | _sync |
Protected Attributes inherited from RTJob | |
RTMutex * | _mutex |
Friends | |
class | RTMessage |
class | RTProtocol |
class | RTDebugger |
A controller manages a group of capsule instances that all run in the same physical thread (i.e.
there is exactly one controller object for each physical thread in the RT application). The controller implements the mechanism for dispatching messages to capsule instances. RTController is an abstract class, and its concrete subclasses have different implementations of how messages are dispatched. By default the RTPeerController subclass is used as the controller for capsule instances that run in the same physical thread.
void RTController::abort | ( | void | ) |
Abort the application.
Calling this function is equivalent to calling kill() on the main thread's controller.
RTDebugger * RTController::debugger | ( | void | ) |
Get the debugger associated with this controller, if any.
RTController::Error RTController::getError | ( | void | ) | const |
Get the most recent error that occurred in the controller's thread.
Call this function immediately after a function has returned an error code, to get more information about the error that occurred.
|
overridevirtual |
Kill this controller.
All capsule instances that it runs will terminate. Messages that are pending to be dispatched will be deleted. The controller's thread will then terminate (if it is the main thread the whole application will terminate).
Implements RTJob.
|
overridevirtual |
Get the name of the controller, which is the name of its physical thread (as defined in the transformation configuration).
Implements RTJob.
void RTController::perror | ( | const char * | s = "error" | ) |
Print an error message to stderr.
The printed messages will consist of a prefix followed by the message of the most recent error that occurred in the controller's thread.
s | A string that will precede the error message. |
|
virtual |
Print various statistics to stdout about what has happened in the RT application (e.g.
the number of incarnated capsules, the number of dispatched messages etc.).
Reimplemented in RTSoleController, and RTTimerController.
void RTController::setError | ( | Error | error, |
Primitive | primitive, | ||
const void * | info, | ||
const void * | detail | ||
) |
Set the most recent error for the controller's thread.
This function is called by TargetRTS functions when they fail. If you develop extensions to the TargetRTS your functions may call it too.
error | Error code |
primitive | Identifies the primitive action that failed |
info | A context object associated with the error (may be NULL) |
detail | An additional detailed context object associated with the error (may be NULL) |
const char * RTController::strerror | ( | void | ) | const |
Get an error message for the most recent error that occurred in the controller's thread.
Call this function immediately after a function has returned an error code, to get more information about the error that occurred.