X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=trace_file.hpp;h=4b1b70ddad6f6bd886ac7aa51c28f5604b281faf;hb=99f84fa0e278f4ca30577c22ede85c643c6017cc;hp=f6e77ae8b69802c88f96b8b31b48d6f3cd2c013c;hpb=46963dad18214fc45b248ecdc9f5931cf417705d;p=apitrace diff --git a/trace_file.hpp b/trace_file.hpp index f6e77ae..4b1b70d 100644 --- a/trace_file.hpp +++ b/trace_file.hpp @@ -40,9 +40,9 @@ public: Write }; struct Offset { - Offset() - : chunk(0), - offsetInChunk(0) + Offset(uint64_t _chunk = 0, uint32_t _offsetInChunk = 0) + : chunk(_chunk), + offsetInChunk(_offsetInChunk) {} uint64_t chunk; uint32_t offsetInChunk; @@ -59,8 +59,6 @@ public: bool isOpened() const; File::Mode mode() const; - std::string filename() const; - bool open(const std::string &filename, File::Mode mode); bool write(const void *buffer, size_t length); bool read(void *buffer, size_t length); @@ -71,7 +69,7 @@ public: int percentRead(); virtual bool supportsOffsets() const = 0; - virtual File::Offset currentOffset(); + virtual File::Offset currentOffset() = 0; virtual void setCurrentOffset(const File::Offset &offset); protected: virtual bool rawOpen(const std::string &filename, File::Mode mode) = 0; @@ -84,7 +82,6 @@ protected: virtual int rawPercentRead() = 0; protected: - std::string m_filename; File::Mode m_mode; bool m_isOpened; }; @@ -99,11 +96,6 @@ inline File::Mode File::mode() const return m_mode; } -inline std::string File::filename() const -{ - return m_filename; -} - inline bool File::open(const std::string &filename, File::Mode mode) { if (m_isOpened) { @@ -178,6 +170,7 @@ public: virtual bool supportsOffsets() const; + virtual File::Offset currentOffset(); protected: virtual bool rawOpen(const std::string &filename, File::Mode mode); virtual bool rawWrite(const void *buffer, size_t length);