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

Function ACE_TMAIN

tests/DCPS/StringKey/publisher.cpp:27–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) {
28 try
29 {
30 DDS::DomainParticipantFactory_var dpf =
31 TheParticipantFactoryWithArgs(argc, argv);
32 DDS::DomainParticipant_var participant =
33 dpf->create_participant(111,
34 PARTICIPANT_QOS_DEFAULT,
35 DDS::DomainParticipantListener::_nil(),
36 ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
37 if (CORBA::is_nil (participant.in ())) {
38 cerr << "create_participant failed." << endl;
39 return 1;
40 }
41
42 MessageTypeSupport_var mts = new MessageTypeSupportImpl();
43
44 if (DDS::RETCODE_OK != mts->register_type(participant.in (), "")) {
45 cerr << "register_type failed." << endl;
46 exit(1);
47 }
48
49 CORBA::String_var type_name = mts->get_type_name ();
50
51 DDS::Topic_var topic =
52 participant->create_topic ("Movie Discussion List",
53 type_name.in (),
54 TOPIC_QOS_DEFAULT,
55 DDS::TopicListener::_nil(),
56 ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
57 if (CORBA::is_nil (topic.in ())) {
58 cerr << "create_topic failed." << endl;
59 exit(1);
60 }
61
62 DDS::Publisher_var pub =
63 participant->create_publisher(PUBLISHER_QOS_DEFAULT,
64 DDS::PublisherListener::_nil(), ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
65 if (CORBA::is_nil (pub.in ())) {
66 cerr << "create_publisher failed." << endl;
67 exit(1);
68 }
69
70 // Create the datawriter
71 DDS::DataWriter_var dw =
72 pub->create_datawriter(topic.in (),
73 DATAWRITER_QOS_DEFAULT,
74 DDS::DataWriterListener::_nil(),
75 ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
76 if (CORBA::is_nil (dw.in ())) {
77 cerr << "create_datawriter failed." << endl;
78 exit(1);
79 }
80 Writer* writer = new Writer(dw.in());
81
82 writer->start ();
83 while ( !writer->is_finished()) {
84 ACE_Time_Value small_time(0, 250000);

Callers

nothing calls this directly

Calls 13

delete_participantMethod · 0.80
startMethod · 0.65
create_participantMethod · 0.45
inMethod · 0.45
register_typeMethod · 0.45
get_type_nameMethod · 0.45
create_topicMethod · 0.45
create_publisherMethod · 0.45
create_datawriterMethod · 0.45
is_finishedMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected