C++ TargetRTS
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
RTController Class Referenceabstract

A controller manages a group of capsule instances that all run in the same physical thread (i.e. More...

#include <RTController.h>

Inheritance diagram for RTController:
RTJob RTPeerController RTSoleController RTAbortController RTCustomController RTTimerController

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.
 
RTDebuggerdebugger (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)
 
RTMessagenewMsg (void)
 
void freeMsg (RTMessage *)
 
RTTimerNodenewTimerNode (void)
 
void freeTimerNode (RTTimerNode *node)
 
RTMessagegetReplyBuffer (void)
 
RTMessagesetReplyBuffer (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
 

Detailed Description

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.

Member Function Documentation

◆ abort()

void RTController::abort ( void  )

Abort the application.

Calling this function is equivalent to calling kill() on the main thread's controller.

◆ debugger()

RTDebugger * RTController::debugger ( void  )

Get the debugger associated with this controller, if any.

Returns
The controller's debugger (NULL if none).

◆ getError()

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.

Returns
The error code for the most recent error that occurred in the controller's thread

◆ kill()

virtual void RTController::kill ( void  )
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.

◆ name()

virtual const char * RTController::name ( void  ) const
overridevirtual

Get the name of the controller, which is the name of its physical thread (as defined in the transformation configuration).

Returns
The name of the controller

Implements RTJob.

◆ perror()

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.

Parameters
sA string that will precede the error message.

◆ printStats()

virtual void RTController::printStats ( void  ) const
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.

◆ setError()

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.

Parameters
errorError code
primitiveIdentifies the primitive action that failed
infoA context object associated with the error (may be NULL)
detailAn additional detailed context object associated with the error (may be NULL)

◆ strerror()

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.

Returns
The error message for the most recent error that occurred in the controller's thread

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