diff options
Diffstat (limited to 'src/stable/myriad.h')
-rw-r--r-- | src/stable/myriad.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/stable/myriad.h b/src/stable/myriad.h index 58f700a..c3f682d 100644 --- a/src/stable/myriad.h +++ b/src/stable/myriad.h | |||
@@ -32,7 +32,7 @@ namespace Bu | |||
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | typedef int32_t StreamId; | 34 | typedef int32_t StreamId; |
35 | enum Mode { | 35 | enum Mode : int32_t { |
36 | None = 0x00, | 36 | None = 0x00, |
37 | 37 | ||
38 | // Flags | 38 | // Flags |
@@ -75,6 +75,8 @@ namespace Bu | |||
75 | MyriadStream open( StreamId iStream, Mode eMode ); | 75 | MyriadStream open( StreamId iStream, Mode eMode ); |
76 | void erase( StreamId iStream ); | 76 | void erase( StreamId iStream ); |
77 | void setSize( StreamId iStream, int32_t iNewSize ); | 77 | void setSize( StreamId iStream, int32_t iNewSize ); |
78 | int32_t getSize( StreamId iStream ) const; | ||
79 | bool exists( StreamId iStream ) const; | ||
78 | Bu::String getLocation() const; | 80 | Bu::String getLocation() const; |
79 | int32_t getBlockSize() const; | 81 | int32_t getBlockSize() const; |
80 | int32_t getTotalBlocks() const; | 82 | int32_t getTotalBlocks() const; |
@@ -84,6 +86,12 @@ namespace Bu | |||
84 | int32_t getTotalUsedBytes() const; | 86 | int32_t getTotalUsedBytes() const; |
85 | int32_t getTotalUnusedBytes( int32_t iAssumeBlockSize=-1 ) const; | 87 | int32_t getTotalUnusedBytes( int32_t iAssumeBlockSize=-1 ) const; |
86 | 88 | ||
89 | /** | ||
90 | * Flush all caches to the backing stream, write all structural and | ||
91 | * header changes. | ||
92 | */ | ||
93 | void sync(); | ||
94 | |||
87 | private: | 95 | private: |
88 | bool loadMyriad(); | 96 | bool loadMyriad(); |
89 | void createMyriad( int32_t iBlockSize, int32_t iPreallocateBlocks ); | 97 | void createMyriad( int32_t iBlockSize, int32_t iPreallocateBlocks ); |
@@ -175,6 +183,20 @@ namespace Bu | |||
175 | IndexList lFreeBlocks; | 183 | IndexList lFreeBlocks; |
176 | StreamId iLastUsedIndex; | 184 | StreamId iLastUsedIndex; |
177 | }; | 185 | }; |
186 | constexpr Myriad::Mode operator&( Myriad::Mode a, Myriad::Mode b ) | ||
187 | { | ||
188 | return static_cast<Myriad::Mode>( | ||
189 | static_cast<std::underlying_type<Myriad::Mode>::type>(a) & | ||
190 | static_cast<std::underlying_type<Myriad::Mode>::type>(b) | ||
191 | ); | ||
192 | } | ||
193 | constexpr Myriad::Mode operator|( Myriad::Mode a, Myriad::Mode b ) | ||
194 | { | ||
195 | return static_cast<Myriad::Mode>( | ||
196 | static_cast<std::underlying_type<Myriad::Mode>::type>(a) | | ||
197 | static_cast<std::underlying_type<Myriad::Mode>::type>(b) | ||
198 | ); | ||
199 | } | ||
178 | }; | 200 | }; |
179 | 201 | ||
180 | #endif | 202 | #endif |