C++ TargetRTS
|
Represents a capsule part. More...
#include <RTActorRef.h>
Public Member Functions | |
RTActor * | getOwner (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 RTComponentDescriptor * | getInfo (void) const |
Get information (meta data) about the capsule part, such as its name, size etc. | |
RTController * | context (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. | |
RTActor * | 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). | |
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. | |
RTActor * | operator[] (int index) const |
Get the capsule instance contained in this capsule part at a certain index (0-based). | |
RTActor * | at (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 | |
RTActorRefProbe * | probe |
Friends | |
class | RTActor |
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).
RTActor * RTActorRef::at | ( | int | index | ) | const |
Get the capsule instance contained in this capsule part at a certain index (1-based).
[in] | index | One-based index. |
RTController * RTActorRef::context | ( | void | ) |
Get the controller which runs the capsule that owns this capsule part.
int RTActorRef::deport | ( | RTActor * | , |
RTImportList * | , | ||
RTController * | initiator | ||
) |
A helper function for internal use only.
Call RTFrame::deport() instead.
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.
[in] | i | The capsule instance to remove (deport). |
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.
[in] | i | The capsule instance to destroy. |
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.
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.
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.
const char * RTActorRef::getName | ( | void | ) | const |
Get the name of the capsule part.
RTActor * RTActorRef::getOwner | ( | void | ) | const |
Get the capsule to which this capsule part belongs.
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.
[in] | i | Capsule instance to import. It must be located in an optional capsule part within the same composite structure as this capsule part. |
[in] | index | The index within this capsule part where to insert the imported capsule instance. Use -1 to insert the instance at the first free slot. |
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.
[in] | cap | The capsule to incarnate. |
[in] | data | Initialization data to pass to the created capsule instance. It can be accessed from the initial transition of its state machine. |
[in] | type | Type descriptor for the data object. |
[in] | controller | The 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] | index | The 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] | factory | If 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. |
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.
int RTActorRef::indexOf | ( | const RTActor * | i | ) | const |
Return the index of a capsule instance within this capsule part.
[in] | i | Capsule instance |
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.
int RTActorRef::isFixed | ( | void | ) | const |
Determines if this capsule part is fixed, i.e.
if it always holds a fixed number of capsule instances.
int RTActorRef::isImported | ( | void | ) | const |
Determines if this is a plug-in capsule part into which capsule instances can be imported.
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).
RTActor * RTActorRef::operator[] | ( | int | index | ) | const |
Get the capsule instance contained in this capsule part at a certain index (0-based).
[in] | index | Zero-based index. |
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).