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

Function callback

tests/FACE/Header/Subscriber/Subscriber.cpp:20–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19
20void callback(FACE::TRANSACTION_ID_TYPE txn,
21 HeaderTest::Message& msg,
22 FACE::MESSAGE_TYPE_GUID message_type_id,
23 FACE::MESSAGE_SIZE_TYPE message_size,
24 const FACE::WAITSET_TYPE,
25 FACE::RETURN_CODE_TYPE& return_code)
26{
27 ++callback_count;
28 expected = msg.count + 1;
29 std::cout << "In callback() (the " << callback_count << " time): " << msg.text.in()
30 << "\t" << msg.count << "\tmsg_instance_guid: " << std::hex << msg.msg_instance_guid
31 << std::dec << "\tmessage_type_id: " << message_type_id << "\tmessage_size: "
32 << message_size << "\ttransaction_id: " << txn << std::endl;
33 callbackHappened = true;
34 FACE::TS::MessageHeader hdr;
35 FACE::TS::Receive_Message(connId, timeout, txn, hdr, sizeof(FACE::TS::MessageHeader), return_code);
36 if (return_code != FACE::RC_NO_ERROR) {
37 std::cout << "ERROR: In callback() - Receive header failed for tid: " << txn << " with status: " << return_code << std::endl;
38 return;
39 }
40 std::cout << "In callback() Message Header - tid: " << txn
41 << "\n\tplatform view guid: " << hdr.platform_view_guid
42 << "\n\tsource timestamp: " << hdr.message_timestamp
43 << "\n\tinstance guid: " << std::hex << hdr.message_instance_guid
44 << "\n\tsource guid: " << std::dec << hdr.message_source_guid
45 << "\n\tvalidity " << hdr.message_validity << std::endl;
46 if (hdr.message_source_guid != 9645061) {
47 std::cout << "ERROR: Receive_Message for header failed. Header source guid " << hdr.message_source_guid << " does not equal 9645061" << std::endl;
48 return_code = FACE::INVALID_PARAM;
49 return;
50 }
51 if (hdr.message_instance_guid != msg.msg_instance_guid) {
52 std::cout << "ERROR: Receive_Message for header failed. message_instance_guid " << std::hex << hdr.message_instance_guid
53 << " != " << msg.msg_instance_guid << std::endl;
54 return_code = FACE::INVALID_PARAM;
55 return;
56 }
57 if (callback_count == 10) {
58 ACE_DEBUG((LM_INFO, "Subscriber: about to Unregister_Callback()\n"));
59 FACE::TS::Unregister_Callback(connId, return_code);
60 if (return_code != FACE::RC_NO_ERROR) return;
61 callback_unregistered = true;
62 }
63 return_code = FACE::RC_NO_ERROR;
64}
65
66int ACE_TMAIN(int, ACE_TCHAR*[])
67{

Callers 1

SyncServer_i.hFile · 0.50

Calls 3

Receive_MessageFunction · 0.85
Unregister_CallbackFunction · 0.85
inMethod · 0.45

Tested by

no test coverage detected