1 // UniqBlocks.h 2 3 #ifndef __UNIQ_BLOCKS_H 4 #define __UNIQ_BLOCKS_H 5 6 #include "../../Common/MyBuffer.h" 7 #include "../../Common/MyString.h" 8 9 struct C_UInt32_UString_Map 10 { 11 CRecordVector<UInt32> Numbers; 12 UStringVector Strings; 13 Add_UInt32C_UInt32_UString_Map14 void Add_UInt32(const UInt32 n) 15 { 16 Numbers.AddToUniqueSorted(n); 17 } FindC_UInt32_UString_Map18 int Find(const UInt32 n) 19 { 20 return Numbers.FindInSorted(n); 21 } 22 }; 23 24 25 struct CUniqBlocks 26 { 27 CObjectVector<CByteBuffer> Bufs; 28 CUIntVector Sorted; 29 CUIntVector BufIndexToSortedIndex; 30 31 unsigned AddUniq(const Byte *data, size_t size); 32 UInt64 GetTotalSizeInBytes() const; 33 void GetReverseMap(); 34 IsOnlyEmptyCUniqBlocks35 bool IsOnlyEmpty() const 36 { 37 return (Bufs.Size() == 0 || (Bufs.Size() == 1 && Bufs[0].Size() == 0)); 38 } 39 }; 40 41 #endif 42