MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / ACE_TMAIN

Function ACE_TMAIN

tests/DCPS/Serializer_wstring/subscriber.cpp:27–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using namespace std;
26
27int
28ACE_TMAIN(int argc, ACE_TCHAR* argv[])
29{
30 try {
31 DDS::DomainParticipantFactory_var dpf;
32 DDS::DomainParticipant_var participant;
33
34 dpf = TheParticipantFactoryWithArgs(argc, argv);
35 participant =
36 dpf->create_participant(111,
37 PARTICIPANT_QOS_DEFAULT,
38 DDS::DomainParticipantListener::_nil(),
39 ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
40 if (CORBA::is_nil (participant.in ())) {
41 cerr << "create_participant failed." << endl;
42 return 1 ;
43 }
44
45 MessageTypeSupportImpl::_var_type mts_servant = new MessageTypeSupportImpl;
46
47 if (DDS::RETCODE_OK != mts_servant->register_type(participant.in (),
48 "")) {
49 cerr << "Failed to register the MessageTypeTypeSupport." << endl;
50 exit(1);
51 }
52
53 CORBA::String_var type_name = mts_servant->get_type_name ();
54
55 DDS::TopicQos topic_qos;
56 participant->get_default_topic_qos(topic_qos);
57 DDS::Topic_var topic =
58 participant->create_topic("Movie Discussion List",
59 type_name.in (),
60 topic_qos,
61 DDS::TopicListener::_nil(),
62 ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
63 if (CORBA::is_nil (topic.in ())) {
64 cerr << "Failed to create_topic." << endl;
65 exit(1);
66 }
67
68 // Create the subscriber and attach to the corresponding
69 // transport.
70 DDS::Subscriber_var sub =
71 participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT,
72 DDS::SubscriberListener::_nil(),
73 ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
74 if (CORBA::is_nil (sub.in ())) {
75 cerr << "Failed to create_subscriber." << endl;
76 exit(1);
77 }
78
79 // activate the listener
80 DDS::DataReaderListener_var listener (new DataReaderListenerImpl);
81 if (CORBA::is_nil (listener.in ())) {
82 cerr << "listener is nil." << endl;
83 exit(1);
84 }

Callers

nothing calls this directly

Calls 15

get_default_topic_qosMethod · 0.80
delete_participantMethod · 0.80
create_participantMethod · 0.45
inMethod · 0.45
register_typeMethod · 0.45
get_type_nameMethod · 0.45
create_topicMethod · 0.45
create_subscriberMethod · 0.45
create_datareaderMethod · 0.45
received_allMethod · 0.45
passedMethod · 0.45

Tested by

no test coverage detected