Line data Source code
1 : /**
2 : *
3 : * Implementations of DaphneV3Interface's functions
4 : *
5 : * This is part of the DUNE DAQ Software Suite, copyright 2020.
6 : * Licensing/copyright details are in the COPYING file that you should have
7 : */
8 :
9 :
10 : template<class T>
11 2 : T dunedaq::daphnemodules::DaphneV3Interface::send( std::string && message, daphne::MessageTypeV2 sent_type, daphne::MessageTypeV2 received_type ) {
12 :
13 2 : std::unique_lock<std::mutex> lock(m_access_mutex);
14 :
15 2 : _send(std::move(message), sent_type);
16 :
17 0 : auto ret = _receive();
18 :
19 0 : lock.unlock();
20 :
21 0 : const auto ty = ret.type();
22 0 : T out;
23 0 : if ( ty != received_type ) {
24 0 : throw FailedDecoding(ERS_HERE, out.GetTypeName(), ret.payload(),
25 0 : TypeMismatch(ERS_HERE, MessageTypeV2_Name(ty), MessageTypeV2_Name(received_type)) );
26 : }
27 :
28 0 : if (!out.ParseFromString(ret.payload())) {
29 0 : throw FailedDecoding(ERS_HERE, out.GetTypeName(), ret.payload());
30 : }
31 :
32 0 : return out;
33 2 : }
34 :
35 :
36 :
37 :
|