X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_file.hpp;h=fb61b985d8c2e98862a95af05d37a897a1988c66;hb=ce04047159832b49f55618d76478ef264cbee462;hp=ddc36c0c8b49a616a0ff5307f40746395b1f7d63;hpb=00e0021870c9bbba51376aa32554183e1c7859ba;p=apitrace diff --git a/trace_file.hpp b/trace_file.hpp index ddc36c0..fb61b98 100644 --- a/trace_file.hpp +++ b/trace_file.hpp @@ -12,6 +12,10 @@ public: Read, Write }; + enum FlushType { + FlushShallow, + FlushDeep + }; public: static bool isZLibCompressed(const std::string &filename); static bool isSnappyCompressed(const std::string &filename); @@ -28,7 +32,7 @@ public: bool write(const void *buffer, int length); bool read(void *buffer, int length); void close(); - void flush(); + void flush(FlushType type = FlushShallow); int getc(); protected: @@ -37,7 +41,7 @@ protected: virtual bool rawRead(void *buffer, int length) = 0; virtual int rawGetc() = 0; virtual void rawClose() = 0; - virtual void rawFlush() = 0; + virtual void rawFlush(FlushType type) = 0; protected: std::string m_filename; @@ -57,7 +61,7 @@ protected: virtual bool rawRead(void *buffer, int length); virtual int rawGetc(); virtual void rawClose(); - virtual void rawFlush(); + virtual void rawFlush(FlushType type); private: void *m_gzFile; }; @@ -79,7 +83,7 @@ protected: virtual bool rawRead(void *buffer, int length); virtual int rawGetc(); virtual void rawClose(); - virtual void rawFlush(); + virtual void rawFlush(FlushType type); private: inline int freeCacheSize() const