adtf_file_library  0.13.2
indexreadtable_v201_v301.h
Go to the documentation of this file.
1 
17 #ifndef INDEX_READ_TABLE_V201_V301_CLASS_HEADER
18 #define INDEX_READ_TABLE_V201_V301_CLASS_HEADER
19 
22 
23 namespace ifhd
24 {
25 namespace 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, int64_t* chunk_offset);
185 
201  int64_t lookupChunkRef(uint16_t stream_id, int64_t pos,
202  TimeFormat time_format, int64_t *chunk_index,
203  int64_t* chunk_offset, int64_t* end_chunk_index,
204  int64_t* master_index) const;
205 
214  bool findNearestEntryWithFlags(uint16_t stream_id, uint64_t chunk_index,
215  uint16_t chunk_flags, uint64_t* master_index);
216 
223  bool validateRawMasterIndex(int32_t ref_master_table_index);
224 
225  private:
226 
227 
233  void setIndexOffsetInfos(uint16_t stream_id,
234  AdditionalIndexInfo& additional_index_info);
235 
244  void addStreamIndexTableEntry(uint16_t stream_id, StreamRef* stream_ref,
245  StreamInfoHeader* stream_info,
246  void* additional_stream_info,
247  uint64_t count);
248 
254  void addMasterIndexTableEntry(void* ref_tbl, uint64_t count);
255 
267  void getStreamRef(uint16_t stream_id, uint32_t stream_idx,
268  StreamRef *stream_ref) const;
269 };
270 
271 } //namespace
272 } // namespace
273 #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 void * getAdditionalStreamInfo(uint16_t stream_id) const
void fillChunkHeaderFromIndex(uint32_t master_idx, ChunkHeader *header, int64_t *chunk_index, int64_t *chunk_offset)
const StreamInfoHeader * getStreamInfo(uint16_t stream_id) const
bool validateRawMasterIndex(int32_t ref_master_table_index)
int64_t 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
bool streamExists(uint16_t stream_id) const
Checks either a stream exists or not.
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)
timestamp_t getFirstTime(uint16_t stream_id) const
timestamp_t getLastTime(uint16_t stream_id) const
Definition: indexedfile_v201_v301.h:86
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:270
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:214
The File header for dat-files.
Definition: indexedfile_types_v201_v301.h:101
Definition: indexedfile_types_v201_v301.h:255
Definition: indexedfile_types_v201_v301.h:243

Copyright © CARIAD SE.
Generated on Mon Jun 10 2024 by doxygen 1.9.1
GIT Commit Hash: eb3af397a6b49ad6fcad9a60d8277d909b458b48