PhoenixSocket  1.0.0
Library which integrates socket unix use in Phoenix
Loading...
Searching...
No Matches
phoenix_mock_socket.h
Go to the documentation of this file.
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
15typedef std::vector<DataStreamMsg > PVecMockMessage;
16
18
22template<typename T>
23bool phoenix_addMockMessage(PVecMockMessage & vecOutput, const T & data){
24 DataStreamMsg vecData(data_size(data));
25 DataStreamIter iter = (DataStreamIter)vecData.data();
26 if(data_message_save(iter, data)){
27 vecOutput.push_back(vecData);
28 return true;
29 }
30 return false;
31}
32
33bool phoenix_readMockSocket(PVecMockMessage & vecInput, const std::string & address, size_t port);
34
35bool phoenix_createMockSocket(PVecMockMessage & vecInput, std::string & inputFileName, std::string & outputFileName, const std::string & address, size_t port);
36
37bool phoenix_closeMockSocket(const PVecMockMessage & vecOutput, const std::string & outputFileName);
38
39#endif
bool phoenix_readMockSocket(PVecMockMessage &vecInput, const std::string &address, size_t port)
Read a mock socket.
bool phoenix_createMockSocket(PVecMockMessage &vecInput, std::string &inputFileName, std::string &outputFileName, const std::string &address, size_t port)
Create a mock socket.
bool phoenix_addMockMessage(PVecMockMessage &vecOutput, const T &data)
Add Data in a sequence of mock messages.
std::vector< DataStreamMsg > PVecMockMessage
Vector of messages.
bool phoenix_closeMockSocket(const PVecMockMessage &vecOutput, const std::string &outputFileName)
Close a mock socket.