NanoStructures  1.0
DMFT solver for layered, strongly correlated nanostructures
utils_io.h
1 #ifndef UTILS_IO_H
2 #define UTILS_IO_H
3 
4 #include <istream>
5 #include <ostream>
6 #include <sys/stat.h>
7 #include <sys/types.h>
8 
9 namespace utils {
10 namespace io {
11 template<typename T>
12 std::ostream& binary_write(std::ostream* outStream, const T& value){
13  return outStream->write(reinterpret_cast<const char*>(&value), sizeof(T));
14 }
15 template<typename T>
16 std::istream & binary_read(std::istream* stream, T& value){
17  return stream->read(reinterpret_cast<char*>(&value), sizeof(T));
18 }
19 
20 void createDirectoryStructure(std::string filePath);
21 int mkpath(const char *path, mode_t mode);
22 static int do_mkdir(const char *path, mode_t mode);
23 void appendToFile(std::string filename, int num, ...);
24 
25 
26 }
27 }
28 #endif // UTILS_IO_H