-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathParticipantClass.cpp
59 lines (39 loc) · 1.19 KB
/
ParticipantClass.cpp
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
#include "ParticipantClass.h"
#include <dds/DCPS/Marked_Default_Qos.h>
#include <iostream>
using std::cerr;
using std::cout;
using std::endl;
using std::string;
DDS::DomainId_t DomainID{ 246 };
ParticipantClass::ParticipantClass(int argc, char* argv[]) {
createParticipant(argc, argv);
}
ParticipantClass::~ParticipantClass() {
try {
if (!CORBA::is_nil(m_participant.in())) {
m_participant->delete_contained_entities();
}
if (!CORBA::is_nil(m_participantFactory.in())) {
m_participantFactory->delete_participant(m_participant.in());
}
}
catch (CORBA::Exception& e) {
cerr << "Exception caught in cleanup." << endl << e << endl;
}
TheServiceParticipant->shutdown();
}
void ParticipantClass::createParticipant(int argc, char* argv[]) {
auto m_participantFactory = TheParticipantFactoryWithArgs(argc, argv);
m_participant = m_participantFactory->create_participant(
DomainID,
PARTICIPANT_QOS_DEFAULT,
DDS::DomainParticipantListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(m_participant.in())) {
cerr << "Participant: Failed to create participant..." << endl;
}
else {
cout << "Participant: participant created successfully" << endl;
}
}