Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8ea6bf31d64bcb7746afbdad1e2ca4b82b593c46 (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
/*
 * MessageServiceController.h
 *
 *  Created on: 22.08.2012
 *      Author: karlitsc
 */

#ifndef MESSAGESERVICECONTROLLER_H_
#define MESSAGESERVICECONTROLLER_H_

#include "common/messaging/MessageService.h"
#include "common/messaging/RTServices.h"
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>

namespace etRuntime {

class MessageServiceController {
public:
	MessageServiceController(/*IRTObject parent*/);
	virtual ~MessageServiceController();

	void addMsgSvc(MessageService& msgSvc);
	//raises an exception if the service does not exist for this threadID
	MessageService* getMsgSvc(int threadID);

	void addAsyncActor(IEventReceiver& evtReceiver);
	void pollAsyncActors();

	//the connectAll method connects all messageServices
	//it is included for test purposes
	//currently it is not called
	void connectAll();
	void start(bool singlethreaded);
	void stop(bool singlethreaded);

	//TODO: this is only for single threaded configurations
	void runOnce();

	/**
	 * waitTerminate waits blocking for all MessageServices to terminate
	 * ! not threadsafe !
	 */
	void waitTerminate();

protected:
	void dumpThreads(std::string msg);

private:
	void terminate();

	MessageServiceController(const MessageServiceController& right);
	MessageServiceController& operator=(const MessageServiceController& right);


	std::vector<MessageService*> m_messageServiceList;
	//	 IRTObject parent = null;
	bool m_running;

};

} /* namespace etRuntime */
#endif /* MESSAGESERVICECONTROLLER_H_ */

Back to the top