Skip to main content
summaryrefslogtreecommitdiffstats
blob: f0172333fdceb24f8cc35a0a413353b807e4ebd3 (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
/*******************************************************************************
 * Copyright (c) 2012 Draeger Medical GmbH (http://www.draeger.com).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * CONTRIBUTORS:
 * 		Peter Karlitschek (initial contribution)
 *
 *******************************************************************************/

#ifndef SUBSYSTEMCLASSBASE_H_
#define SUBSYSTEMCLASSBASE_H_

#include "common/containers/Map.h"
#include "common/modelbase/IEventReceiver.h"
#include "common/modelbase/IInterfaceItemOwner.h"
#include "common/modelbase/IReplicatedInterfaceItem.h"
#include "common/modelbase/RTSystemProtocol.h"
#include "etDatatypes.h"


namespace etRuntime {

class ActorClassBase;

class SubSystemClassBase: public RTObject, public virtual IEventReceiver, public virtual IInterfaceItemOwner {
public:
	virtual ~SubSystemClassBase() {}

	virtual void init();
	virtual void instantiateMessageServices() = 0;
	virtual void mapThreads(void) = 0;
	virtual void initialize(void) = 0;
	virtual void setProbesActive(bool recursive, bool active) {}

	void start();
	void stop();
	virtual void destroy();

	IMessageService* getMsgService(int idx) const;
	Address getFreeAddress(int msgSvcId) const;

	ActorClassBase* getInstance(const String& path) const;

	void addPathToThread(const String& path, int thread);
	int getThreadForPath(const String& path) const;

	void resetAll();

	virtual IEventReceiver* getEventReceiver() const {
		return const_cast<SubSystemClassBase*>(this);
	}

	virtual int getThread() {
		return 0;
	}

	virtual IReplicatedInterfaceItem* getSystemPort() const {
		return const_cast<RTSystemConjPort*>(&m_RTSystemPort);
	}

	virtual etBool hasGeneratedMSCInstrumentation() const {
		return false;
	}

protected:

	SubSystemClassBase(IRTObject* parent, String name);

	//--------------------- ports
	RTSystemConjPort m_RTSystemPort;

	//--------------------- interface item IDs
	static const int IFITEM_RTSystemPort = 0;

private:

	Map<String, int> m_path2thread;

	SubSystemClassBase();
	SubSystemClassBase(SubSystemClassBase const&);
	SubSystemClassBase& operator=(SubSystemClassBase const&);
};

} /* namespace etRuntime */
#endif /* SUBSYSTEMCLASSBASE_H_ */

Back to the top