blob: d975233a5d227b4cfc2c10e0e9fb89c01e9bb750 (
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
|
/*******************************************************************************
* 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 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_ */
|