1 #ifndef TRACE_SNAPPYFILE_HPP
2 #define TRACE_SNAPPYFILE_HPP
4 #include "trace_file.hpp"
15 #define SNAPPY_CHUNK_SIZE (1 * 1024 * 1024)
17 #define SNAPPY_BYTE1 'a'
18 #define SNAPPY_BYTE2 't'
21 class SnappyFile : public File {
23 SnappyFile(const std::string &filename = std::string(),
24 File::Mode mode = File::Read);
25 virtual ~SnappyFile();
28 virtual bool rawOpen(const std::string &filename, File::Mode mode);
29 virtual bool rawWrite(const void *buffer, int length);
30 virtual bool rawRead(void *buffer, int length);
31 virtual int rawGetc();
32 virtual void rawClose();
33 virtual void rawFlush(FlushType type);
36 inline int freeCacheSize() const
39 return m_cacheSize - (m_cachePtr - m_cache);
44 void createCache(size_t size);
46 std::fstream m_stream;
51 char *m_compressedCache;
56 #endif // TRACE_SNAPPYFILE_HPP