ADTF File Library
Loading...
Searching...
No Matches
indexreadtable_v201_v301.h
Go to the documentation of this file.
1
16
17#ifndef INDEX_READ_TABLE_V201_V301_CLASS_HEADER
18#define INDEX_READ_TABLE_V201_V301_CLASS_HEADER
19
22
23namespace ifhd
24{
25namespace v201_v301
26{
27
32{
33 private:
34 struct IndexTable
35 {
36 IndexTable():index_table_offset(0), index_count(0), last_index(0), index_offset(0) {}
37
38 uint64_t index_table_offset;
39 uint64_t index_count;
40 //the timestamp of the last index entry
41 timestamp_t last_index;
42 //the chunk position of the last index entry
43 uint64_t index_offset;
44 };
45
46 struct MasterIndexTable: public IndexTable
47 {
48 MasterIndexTable() :
49 master_chunk_ref_table(nullptr)
50 {}
51
52 ChunkRef *master_chunk_ref_table;
53 };
54
55 struct StreamIndexTable: public IndexTable
56 {
57 StreamIndexTable() :
58 stream_info_header(nullptr),
59 stream_ref_table(nullptr),
60 additional_stream_info(nullptr)
61 {}
62
63 StreamInfoHeader* stream_info_header;
64 StreamRef* stream_ref_table;
65 void* additional_stream_info;
66 };
67
68 typedef std::vector<StreamIndexTable> StreamIndexTableVector;
69
70 // master table
71 MasterIndexTable _master_index_table;
72
73 // stream tables
74 StreamIndexTable _stream_index_tables[max_indexed_streams + 1];
75
76 // pointer to indexed source file
77 IndexedFile* _indexed_file;
78 FileHeader* _file_header;
79
80 public:
81
86 void create(IndexedFile *indexed_file);
87
92
96 void free();
97
107 std::string getStreamName(uint16_t stream_id) const;
108
115 bool streamExists(uint16_t stream_id) const;
116
126 const StreamInfoHeader* getStreamInfo(uint16_t stream_id) const;
127
128
138 timestamp_t getFirstTime(uint16_t stream_id) const;
139
149 timestamp_t getLastTime(uint16_t stream_id) const;
150
160 const void* getAdditionalStreamInfo(uint16_t stream_id) const;
161
168 int64_t getItemCount(uint16_t stream_id) const;
169
175
183 void fillChunkHeaderFromIndex(uint32_t master_idx, ChunkHeader* header,
184 int64_t* chunk_index,
185 int64_t* chunk_offset);
186
194 void validatePosition(uint16_t stream_id, int64_t pos, TimeFormat time_format) const;
195
208 void lookupChunkRef(uint16_t stream_id, int64_t pos,
209 TimeFormat time_format, int64_t *chunk_index,
210 int64_t* chunk_offset, int64_t* end_chunk_index,
211 int64_t* master_index) const;
212
221 bool findNearestEntryWithFlags(uint16_t stream_id, uint64_t chunk_index,
222 uint16_t chunk_flags, uint64_t* master_index);
223
230 bool validateRawMasterIndex(int32_t ref_master_table_index);
231
232 private:
233
234
240 void setIndexOffsetInfos(uint16_t stream_id,
241 AdditionalIndexInfo& additional_index_info);
242
251 void addStreamIndexTableEntry(uint16_t stream_id, StreamRef* stream_ref,
252 StreamInfoHeader* stream_info,
253 void* additional_stream_info,
254 uint64_t count);
255
261 void addMasterIndexTableEntry(void* ref_tbl, uint64_t count);
262
274 void getStreamRef(uint16_t stream_id, uint32_t stream_idx,
275 StreamRef *stream_ref) const;
276};
277
278} //namespace
279} // namespace
280#endif // _INDEX_READ_TABLE_V201_V301_CLASS_HEADER_
Definition indexreadtable_v201_v301.h:32
bool findNearestEntryWithFlags(uint16_t stream_id, uint64_t chunk_index, uint16_t chunk_flags, uint64_t *master_index)
const StreamInfoHeader * getStreamInfo(uint16_t stream_id) const
void fillChunkHeaderFromIndex(uint32_t master_idx, ChunkHeader *header, int64_t *chunk_index, int64_t *chunk_offset)
bool validateRawMasterIndex(int32_t ref_master_table_index)
bool streamExists(uint16_t stream_id) const
Checks either a stream exists or not.
void validatePosition(uint16_t stream_id, int64_t pos, TimeFormat time_format) const
void create(IndexedFile *indexed_file)
std::string getStreamName(uint16_t stream_id) const
int64_t getItemCount(uint16_t stream_id) const
void adjustChunkHeader(ChunkHeader *header)
const void * getAdditionalStreamInfo(uint16_t stream_id) const
void lookupChunkRef(uint16_t stream_id, int64_t pos, TimeFormat time_format, int64_t *chunk_index, int64_t *chunk_offset, int64_t *end_chunk_index, int64_t *master_index) const
timestamp_t getFirstTime(uint16_t stream_id) const
timestamp_t getLastTime(uint16_t stream_id) const
Definition indexedfile_v201_v301.h:86
namespace for indexed file definitions in version 2.0, 2.1, 3.0 and 3.1
Definition indexedfile_types_v201_v301.h:28
TimeFormat
Definition indexedfile_types_v201_v301.h:57
namespace for IFHD File library
Definition indexedfile_types.h:30
Additional index table information.
Definition indexedfile_types_v201_v301.h:271
header for chunks Each Chunk header 16 Byte aligned within the file.
Definition indexedfile_types_v201_v301.h:189
header for a chunk reference
Definition indexedfile_types_v201_v301.h:215
The File header for dat-files.
Definition indexedfile_types_v201_v301.h:99
Definition indexedfile_types_v201_v301.h:256
Definition indexedfile_types_v201_v301.h:244