ADTF File Library
Loading...
Searching...
No Matches
indexedfile_v201_v301.h
Go to the documentation of this file.
1
16
17#ifndef INDEXEDFILE_V201_V301_CLASS_HEADER
18#define INDEXEDFILE_V201_V301_CLASS_HEADER
19
21
22#include <set>
23#include <list>
24
25namespace ifhd
26{
27namespace v201_v301
28{
29
31
32//*************************************************************************************************
33/*
34
35 FILE LAYOUT:
36
37 +------------------------------------------------------------------------------------+
38 |HDR| DATA | EXTENSIONS | EXTENSION-HEADER TABLE |
39 +------------------------------------------------------------------------------------+
40
41*/
42
53
54//*************************************************************************************************
55class IndexedFile;
56
57
58
59//*************************************************************************************************
84
86{
87 protected:
88
90 static const uint8_t byte_order;
92 static int64_t default_block_size;
94 static int64_t default_cache_size;
95
100
102 uint8_t* _buffer;
107
110
114 typedef struct
115 {
117 std::vector<std::byte> extension_page;
119
121 typedef std::list<FileExtensionStruct> FileExtensionList;
122
125
127 void* _cache;
129 uint64_t _cache_size;
130
133
134 public:
142 virtual ~IndexedFile();
143
144
148 virtual void close();
149
154 virtual std::set<uint32_t> getSupportedVersions() const;
155
160 void setDescription(const std::string& description);
165 std::string getDescription() const;
166
171 std::string getGUID() const;
172
177 a_util::datetime::DateTime getDateTime() const;
178
183 uint8_t getByteOrder() const;
184
189 size_t getExtensionCount() const;
190
199 bool findExtension(const char* identifier, FileExtension** extension_info, void** data) const;
200
208 void getExtension(size_t index, FileExtension** extension_info, void** data) const;
209
223 void appendExtension(const char* identifier,
224 const void* data,
225 size_t data_size,
226 uint32_t type_id=0,
227 uint32_t file_version_id =0,
228 uint16_t stream_id=0,
229 uint32_t user_id=0);
230
239 void appendExtension(const void* data, const FileExtension* extension_info);
240
245
250 void getHeaderRef(FileHeader** file_header) const;
251
252 protected:
259 void setDateTime(const a_util::datetime::DateTime& date_time);
263 virtual void initialize();
264
269 void allocBuffer(uint64_t size);
270
275
280
285
291 void allocExtensionPage(utils5ext::FileSize size, void** data) const;
292
296 void setGUID();
297
302 void generateNewGUID(std::string& generated_guid);
303
304 protected:
305
310 void allocCache(int64_t size);
311
315 void freeCache();
316
320 void* getCacheAddr() const;
321
327 void* internalMalloc(size_t size) const;
328
333 void internalFree(void* memory) const;
334};
335
336} // namespace v400
337} // namespace ifhd
338
339//*************************************************************************************************
340#endif // _INDEXEDFILE_V201_V301_CLASS_HEADER_
Definition indexedfile_v201_v301.h:86
std::string getDescription() const
void appendExtension(const char *identifier, const void *data, size_t data_size, uint32_t type_id=0, uint32_t file_version_id=0, uint16_t stream_id=0, uint32_t user_id=0)
void allocBuffer(uint64_t size)
void setDateTime(const a_util::datetime::DateTime &date_time)
void allocExtensionPage(utils5ext::FileSize size, void **data) const
std::string getGUID() const
void appendExtension(const void *data, const FileExtension *extension_info)
virtual std::set< uint32_t > getSupportedVersions() const
Get a set of all supported versions.
uint8_t * _buffer
internal Buffer
Definition indexedfile_v201_v301.h:102
void * internalMalloc(size_t size) const
FileExtensionList _extensions
list with all extensions
Definition indexedfile_v201_v301.h:124
utils5ext::File _file
the open file
Definition indexedfile_v201_v301.h:97
FileHeader * _file_header
current file header
Definition indexedfile_v201_v301.h:106
uint64_t _cache_size
size of cache
Definition indexedfile_v201_v301.h:129
bool _write_mode
For internal use only (will be moved to a private implementation).
Definition indexedfile_v201_v301.h:132
void setDescription(const std::string &description)
bool _write_guid
protection for writing GUID
Definition indexedfile_v201_v301.h:109
int64_t _buffer_size
internal Buffer size
Definition indexedfile_v201_v301.h:104
void getHeaderRef(FileHeader **file_header) const
FilePos _file_pos
current filepos
Definition indexedfile_v201_v301.h:99
static const uint8_t byte_order
current value of platform ByteOrder (
Definition indexedfile_v201_v301.h:90
void generateNewGUID(std::string &generated_guid)
void internalFree(void *memory) const
bool findExtension(const char *identifier, FileExtension **extension_info, void **data) const
void getExtension(size_t index, FileExtension **extension_info, void **data) const
a_util::datetime::DateTime getDateTime() const
std::list< FileExtensionStruct > FileExtensionList
own type definition for a better work with file extension lists
Definition indexedfile_v201_v301.h:121
size_t getExtensionCount() const
void * _cache
cache data area
Definition indexedfile_v201_v301.h:127
void allocCache(int64_t size)
static int64_t default_block_size
Default block size in bytes.
Definition indexedfile_v201_v301.h:92
uint8_t getByteOrder() const
static int64_t default_cache_size
Default cache size in bytes.
Definition indexedfile_v201_v301.h:94
Definition file.h:121
namespace for indexed file definitions in version 2.0, 2.1, 3.0 and 3.1
Definition indexedfile_types_v201_v301.h:28
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
Header for a file extensions.
Definition indexedfile_types_v201_v301.h:161
The File header for dat-files.
Definition indexedfile_types_v201_v301.h:99
Definition indexedfile_v201_v301.h:115
std::vector< std::byte > extension_page
pointer to extension page
Definition indexedfile_v201_v301.h:117
FileExtension file_extension
file extension intormation
Definition indexedfile_v201_v301.h:116