24 #ifndef GRAPHLAB_BINARY_PARSER_HPP
25 #define GRAPHLAB_BINARY_PARSER_HPP
39 typedef std::ifstream base_type;
43 base_type(fname, std::ios::binary | std::ios::in) {
44 assert(bad() ==
false);
50 template<
typename T> T
read() {
54 std::cout <<
"Error reading file!" << std::endl;
62 template<
typename T>
void read(T& ret) {
65 std::cout <<
"Error reading file!" << std::endl;
74 if(ret.empty())
return;
76 sizeof(T) * ret.size());
78 std::cout <<
"Error reading file!" << std::endl;
93 typedef std::ofstream base_type;
94 using std::ofstream::bad;
97 std::ofstream(fname, std::ios::binary | std::ios::out) {
98 assert(bad() ==
false);
102 template<
typename T>
void write(T t) {
105 std::cout <<
"Error writing file!" << std::endl;