8 #ifndef BINARYOUTFILEMANAGER_H
9 #define BINARYOUTFILEMANAGER_H
14 #include <type_traits>
19 namespace serialization {
23 #include <boost/archive/binary_iarchive.hpp>
24 #include <boost/archive/binary_oarchive.hpp>
25 #include <boost/serialization/vector.hpp>
32 #include <FairMQLogger.h>
33 #include <FairMQMessage.h>
35 #define GET_POLICY_ID(Policy) #Policy
39 template<
typename T,
typename BoostArchive>
40 using BoostSerializable = baseMQ::tools::resolve::has_BoostSerialization<T, void(BoostArchive&, const unsigned int)>;
42 template<
typename TPayload,
typename TStoragePolicy = TriviallyCopyableDataSaver<TPayload>>
46 using TStoragePolicy::Read;
47 using TStoragePolicy::Write;
67 void AddToFile(TPayload* objArr,
long size) { AppendObjArray<TPayload>(
fOutfile, objArr, size); }
72 TStoragePolicy::Write(outfile, objArr, size);
75 std::vector<std::vector<TPayload>>
GetAllObj(
const std::string& filename)
78 infile = std::ifstream(filename);
79 std::vector<std::vector<TPayload>> vec = TStoragePolicy::Read(infile);
86 fOutfile = std::ofstream(
fFileName, std::ios::out | std::ios::binary | std::ios::app);
boost::archive::binary_oarchive BinArchive
baseMQ::tools::resolve::has_BoostSerialization< T, void(BoostArchive &, const unsigned int)> BoostSerializable
void AppendObjArray(std::ofstream &outfile, T *objArr, long size)
void SetFileProperties(const std::string &filename)
void AddToFile(TPayload *objArr, long size)
std::vector< std::vector< TPayload > > GetAllObj(const std::string &filename)
void AddToFile(FairMQMessage *msg)
virtual void InitOutputFile()
#define GET_POLICY_ID(Policy)
virtual ~BinaryOutFileManager()
std::string GetPolicyID()