/*************************************** Auteur : Pierre Aubert Mail : pierre.aubert@lapp.in2p3.fr Licence : CeCILL-C ****************************************/ #ifndef __PHOENIX_MOCK_SOCKET_H__ #define __PHOENIX_MOCK_SOCKET_H__ #include <data_size.h> #include <data_file.h> #include <data_message.h> ///Vector of messages typedef std::vector<DataStreamMsg > PVecMockMessage; ///Add Data in a sequence of mock messages /** @param[out] vecOutput : vector of messages (sequence of message) * @param data : data to be added into the message * @return true if the message has been added successfully to the vecOutput, false otherwise */ template<typename T> bool phoenix_addMockMessage(PVecMockMessage & vecOutput, const T & data){ DataStreamMsg vecData(data_size(data)); DataStreamIter iter = (DataStreamIter)vecData.data(); if(data_message_save(iter, data)){ vecOutput.push_back(vecData); return true; } return false; } bool phoenix_readMockSocket(PVecMockMessage & vecInput, const std::string & address, size_t port); bool phoenix_createMockSocket(PVecMockMessage & vecInput, std::string & inputFileName, std::string & outputFileName, const std::string & address, size_t port); bool phoenix_closeMockSocket(const PVecMockMessage & vecOutput, const std::string & outputFileName); #endif