-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcorbaComm.cc
70 lines (59 loc) · 1.97 KB
/
corbaComm.cc
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
#include <string>
#include "corbaComm.h"
#include "corbaComm_impl.h"
cc::CorbaComm* cc::CorbaComm::_ccserver = nullptr;
cc::CorbaCommImpl* cc::CorbaComm::_impl = nullptr;
cc::CorbaComm::~CorbaComm()
{
delete cc::CorbaComm::_impl;
}
// static
cc::CorbaComm* cc::CorbaComm::connect(const char* hostId,
cc::Commands offerCommands,
cc::Commands wantCommands,
int argc,
char* argv[])
{
if (nullptr == _ccserver) {
cc::CorbaComm::_ccserver = new cc::CorbaComm(hostId,
offerCommands,
wantCommands,
argc, argv);
}
return cc::CorbaComm::_ccserver;
}
cc::SID cc::CorbaComm::onEvent(const char* topic,
cc::EventCallback_t callback)
{
return cc::CorbaComm::_impl->onEvent(topic, callback);
}
void cc::CorbaComm::detachEvent(const cc::SID& sid)
{
cc::CorbaComm::_impl->detachEvent(sid);
}
bool cc::CorbaComm::pushEvent(const char* topic,
const char* param)
{
return cc::CorbaComm::_impl->pushEvent(topic, param);
}
std::string cc::CorbaComm::execCmd(const char* cmd, const char* param)
{
return cc::CorbaComm::_impl->execCmd(cmd, param);
}
void cc::CorbaComm::onCmd(const char* cmd,
cc::CommandCallback_t cmdCallback)
{
cc::CorbaComm::_impl->onCmd(cmd, cmdCallback);
}
//private
cc::CorbaComm::CorbaComm(const char* hostId,
cc::Commands offerCommands,
cc::Commands wantCommands,
int argc, char* argv[])
{
cc::CorbaComm::_impl =
new cc::CorbaCommImpl(hostId,
offerCommands,
wantCommands,
argc, argv);
}