adtf_file_library  0.13.2
indexedfile_v110.h
Go to the documentation of this file.
1 
17 #ifndef INDEXEDFILE_V110_CLASS_HEADER
18 #define INDEXEDFILE_V110_CLASS_HEADER
19 
21 
22 #include <list>
23 
24 namespace ifhd
25 {
29 namespace v110
30 {
31 
32 //*************************************************************************************************
33 /*
34 
35  FILE LAYOUT:
36 
37  +---------------------------------------------------------------+
38  |HDR| DATA |HDR-EXT| IDX |
39  +---------------------------------------------------------------+
40 
41 */
42 
44 static constexpr uint32_t version_id = 0x00000110;
45 
46 
47 
52 {
53  public:
54  enum
55  {
65  tf_chunk_time = 2
66  };
67 
68 #ifdef WIN32
69 #pragma pack(push)
70 #pragma pack(1)
71 #else
72 #pragma pack(push)
73 #pragma pack(1)
74 #endif
82  typedef struct TagFileHeader
83  {
85  uint32_t file_id;
87  uint32_t version_id;
91  uint32_t extension_count;
93  uint32_t reserved1;
99  uint64_t index_count;
103  uint64_t duration;
107  uint64_t chunk_count;
109  uint64_t max_chunk_size;
111  uint64_t reserved2[5];
113  int8_t description[1912];
114  } FileHeader; // filled up to 2048 Bytes
115 
119  typedef struct TagFileExtension
120  {
122  int8_t identifier[32];
124  uint32_t type_id;
126  uint32_t version_id;
132  uint8_t reserved[8];
134 
139  typedef struct TagChunkHeader
140  {
142  uint64_t time_stamp;
144  uint64_t ref_index;
146  uint32_t size;
148  uint32_t flags;
150  uint64_t reserved;
152 
156  typedef struct TagChunkRef
157  {
159  uint64_t time_stamp;
161  uint32_t size;
163  uint32_t flags;
165  uint64_t chunk_offset;
167  uint64_t chunk_index;
169 
170 #ifdef WIN32
171 #pragma pack(pop)
172 #else
173 #pragma pack(pop)
174 #endif
175 
179  typedef struct TagIndexBlockItem
180  {
182  int data_size;
186 
188  typedef enum
189  {
190  sf_default = 0x0,
191  sf_keydata = 0x1
193 
195  typedef enum
196  {
197  om_none = 0x0,
198  om_query_info = 0x4
200 
201  protected:
202 
203  static int default_block_size;
204  static int default_cache_size;
206 
208 
210 
212 
213  uint8_t* _buffer;
215 
218 
220 
222  typedef struct
223  {
227 
228  typedef std::list<FileExtensionStruct*> FileExtensionList;
230 
231  void* _cache;
233 
234  bool _write_mode;
235 
236  public:
241 
246 
250  void close();
251 
256  void setDescription(const std::string& description);
257 
262  std::string getDescription() const;
263 
268  void setDateTime(const a_util::datetime::DateTime* date_time);
269 
274  void getDateTime(a_util::datetime::DateTime* date_time) const;
275 
280  int getExtensionCount() const;
281 
289  bool findExtension(const std::string& identifier, FileExtension** extension_info, void** data) const;
290 
297  void getExtension(int index, FileExtension** extension_info, void** data) const;
298 
307  void appendExtension(const std::string& identifier,
308  const void* data,
309  int data_size,
310  uint32_t type_id=0,
311  uint32_t version_id=0);
312 
318  void appendExtension(const void* data, const FileExtension* extension_info);
319 
324 
329  void getHeader(FileHeader** file_header) const;
330 
331  protected:
335  void initialize();
336 
341  void allocBuffer(int size);
345  void freeBuffer();
346 
352  void appendIndex(uint64_t pos, timestamp_t time_stamp);
357  void allocIndexBlock(int count=-1);
362 
366  void allocHeader();
370  void freeHeader();
376  void allocExtensionPage(utils5ext::FileSize size, void** data);
377 
378  protected:
383  void allocCache(int size);
387  void freeCache();
392  void* getCacheAddr();
393 
399  int getSectorSize(const a_util::filesystem::Path& filename) const;
400 
406  void* internalMalloc(int size);
411  void internalFree(void* memory);
412 };
413 
414 } // namespace v110
415 } // namespace ifhd
416 
417 //*************************************************************************************************
418 #endif // _INDEXEDFILE_V110_CLASS_HEADER_
struct ifhd::v100::IndexedFileV100::TagDateTime DateTime
Definition: indexedfile_v110.h:52
int _buffer_size
current data buffer size in bytes
Definition: indexedfile_v110.h:214
IndexBlockItem * _index_blocks
indexed table reference
Definition: indexedfile_v110.h:216
void getExtension(int index, FileExtension **extension_info, void **data) const
void allocExtensionPage(utils5ext::FileSize size, void **data)
void setDateTime(const a_util::datetime::DateTime *date_time)
std::string getDescription() const
void * internalMalloc(int size)
SeekFlags
SeekFlags.
Definition: indexedfile_v110.h:189
@ sf_keydata
seek flag for indexed data only
Definition: indexedfile_v110.h:191
@ sf_default
default seek flag for all kind of data
Definition: indexedfile_v110.h:190
void appendIndex(uint64_t pos, timestamp_t time_stamp)
void appendExtension(const std::string &identifier, const void *data, int data_size, uint32_t type_id=0, uint32_t version_id=0)
struct ifhd::v110::IndexedFileV110::TagFileHeader FileHeader
static int index_table_cluster_size
default index table allocation at once size in bytes
Definition: indexedfile_v110.h:205
void getDateTime(a_util::datetime::DateTime *date_time) const
FilePos _file_pos
current file pos
Definition: indexedfile_v110.h:211
void allocIndexBlock(int count=-1)
struct ifhd::v110::IndexedFileV110::TagIndexBlockItem IndexBlockItem
std::list< FileExtensionStruct * > FileExtensionList
file extension reference type
Definition: indexedfile_v110.h:228
struct ifhd::v110::IndexedFileV110::TagChunkHeader ChunkHeader
OpenMode
OpenMode.
Definition: indexedfile_v110.h:196
@ om_none
default open mode
Definition: indexedfile_v110.h:197
@ om_query_info
open mode to get file header only
Definition: indexedfile_v110.h:198
void * _cache
current cache buffer
Definition: indexedfile_v110.h:231
struct ifhd::v110::IndexedFileV110::TagFileExtension FileExtension
bool _write_mode
writing or reading mode
Definition: indexedfile_v110.h:234
void setDescription(const std::string &description)
void internalFree(void *memory)
static int default_block_size
default block size in bytes
Definition: indexedfile_v110.h:203
IndexBlockItem * _active_index_block
current index block
Definition: indexedfile_v110.h:217
int _cache_size
current cache size
Definition: indexedfile_v110.h:232
@ tf_chunk_index
time format used for lookup index
Definition: indexedfile_v110.h:60
@ tf_chunk_time
time format used for lookup time
Definition: indexedfile_v110.h:65
void getHeader(FileHeader **file_header) const
static int default_cache_size
default cache size in bytes
Definition: indexedfile_v110.h:204
int _sector_size
current sector size in bytes
Definition: indexedfile_v110.h:207
bool findExtension(const std::string &identifier, FileExtension **extension_info, void **data) const
FileExtensionList _extensions
file extension references
Definition: indexedfile_v110.h:229
int getSectorSize(const a_util::filesystem::Path &filename) const
utils5ext::File * _file
the file pointer
Definition: indexedfile_v110.h:209
uint8_t * _buffer
current data buffer reference
Definition: indexedfile_v110.h:213
void appendExtension(const void *data, const FileExtension *extension_info)
struct ifhd::v110::IndexedFileV110::TagChunkRef ChunkRef
FileHeader * _file_header
file header
Definition: indexedfile_v110.h:219
Definition: file.h:121
namespace for IFHD File library
Definition: indexedfile_types.h:30
utils5ext::FilePos FilePos
file pos type
Definition: indexedfile_types.h:54
FilePos FileSize
Type for the file size.
Definition: file.h:41
Definition: indexedfile_v100.h:72
File extension structure.
Definition: indexedfile_v110.h:223
FileExtension file_extension
64Byte
Definition: indexedfile_v110.h:224
void * extension_page
see in pFileExtension->dataSize
Definition: indexedfile_v110.h:225
Definition: indexedfile_v110.h:140
uint32_t flags
key data / flags
Definition: indexedfile_v110.h:148
uint64_t reserved
reserved bytes. currently not in use
Definition: indexedfile_v110.h:150
uint64_t ref_index
refering to the master index table
Definition: indexedfile_v110.h:144
uint32_t size
size of the chunks (in bytes)
Definition: indexedfile_v110.h:146
uint64_t time_stamp
timestamp of the chunk
Definition: indexedfile_v110.h:142
Definition: indexedfile_v110.h:157
uint64_t chunk_index
number of chunk
Definition: indexedfile_v110.h:167
uint64_t time_stamp
timestamp of the chunk it refers to
Definition: indexedfile_v110.h:159
uint32_t flags
key data / flags of the chunk it refers to
Definition: indexedfile_v110.h:163
uint32_t size
size of the chunk it refers to
Definition: indexedfile_v110.h:161
uint64_t chunk_offset
file offset position of the chunk it refers to (in byte)
Definition: indexedfile_v110.h:165
Definition: indexedfile_v110.h:120
int8_t identifier[32]
identifier
Definition: indexedfile_v110.h:122
uint32_t version_id
optional version id
Definition: indexedfile_v110.h:126
FilePos data_pos
file offset of the extension data (absolute)
Definition: indexedfile_v110.h:128
uint32_t type_id
related Stream. 0 for every stream 1> id >= Max streams)
Definition: indexedfile_v110.h:124
uint8_t reserved[8]
reserved bytes. currently not in use
Definition: indexedfile_v110.h:132
utils5ext::FileSize data_size
size of the extension-data in bytes
Definition: indexedfile_v110.h:130
Definition: indexedfile_v110.h:83
FilePos extension_offset
file-offset to the begin of extension table block (absolute)
Definition: indexedfile_v110.h:89
uint32_t file_id
file identifier
Definition: indexedfile_v110.h:85
int8_t description[1912]
description. The short and detailed description are seperated by ' '
Definition: indexedfile_v110.h:113
uint64_t chunk_count
amount of chunks
Definition: indexedfile_v110.h:107
uint32_t extension_count
amount of extension blocks
Definition: indexedfile_v110.h:91
FilePos index_offset
the index offset
Definition: indexedfile_v110.h:101
utils5ext::FileSize data_size
size of the data block (in bytes)
Definition: indexedfile_v110.h:97
DateTime date_time
date time of creation
Definition: indexedfile_v110.h:105
uint64_t reserved2[5]
reserved bytes. currently not in use
Definition: indexedfile_v110.h:111
uint32_t version_id
format version of dat files. current version is 0x0201
Definition: indexedfile_v110.h:87
uint64_t duration
duration of the file in microseconds
Definition: indexedfile_v110.h:103
uint64_t index_count
the index count
Definition: indexedfile_v110.h:99
FilePos data_offset
file-offset to the begin of data block (absolute)
Definition: indexedfile_v110.h:95
uint64_t max_chunk_size
greatest user data size of chunk
Definition: indexedfile_v110.h:109
uint32_t reserved1
reserved for further use
Definition: indexedfile_v110.h:93
Definition: indexedfile_v110.h:180
struct TagIndexBlockItem * next
the next index block reference
Definition: indexedfile_v110.h:184
int data_size
data size in bytes
Definition: indexedfile_v110.h:182
int item_count
the item count
Definition: indexedfile_v110.h:183
ChunkRef * data
chunk reference the index block belongs to
Definition: indexedfile_v110.h:181

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