utils.hpp (747B)
1 #ifndef UUID_9AE0723F_DD0B_434B_8880_D7981FAF1F20 2 #define UUID_9AE0723F_DD0B_434B_8880_D7981FAF1F20 3 #pragma once 4 5 #include <boost/filesystem/path.hpp> 6 7 #include <cstdint> 8 #include <cstdlib> 9 #include <iosfwd> 10 11 namespace Neptools 12 { 13 class Source; // fwd 14 15 using Byte = unsigned char; 16 17 using FilePosition = std::uint64_t; 18 using FileMemSize = std::size_t; 19 20 static constexpr const std::size_t MEM_CHUNK = 8*1024; // 8KiB 21 static constexpr const std::size_t MMAP_CHUNK = 128*1024; // 128KiB 22 static constexpr const std::size_t MMAP_LIMIT = 1*1024*1024; // 1MiB 23 24 std::ofstream OpenOut(const boost::filesystem::path& pth); 25 std::ifstream OpenIn(const boost::filesystem::path& pth); 26 27 void DumpBytes(std::ostream& os, Source data); 28 } 29 #endif