Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d4a8f78970238ee6e73c5653ef02c7c03761f706 (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
/*******************************************************************************
 * 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 ABSTRACTMESSAGERECEIVER_H_
#define ABSTRACTMESSAGERECEIVER_H_

#include "common/messaging/Address.h"
#include "common/messaging/IMessageReceiver.h"
#include "common/messaging/RTObject.h"
#include <string>

namespace etRuntime {

class AbstractMessageReceiver: public RTObject, public virtual IMessageReceiver {

public:

	virtual ~AbstractMessageReceiver() {}

	virtual const Address& getAddress() const {
		return m_address;
	}

protected:
	AbstractMessageReceiver(IRTObject* parent, const std::string& name) :
			RTObject(parent, name),
			m_address(Address::EMPTY) {
	}

	AbstractMessageReceiver(IRTObject* parent, const Address& address, const std::string& name) :
			RTObject(parent, name),
			m_address(address) {
	}

	void setAddress(const Address& address) {
		m_address = address;
	}

	virtual std::string toString() const {
		return getName() + " " + m_address.toID();
	}

private:
	Address m_address;

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

}
#endif /* ABSTRACTMESSAGERECEIVER_H_ */

Back to the top