[Bug 570949] Allow inheriting actors to switch inherited ports from relay ports to non relay ports
Bugzilla Link | 570949 |
Status | NEW |
Importance | P3 normal |
Reported | Feb 05, 2021 04:59 EDT |
Modified | Feb 05, 2021 04:59 EDT |
Version | 3.1 |
Description
Created attachment 285453
Screenshot with current behavior
Currently it is not possible to controll whether an inherited port is a relay port or not.
In real world projects sometimes the need arises to define interfaces which consist of multiple ports. And then create different implmenentations which support these interfaces. An easy way to do that would be to create an abstract base class which can then be extended by the implementation.
Currently this forces the implementation to either always have a sub component (if the abstract class defines the ports as relay ports) or to allways handle messages direcly in its behavior.
Example:
RoomModel Inheritance {
import etrice.api.types.*
ProtocolClass PControl {
incoming {
Message start()
}
outgoing {
Message stated()
}
}
ProtocolClass PEvent {
outgoing {
Message event()
}
}
abstract ActorClass ABaseClass {
Interface {
Port ctrl: PControl
Port evt: PEvent
}
}
ActorClass ABaseUser1 extends ABaseClass {
Interface {
}
Structure {
external Port ctrl
external Port evt
}
Behavior {
}
}
ActorClass ABaseUser2 extends ABaseClass {
Structure {
ActorRef ^handler: AHandler
Binding ^handler.ctrl and ctrl
Binding ^handler.evt and evt
}
}
ActorClass AHandler {
Interface {
Port ctrl: PControl
Port evt: PEvent
}
Structure {
external Port ctrl
external Port evt
}
}
}
etrice-port-inheritance.png