3.1 Actors

3.1.1 Description

The actor is the basic structural building block for building systems with ROOM. An actor can be refined hierarchically and thus can be of arbitrarily large scope. Ports define the interface of an actor. An actor can also have a behavior usually defined by a finite state machine.

3.1.2 Motivation

3.1.3 Notation


Table 3.1: Actor Class Notation



Element Graphical Notation Textual Notation



ActorClass PIC

ActorClass ActorClass2 {}




ActorRef PIC

ActorClass ActorClass1 { 
 Structure { 
   ActorRef ActorReference: ActorClass2 
 } 
}





3.1.4 Details

Actor Classes, Actor References, Ports and Bindings

An ActorClass defines the type (or blueprint) of an actor. Hierarchies are built by ActorClasses that contain ActorReferences which have another ActorClass as type. The interface of an ActorClass is always defined by Ports. The ActorClass can also contain Attributes, Operations and a finite StateMachine.

External Ports define the external interface of an actor and are defined in the Interface section of the ActorClass.

Internal Ports define the internal interface of an actor and are defined in the Structure section of the ActorClass.

Bindings connect Ports inside an ActorClass.

Let us have a look at example 3.2:


Table 3.2: Actor Class Example



Graphical Notation Textual Notation



PIC

ActorClass ActorClass1 { 
 Interface { 
   Port port1: ProtocolClass1 
   Port port4: ProtocolClass1 
 } 
 Structure { 
   external Port port1 
   conjugated Port port2: ProtocolClass1 
   conjugated Port port3: ProtocolClass1 
   ActorRef ActorRef_A: ActorClass2 
   ActorRef ActorRef_B: ActorClass3 
   Binding port2 and ActorRef_A.port5 
   Binding port3 and ActorRef_B.port6 
   Binding ActorRef_B.port7 and port4 
   Binding ActorRef_A.port8 and ActorRef_B.port9 
 } 
}





Attributes

Attributes are part of the Structure of an actor class. They can be of a PrimitiveType or a DataClass.

Example:

ActorClass ActorClass3 { 
 Structure { 
   Attribute attribute1: int32    // attribute of primitive type 
   Attribute attribute2: DataClass1 // attribute of DataClass type 
 } 
}

Operations

Operations are part of the Behavior of an actor class. Arguments and return values can be of a PrimitiveType or a DataClass. Data classes can be passed by value (implicit) or by reference (ref).

Example:

ActorClass ActorClass4 { 
 Behavior { 
   // no arguments, no return value 
   Operation operation1(): void { 
    "UserCodeLine1" 
   } 
   // argument of primitive type, return value of primitive type 
   Operation operation2(Param1: int32, Param2: float64): uint16 { 
    "UserCodeLine1" 
   } 
   // arguments and return value by value 
   Operation operation3(Param1: int32, Param2: DataClass1): DataClass1 { 
    "UserCodeLine1" 
   } 
   // arguments and return value by reference except for primitive types 
   Operation operation4(Param1: int32, Param2: DataClass1 ref): DataClass1 ref { 
    "UserCodeLine1" 
   } 
 } 
}