Directory: | ./ |
---|---|
File: | tmp_project/PhoenixSocket/src/phoenix_mock_socket.h |
Date: | 2025-03-14 12:18:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 7 | 8 | 87.5% |
Branches: | 5 | 6 | 83.3% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #ifndef __PHOENIX_MOCK_SOCKET_H__ | ||
8 | #define __PHOENIX_MOCK_SOCKET_H__ | ||
9 | |||
10 | #include <data_size.h> | ||
11 | #include <data_file.h> | ||
12 | #include <data_message.h> | ||
13 | |||
14 | ///Vector of messages | ||
15 | typedef std::vector<DataStreamMsg > PVecMockMessage; | ||
16 | |||
17 | ///Add Data in a sequence of mock messages | ||
18 | /** @param[out] vecOutput : vector of messages (sequence of message) | ||
19 | * @param data : data to be added into the message | ||
20 | * @return true if the message has been added successfully to the vecOutput, false otherwise | ||
21 | */ | ||
22 | template<typename T> | ||
23 | 9 | bool phoenix_addMockMessage(PVecMockMessage & vecOutput, const T & data){ | |
24 |
2/2✓ Branch 2 taken 9 times.
✓ Branch 5 taken 9 times.
|
9 | DataStreamMsg vecData(data_size(data)); |
25 | 9 | DataStreamIter iter = (DataStreamIter)vecData.data(); | |
26 |
2/3✓ Branch 1 taken 9 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
|
9 | if(data_message_save(iter, data)){ |
27 |
1/1✓ Branch 1 taken 9 times.
|
9 | vecOutput.push_back(vecData); |
28 | 9 | return true; | |
29 | } | ||
30 | ✗ | return false; | |
31 | 9 | } | |
32 | |||
33 | bool phoenix_readMockSocket(PVecMockMessage & vecInput, const std::string & address, size_t port); | ||
34 | |||
35 | bool phoenix_createMockSocket(PVecMockMessage & vecInput, std::string & inputFileName, std::string & outputFileName, const std::string & address, size_t port); | ||
36 | |||
37 | bool phoenix_closeMockSocket(const PVecMockMessage & vecOutput, const std::string & outputFileName); | ||
38 | |||
39 | #endif | ||
40 |