C++ TargetRTS
Loading...
Searching...
No Matches
RTActorRef.h
1/*
2 * Licensed Materials - Property of HCL and/or IBM
3 * Copyright HCL Technologies Ltd. 2016, 2021. All Rights Reserved.
4 * Copyright IBM Corporation 1999, 2016. All Rights Reserved.
5 *
6 * U.S. Government Users Restricted Rights - Use, duplication or
7 * disclosure restricted by GSA ADP Schedule.
8 */
9
10#ifndef __RTActorRef_h__
11#define __RTActorRef_h__ included
12
13#ifdef PRAGMA
14#pragma interface
15#endif
16
17#ifndef __RTConfig_h__
18#include <RTConfig.h>
19#endif
20
21class RTActor;
22struct RTActorClass;
24class RTActorFactory;
25class RTActorId;
26class RTActorRefProbe;
27struct RTBindingEnd;
29class RTController;
30class RTDataObject;
31union RTImportList;
32struct RTObject_class;
33
39{
40private:
41 const RTComponentDescriptor * _info;
42 void * _contents;
43
44#if USE_THREADS
45 friend class RTActor;
46
47 static void lock( void );
48 static void unlock( void );
49#endif
50
51 RTActor ** access( int ) const;
52 int reserve( int & );
53 void unreserve( int );
54 void add( RTActor *, int );
55 void remove( int );
56
57public:
58#if OBSERVABLE
59 RTActorRefProbe * probe;
60#endif
61
65 RTS_INLINE RTActor * getOwner( void ) const;
66
71 RTS_INLINE int size( void ) const;
72
77 RTS_INLINE int getId( void ) const;
78
82 RTS_INLINE const char * getName( void ) const;
83
88 RTS_INLINE const RTComponentDescriptor * getInfo( void ) const;
89
93 RTS_INLINE RTController * context( void );
94
100 void incarnateAll( void );
101
108 void initializeAll( void );
109
126 const void * data,
127 const RTObject_class * type,
128 RTController * controller,
129 int index,
130 RTActorFactory * factory = nullptr);
131
137 int destroy( void );
138
144 int destroy( RTActor * i );
145
155 int import( RTActor * i, int index);
156
159 void deport( void );
160
166 int deport( RTActor * i);
167
170 int deport( RTActor *, RTImportList *, RTController * initiator );
171
176 RTS_INLINE int isFixed( void ) const;
177
182 RTS_INLINE int isOptional( void ) const;
183
187 RTS_INLINE int isImported( void ) const;
188
193 RTS_INLINE RTActor * operator[]( int index) const;
194
199 RTS_INLINE RTActor * at( int index) const;
200
206 int indexOf( const RTActor * i) const;
207
208 RTS_INLINE RTActorRef( void );
209 ~RTActorRef( void );
210
211 RTS_INLINE int operator==( const RTActorId & ) const;
212 RTS_INLINE int operator!=( const RTActorId & ) const;
213
214 void init( const RTComponentDescriptor * info );
215
216 int _followIn( RTBindingEnd & end,
217 int portId,
218 int portIndex );
219 int _followOut( RTBindingEnd & end,
220 RTActor * member,
221 int portId,
222 int portIndex );
223
224private:
225 int bind_ports( RTActor * member,
226 int index,
227 RTActorRef * importer );
228
229 RTActor * incarnate2( const RTActorClass *,
230 RTController *,
231 int index,
232 RTActorFactoryInterface * factory = nullptr );
233
234 // unavailable methods
235 RTActorRef( const RTActorRef & );
236 RTActorRef & operator=( const RTActorRef & );
237};
238
239#if RTS_INLINES
240#include <RTActorRef.inl>
241#endif
242
243#endif // __RTActorRef_h__
A capsule factory where capsule instances are created by means of a provided 'create' function,...
Definition: RTActorFactory.h:27
Interface of a capsule factory responsible for creating and destroying capsule instances in a capsule...
Definition: RTActorFactoryInterface.h:15
An instance of this class represents a capsule instance.
Definition: RTActor.h:44
An object that identifies a capsule instance at run-time.
Definition: RTActorId.h:27
Represents a capsule part.
Definition: RTActorRef.h:39
RTActor * at(int index) const
Get the capsule instance contained in this capsule part at a certain index (1-based).
Definition: RTActorRef.inl:94
void initializeAll(void)
Initialize capsule instances that have been incarnated in a fixed capsule part.
int deport(RTActor *i)
Remove a capsule instance from a plug-in capsule part.
int size(void) const
Get the maximum number of capsule instances that can fit in the capsule part (as defined by its upper...
Definition: RTActorRef.inl:54
void deport(void)
Remove all capsule instances from a plug-in capsule part.
int deport(RTActor *, RTImportList *, RTController *initiator)
A helper function for internal use only.
const RTComponentDescriptor * getInfo(void) const
Get information (meta data) about the capsule part, such as its name, size etc.
Definition: RTActorRef.inl:42
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...
RTController * context(void)
Get the controller which runs the capsule that owns this capsule part.
Definition: RTActor.inl:135
int isFixed(void) const
Determines if this capsule part is fixed, i.e.
Definition: RTActorRef.inl:69
void incarnateAll(void)
Incarnate capsule instances into a fixed capsule part.
int getId(void) const
Get the id of the capsule part.
Definition: RTActorRef.inl:59
int destroy(void)
Destroy all capsule instances contained in the capsule part (which must be an optional capsule part).
RTActor * operator[](int index) const
Get the capsule instance contained in this capsule part at a certain index (0-based).
Definition: RTActorRef.inl:84
int isImported(void) const
Determines if this is a plug-in capsule part into which capsule instances can be imported.
Definition: RTActorRef.inl:74
int indexOf(const RTActor *i) const
Return the index of a capsule instance within this capsule part.
RTActor * getOwner(void) const
Get the capsule to which this capsule part belongs.
Definition: RTActorRef.inl:47
int destroy(RTActor *i)
Destroy a capsule instance contained in the capsule part (which must be an optional capsule part).
int isOptional(void) const
Determines if this capsule part is optional, i.e.
Definition: RTActorRef.inl:79
const char * getName(void) const
Get the name of the capsule part.
Definition: RTActorRef.inl:64
Definition: RTActorRefProbe.h:24
A controller manages a group of capsule instances that all run in the same physical thread (i....
Definition: RTController.h:54
Provides a common interface to certain data type implementations (e.g.
Definition: RTDataObject.h:33
A type descriptor providing information about the external characteristics of a capsule.
Definition: RTActorClass.h:36
Definition: RTBindingEnd.h:24
This structure describes a capsule part (a.k.a.
Definition: RTComponentDescriptor.h:33
A type descriptor providing information about a type.
Definition: RTObject_class.h:64
Definition: RTImportList.h:35