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

Function main

DevGuideExamples/FACE/Simple/CallbackSubscriber.cpp:23–70  ·  view source on GitHub ↗

FUZZ: disable check_for_improper_main_declaration

Source from the content-addressed store, hash-verified

21
22// FUZZ: disable check_for_improper_main_declaration
23int main(int, char*[])
24{
25 // Initialize the TS interface
26 FACE::RETURN_CODE_TYPE status;
27 FACE::TS::Initialize("face_config.ini", status);
28
29 if (status != FACE::RC_NO_ERROR) {
30 return static_cast<int>(status);
31 }
32
33 // Create the sub connection
34 FACE::CONNECTION_ID_TYPE connId;
35 FACE::CONNECTION_DIRECTION_TYPE dir;
36 FACE::MESSAGE_SIZE_TYPE max_msg_size;
37 FACE::TS::Create_Connection("sub", FACE::PUB_SUB, connId, dir, max_msg_size,
38 FACE::INF_TIME_VALUE, status);
39 if (status != FACE::RC_NO_ERROR) {
40 return static_cast<int>(status);
41 }
42
43 // Register a callback
44 FACE::TS::Register_Callback(
45 connId, 0, callback, max_msg_size, status);
46
47 if (status != FACE::RC_NO_ERROR) {
48 return static_cast<int>(status);
49 }
50
51 // Give message time to be processed before exiting
52 ACE_DEBUG((LM_INFO, "Subscriber: waiting for callback\n"));
53 ACE_OS::sleep(15);
54
55 // Unregister the callback
56 FACE::TS::Unregister_Callback(connId, status);
57
58 if (status != FACE::RC_NO_ERROR) {
59 return static_cast<int>(status);
60 }
61
62 // Destroy the sub connection
63 FACE::TS::Destroy_Connection(connId, status);
64
65 if (status != FACE::RC_NO_ERROR) {
66 return static_cast<int>(status);
67 }
68
69 return EXIT_SUCCESS;
70}
71// FUZZ: enable check_for_improper_main_declaration

Callers

nothing calls this directly

Calls 4

InitializeFunction · 0.85
Create_ConnectionFunction · 0.85
Unregister_CallbackFunction · 0.85
Destroy_ConnectionFunction · 0.85

Tested by

no test coverage detected