Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 83301edb34b34d65bc2b700c1d020a98391945d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
 * @author generated by eTrice
 *
 * Header File of ProtocolClass RTSystemServicesProtocol
 *
 */

#ifndef _COMMON_MODELBASE_RTSYSTEMSERVICESPROTOCOL_H_
#define _COMMON_MODELBASE_RTSYSTEMSERVICESPROTOCOL_H_

#include "common/modelbase/InterfaceItemBase.h"
#include "common/modelbase/PortBase.h"
#include "common/modelbase/ReplicatedInterfaceItemBase.h"
#include "common/modelbase/ReplicatedPortBase.h"
#include "common/etDatatypesCpp.hpp"




class RTSystemServicesProtocol {
   public:
		/* message IDs */
		typedef enum {
			MSG_MIN = 0,
			IN_executeInitialTransition = 1,
			IN_startDebugging = 2,
			IN_stopDebugging = 3,
			MSG_MAX = 4
		} msg_ids;


		static bool isValidEvtID(int evtId) {
			return ((MSG_MIN < evtId) && (evtId < MSG_MAX));
		}
		static bool isValidOutgoingEvtID(int evtId) {
			return ((MSG_MIN < evtId) && (evtId < IN_executeInitialTransition));
		}
		static bool isValidIncomingEvtID(int evtId) {
			return ((IN_executeInitialTransition <= evtId) && (evtId < MSG_MAX));
		}
		static const etRuntime::String& getMessageString(int msg_id);

	private:
		static const etRuntime::String s_messageStrings[];

};

//------------------------------------------------------------------------------------------------------------
// port class
//------------------------------------------------------------------------------------------------------------
class RTSystemServicesProtocolPort : public etRuntime::PortBase {
   public:
	 RTSystemServicesProtocolPort(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);
	 RTSystemServicesProtocolPort(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId, int idx);

	virtual void destroy();

	 virtual void receive(const etRuntime::Message* m);


	 // sent messages
};

//------------------------------------------------------------------------------------------------------------
// replicated port class
//------------------------------------------------------------------------------------------------------------
class RTSystemServicesProtocolReplPort : public etRuntime::ReplicatedPortBase {

	public:
		RTSystemServicesProtocolReplPort(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);

		int getReplication() const { return getNInterfaceItems(); }
		int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); }
		RTSystemServicesProtocolPort& get(int idx) const { return *dynamic_cast<RTSystemServicesProtocolPort*>(getInterfaceItem(idx)); }

		// outgoing messages

	protected:
		virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const etRuntime::String& name, int lid, int idx) {
			return new RTSystemServicesProtocolPort(rcv, name, lid, idx);
		}

};
//------------------------------------------------------------------------------------------------------------
// conjugated port class
//------------------------------------------------------------------------------------------------------------
class RTSystemServicesProtocolConjPort : public etRuntime::PortBase {
   public:
	 RTSystemServicesProtocolConjPort(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);
	 RTSystemServicesProtocolConjPort(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId, int idx);

	virtual void destroy();

	 virtual void receive(const etRuntime::Message* m);


	 // sent messages
	public: void executeInitialTransition();
	private: void executeInitialTransition_impl();
	public: void startDebugging();
	private: void startDebugging_impl();
	public: void stopDebugging();
	private: void stopDebugging_impl();
};

//------------------------------------------------------------------------------------------------------------
// conjugated replicated port class
//------------------------------------------------------------------------------------------------------------
class RTSystemServicesProtocolConjReplPort : public etRuntime::ReplicatedPortBase {

	public:
		RTSystemServicesProtocolConjReplPort(etRuntime::IInterfaceItemOwner* actor, const etRuntime::String& name, int localId);

		int getReplication() const { return getNInterfaceItems(); }
		int getIndexOf(const etRuntime::InterfaceItemBase& ifitem) const { return ifitem.getIdx(); }
		RTSystemServicesProtocolConjPort& get(int idx) const { return *dynamic_cast<RTSystemServicesProtocolConjPort*>(getInterfaceItem(idx)); }

		// incoming messages
		public: void executeInitialTransition();
		public: void startDebugging();
		public: void stopDebugging();

	protected:
		virtual etRuntime::InterfaceItemBase* createInterfaceItem(etRuntime::IInterfaceItemOwner* rcv, const etRuntime::String& name, int lid, int idx) {
			return new RTSystemServicesProtocolConjPort(rcv, name, lid, idx);
		}

};


#endif /* _COMMON_MODELBASE_RTSYSTEMSERVICESPROTOCOL_H_ */

Back to the top