Ernesto Posse | 8a4f296 | 2015-05-12 13:28:46 -0400 | [diff] [blame] | 1 | // umlrtrtsinterface.hh |
| 2 | |
| 3 | /******************************************************************************* |
| 4 | * Copyright (c) 2015 Zeligsoft (2009) Limited and others. |
| 5 | * All rights reserved. This program and the accompanying materials |
| 6 | * are made available under the terms of the Eclipse Public License v1.0 |
| 7 | * which accompanies this distribution, and is available at |
| 8 | * http://www.eclipse.org/legal/epl-v10.html |
| 9 | *******************************************************************************/ |
| 10 | |
| 11 | #ifndef UMLRTRTSINTERFACE_HH |
| 12 | #define UMLRTRTSINTERFACE_HH |
| 13 | |
| 14 | #include <stdlib.h> |
| 15 | |
| 16 | struct UMLRTCapsule; |
| 17 | struct UMLRTCapsuleClass; |
| 18 | struct UMLRTCommsPort; |
| 19 | struct UMLRTCommsPortRole; |
| 20 | struct UMLRTSlot; |
| 21 | |
| 22 | // An instance of an object of this type is used to access the RTS from capsule-instance code. |
| 23 | |
| 24 | class UMLRTRtsInterface |
| 25 | { |
| 26 | public: |
| 27 | // Used to connect two ports. If the far-end of 'p1' already exists, it is the far-end of 'p1' that gets connected to 'p2'. |
| 28 | virtual void connectPorts ( const UMLRTCommsPort * p1, size_t p1Index, const UMLRTCommsPort * p2, size_t p2Index ) const = 0; |
| 29 | |
| 30 | // Create a connection between the far end of the 'relay' port to the 'dest' port. The relay port itself is not modified. |
| 31 | virtual void connectRelayPort ( const UMLRTCommsPort * relayPort, size_t relayIndex, const UMLRTCommsPort * destPort, size_t destIndex ) const = 0; |
| 32 | |
| 33 | // Used for creating a border-port-list from a slot, passed to a capsule instantiate function. |
| 34 | virtual const UMLRTCommsPort * * createBorderPorts ( UMLRTSlot * slot, size_t numPorts ) const = 0; |
| 35 | |
| 36 | // Create a internal port list. No ports are connected yet. |
| 37 | virtual const UMLRTCommsPort * createInternalPorts ( UMLRTSlot * slot, const UMLRTCapsuleClass * capsuleClass, size_t numPortRoles, const UMLRTCommsPortRole portRoles[] ) const = 0; |
| 38 | |
| 39 | // The capsule is declaring the port as 'bound'. The port is not a relay port. |
| 40 | virtual void bindPort ( const UMLRTCommsPort * port, int index ) const = 0; |
| 41 | |
| 42 | // The capsule is binding the port to a sub-capsule port. The port a relay port. |
| 43 | virtual void bindSubcapsulePort ( bool isBorder, UMLRTCapsule * subcapsule, int portIndex, int farEndIndex ) const = 0; |
| 44 | |
| 45 | // The capsule is unbinding its port. The port is not a relay port. |
| 46 | virtual void unbindPort ( const UMLRTCommsPort * port, int index ) const = 0; |
| 47 | |
| 48 | // The capsule is unbinding the port from a sub-capsule port. The port a relay port. |
| 49 | virtual void unbindSubcapsulePort ( bool isBorder, UMLRTCapsule * subcapsule, int portIndex, int farEndIndex ) const = 0; |
| 50 | |
| 51 | }; |
| 52 | |
| 53 | #endif // UMLRTRTSINTERFACE_HH |