C++ TargetRTS
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
RTActorRef Class Reference

Represents a capsule part. More...

#include <RTActorRef.h>

Public Member Functions

RTActorgetOwner (void) const
 Get the capsule to which this capsule part belongs.
 
int size (void) const
 Get the maximum number of capsule instances that can fit in the capsule part (as defined by its upper multiplicity).
 
int getId (void) const
 Get the id of the capsule part.
 
const char * getName (void) const
 Get the name of the capsule part.
 
const RTComponentDescriptorgetInfo (void) const
 Get information (meta data) about the capsule part, such as its name, size etc.
 
RTControllercontext (void)
 Get the controller which runs the capsule that owns this capsule part.
 
void incarnateAll (void)
 Incarnate capsule instances into a fixed capsule part.
 
void initializeAll (void)
 Initialize capsule instances that have been incarnated in a fixed capsule part.
 
RTActorincarnate (const RTActorClass &cap, const void *data, const RTObject_class *type, RTController *controller, int index, RTActorFactory *factory=nullptr)
 Incarnates a capsule and inserts the capsule instance in this capsule part (which must be an optional capsule part).
 
int destroy (void)
 Destroy all capsule instances contained in the capsule part (which must be an optional capsule part).
 
int destroy (RTActor *i)
 Destroy a capsule instance contained in the capsule part (which must be an optional capsule part).
 
int import (RTActor *i, int index)
 Import a capsule instance into this capsule part (which must be a plug-in capsule part typed by a capsule that is compatible with the type of the imported capsule instance).
 
void deport (void)
 Remove all capsule instances from a plug-in capsule part.
 
int deport (RTActor *i)
 Remove a capsule instance from a plug-in capsule part.
 
int deport (RTActor *, RTImportList *, RTController *initiator)
 A helper function for internal use only.
 
int isFixed (void) const
 Determines if this capsule part is fixed, i.e.
 
int isOptional (void) const
 Determines if this capsule part is optional, i.e.
 
int isImported (void) const
 Determines if this is a plug-in capsule part into which capsule instances can be imported.
 
RTActoroperator[] (int index) const
 Get the capsule instance contained in this capsule part at a certain index (0-based).
 
RTActorat (int index) const
 Get the capsule instance contained in this capsule part at a certain index (1-based).
 
int indexOf (const RTActor *i) const
 Return the index of a capsule instance within this capsule part.
 
int operator== (const RTActorId &) const
 
int operator!= (const RTActorId &) const
 
void init (const RTComponentDescriptor *info)
 
int _followIn (RTBindingEnd &end, int portId, int portIndex)
 
int _followOut (RTBindingEnd &end, RTActor *member, int portId, int portIndex)
 

Public Attributes

RTActorRefProbeprobe
 

Friends

class RTActor
 

Detailed Description

Represents a capsule part.

For each capsule part in the composite structure of a capsule a variable of this type is added to the RTActor subclass that is generated for that capsule. A capsule part can at run-time contain capsule instances (zero to many).

Member Function Documentation

◆ at()

RTActor * RTActorRef::at ( int  index) const

Get the capsule instance contained in this capsule part at a certain index (1-based).

Parameters
[in]indexOne-based index.
Returns
The capsule instance at the specified index, or NULL if none.

◆ context()

RTController * RTActorRef::context ( void  )

Get the controller which runs the capsule that owns this capsule part.

Returns
The controller object which runs the owner capsule instance.

◆ deport() [1/2]

int RTActorRef::deport ( RTActor ,
RTImportList ,
RTController initiator 
)

A helper function for internal use only.

Call RTFrame::deport() instead.

◆ deport() [2/2]

int RTActorRef::deport ( RTActor i)

Remove a capsule instance from a plug-in capsule part.

Consider using RTFrame::deport() instead of calling this function directly.

Parameters
[in]iThe capsule instance to remove (deport).
Returns
1 if the capsule instance was successfully deported, 0 otherwise.

◆ destroy() [1/2]

int RTActorRef::destroy ( RTActor i)

Destroy a capsule instance contained in the capsule part (which must be an optional capsule part).

Consider using RTFrame::destroy() instead of calling this function directly.

Parameters
[in]iThe capsule instance to destroy.
Returns
1 if the capsule instance was successfully destroyed, otherwise 0.

◆ destroy() [2/2]

int RTActorRef::destroy ( void  )

Destroy all capsule instances contained in the capsule part (which must be an optional capsule part).

Consider using RTFrame::destroy() instead of calling this function directly.

Returns
The number of destroyed capsule instances. 0 is returned in case of errors.

◆ getId()

int RTActorRef::getId ( void  ) const

Get the id of the capsule part.

Each capsule part has a numeric id that is unique within the composite structure of the owner capsule.

Returns
The id of the capsule part.

◆ getInfo()

const RTComponentDescriptor * RTActorRef::getInfo ( void  ) const

Get information (meta data) about the capsule part, such as its name, size etc.

This information is static and comes from the definition of the capsule part.

Returns
Information about the capsule part.

◆ getName()

const char * RTActorRef::getName ( void  ) const

Get the name of the capsule part.

Returns
The name of the capsule part.

◆ getOwner()

RTActor * RTActorRef::getOwner ( void  ) const

Get the capsule to which this capsule part belongs.

Returns
The capsule that contains this capsule part in its composite structure.

◆ import()

int RTActorRef::import ( RTActor i,
int  index 
)

Import a capsule instance into this capsule part (which must be a plug-in capsule part typed by a capsule that is compatible with the type of the imported capsule instance).

Consider using RTFrame::import() instead of calling this function directly.

Parameters
[in]iCapsule instance to import. It must be located in an optional capsule part within the same composite structure as this capsule part.
[in]indexThe index within this capsule part where to insert the imported capsule instance. Use -1 to insert the instance at the first free slot.
Returns
1 if the capsule instance was successfully imported, 0 otherwise.

◆ incarnate()

RTActor * RTActorRef::incarnate ( const RTActorClass cap,
const void *  data,
const RTObject_class type,
RTController controller,
int  index,
RTActorFactory factory = nullptr 
)

Incarnates a capsule and inserts the capsule instance in this capsule part (which must be an optional capsule part).

Consider using RTFrame::incarnate() instead of calling this function directly.

Parameters
[in]capThe capsule to incarnate.
[in]dataInitialization data to pass to the created capsule instance. It can be accessed from the initial transition of its state machine.
[in]typeType descriptor for the data object.
[in]controllerThe controller which should run the created capsule instance. If it is NULL, the same controller that runs the container capsule instance will be used.
[in]indexThe index within a replicated capsule part where to insert the created capsule instance. Use -1 to insert the instance at the first free slot.
[in]factoryIf provided this capsule factory will be used for creating the capsule instance. It can be useful if the capsule has template parameters or a custom capsule constructor should be used.
Returns
The created capsule instance.

◆ incarnateAll()

void RTActorRef::incarnateAll ( void  )

Incarnate capsule instances into a fixed capsule part.

You should not call this function explicitly - it will be implicitly called when the container capsule instance is created. That is, immediately after a capsule instance has been created all its fixed capsule parts will already contain all capsule instances they can contain.

◆ indexOf()

int RTActorRef::indexOf ( const RTActor i) const

Return the index of a capsule instance within this capsule part.

Parameters
[in]iCapsule instance
Returns
The index (0-based) of the capsule instance within this capsule part. -1 is returned in case of errors (e.g. when the capsule instance is not contained in the capsule part).

◆ initializeAll()

void RTActorRef::initializeAll ( void  )

Initialize capsule instances that have been incarnated in a fixed capsule part.

You should not call this function explicitly - it will be implicitly called when the container capsule instance is created. That is, immediately after a capsule instance has been created all its fixed capsule parts will already contain all capsule instances they can contain, and they will already be initialized.

◆ isFixed()

int RTActorRef::isFixed ( void  ) const

Determines if this capsule part is fixed, i.e.

if it always holds a fixed number of capsule instances.

Returns
1 if the capsule part is fixed, 0 otherwise.

◆ isImported()

int RTActorRef::isImported ( void  ) const

Determines if this is a plug-in capsule part into which capsule instances can be imported.

Returns
1 if the capsule part is a plug-in capsule part, 0 otherwise.

◆ isOptional()

int RTActorRef::isOptional ( void  ) const

Determines if this capsule part is optional, i.e.

if it may contain a variable number of capsule instances (including none).

Returns
1 if the capsule part is optional, 0 otherwise.

◆ operator[]()

RTActor * RTActorRef::operator[] ( int  index) const

Get the capsule instance contained in this capsule part at a certain index (0-based).

Parameters
[in]indexZero-based index.
Returns
The capsule instance at the specified index, or NULL if none.

◆ size()

int RTActorRef::size ( void  ) const

Get the maximum number of capsule instances that can fit in the capsule part (as defined by its upper multiplicity).

Returns
The size of the capsule part.

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