1 #ifndef TRACE_SNAPPYFILE_HPP
2 #define TRACE_SNAPPYFILE_HPP
4 #include "trace_file.hpp"
17 #define SNAPPY_CHUNK_SIZE (1 * 1024 * 1024)
19 #define SNAPPY_BYTE1 'a'
20 #define SNAPPY_BYTE2 't'
23 class SnappyFile : public File {
25 SnappyFile(const std::string &filename = std::string(),
26 File::Mode mode = File::Read);
27 virtual ~SnappyFile();
30 virtual bool rawOpen(const std::string &filename, File::Mode mode);
31 virtual bool rawWrite(const void *buffer, int length);
32 virtual bool rawRead(void *buffer, int length);
33 virtual int rawGetc();
34 virtual void rawClose();
35 virtual void rawFlush(FlushType type);
38 inline int freeCacheSize() const
41 return m_cacheSize - (m_cachePtr - m_cache);
46 void createCache(size_t size);
47 void writeCompressedLength(uint32_t num);
48 uint32_t readCompressedLength();
50 std::fstream m_stream;
55 char *m_compressedCache;
60 #endif // TRACE_SNAPPYFILE_HPP