ADTF File Library
Loading...
Searching...
No Matches
indexedfile_v110.h
Go to the documentation of this file.
1
16
17#ifndef INDEXEDFILE_V110_CLASS_HEADER
18#define INDEXEDFILE_V110_CLASS_HEADER
19
21
22#include <list>
23
24namespace ifhd
25{
29namespace v110
30{
31
32//*************************************************************************************************
33/*
34
35 FILE LAYOUT:
36
37 +---------------------------------------------------------------+
38 |HDR| DATA |HDR-EXT| IDX |
39 +---------------------------------------------------------------+
40
41*/
42
44static constexpr uint32_t version_id = 0x00000110;
45
46
47
52{
53 public:
54 enum
55 {
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
115
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
186
188 typedef enum
189 {
192 } SeekFlags;
193
195 typedef enum
196 {
197 om_none = 0x0,
199 } OpenMode;
200
201 protected:
202
206
208
210
212
213 uint8_t* _buffer;
215
218
220
227
228 typedef std::list<FileExtensionStruct*> FileExtensionList;
230
231 void* _cache;
233
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:
336
341 void allocBuffer(int size);
346
352 void appendIndex(uint64_t pos, timestamp_t time_stamp);
357 void allocIndexBlock(int count=-1);
362
377
378 protected:
383 void allocCache(int size);
387 void freeCache();
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
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
v100::IndexedFileV100::DateTime DateTime
Definition indexedfile_v110.h:78
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
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
@ 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 * internalMalloc(int size)
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
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 indexed file definitions in version 1.1
Definition indexedfile_v110.h:30
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
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