Recursive actor definition |
Category: |
Modeling
Purpose: |
Describe rules for advanced structure modeling
Intended Audience: |
All ObjecTime model developers
Applicable to: |
All Versions
Description: |
It is not possible to have an actor class which has references to itself. You can, however, create a subclass which contains references to the superclass. This is the way to model a recursive relationship.
Let's say you need to have a recursive defintion of a class called Service. In order to accomplish this, you must define a subclass of the class Service, call it ServiceSub for this explanation. In ServiceSub, you can add references to Service.
However, in order for this to compile and run, these references must be optional, and you must use the Frame Service to incarnate these references dynamically (See the description of the Frame Service in the ObjecTime RPL or C++ guide). By making the reference to Service an optional actor inside ServiceSub, you can incarnate that reference as any subclass of service you want at run-time.
For example, ServiceSub and Function are kind-of Service. In this case the class hierarchy might look like this:
-Service
-ServiceSub
-Function
In ServiceSub, there is a replicated, optional reference to Service. You may then incarnate actors inside ServiceSub at run-time. These actors must be subclasses of service, e.g. other ServiceSubs
Limitations: |
None
See also: |
Description of optional actors and incarnate method in ObjecTime User documentation(RPL Guide or C++ Guide).
5.0 Users, see Recursion model example.
Copyright © 1999, ObjecTime Limited. |