33 #include <boost/archive/binary_iarchive.hpp> 36 #include <boost/filesystem/operations.hpp> 42 template<
class t_
object>
48 HANDLE data_file_handle = ::CreateFile(file_path.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
52 int data_file_descriptor = _open_osfhandle((
intptr_t)data_file_handle, 0);
53 if (-1 == data_file_descriptor)
55 ::CloseHandle(data_file_handle);
59 const std::unique_ptr<FILE, tools::close_file> data_file_file{_fdopen(data_file_descriptor,
"wb")};
60 if (
nullptr == data_file_file)
63 _close(data_file_descriptor);
68 std::ofstream data_file(data_file_file.get());
75 std::ofstream data_file;
76 data_file.open(file_path , std::ios_base::binary | std::ios_base::out| std::ios::trunc);
89 ::FlushFileBuffers(data_file_handle);
93 CATCH_ENTRY_L0(
"serialize_obj_to_file",
false);
96 template<
class t_
object>
101 std::ifstream data_file;
102 data_file.open( file_path, std::ios_base::binary | std::ios_base::in);
116 data_file.open( file_path, std::ios_base::binary | std::ios_base::in);
119 boost::archive::binary_iarchive
a(data_file);
122 return !data_file.fail();
123 CATCH_ENTRY_L0(
"unserialize_obj_from_file",
false);
Definition: portable_binary_iarchive.hpp:72
::std::string string
Definition: gtest-port.h:1097
Definition: portable_binary_oarchive.hpp:72
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124
#define HANDLE
Definition: mdb.c:459
#define INVALID_HANDLE_VALUE
Definition: mdb.c:465
_W64 signed int intptr_t
Definition: stdint.h:164