adtf_file_library  0.13.2
indexedfile_v201_v301.h
Go to the documentation of this file.
1 
17 #ifndef INDEXEDFILE_V201_V301_CLASS_HEADER
18 #define INDEXEDFILE_V201_V301_CLASS_HEADER
19 
21 
22 #include <set>
23 #include <list>
24 
25 namespace ifhd
26 {
27 namespace v201_v301
28 {
29 
31 
32 //*************************************************************************************************
33 /*
34 
35  FILE LAYOUT:
36 
37  +------------------------------------------------------------------------------------+
38  |HDR| DATA | EXTENSIONS | EXTENSION-HEADER TABLE |
39  +------------------------------------------------------------------------------------+
40 
41 */
42 
54 //*************************************************************************************************
55 class IndexedFile;
56 
57 
58 
59 //*************************************************************************************************
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;
104  int64_t _buffer_size;
107 
110 
114  typedef struct
115  {
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 
274  void freeBuffer();
275 
279  void allocHeader();
280 
284  void freeHeader();
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)
std::list< FileExtensionStruct * > FileExtensionList
own type definition for a better work with file extension lists
Definition: indexedfile_v201_v301.h:121
void allocBuffer(uint64_t size)
void setDateTime(const a_util::datetime::DateTime &date_time)
virtual std::set< uint32_t > getSupportedVersions() const
Get a set of all supported versions.
void allocExtensionPage(utils5ext::FileSize size, void **data) const
std::string getGUID() const
void appendExtension(const void *data, const FileExtension *extension_info)
uint8_t * _buffer
internal Buffer
Definition: indexedfile_v201_v301.h:102
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
void * internalMalloc(size_t size) const
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 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:101
Definition: indexedfile_v201_v301.h:115
void * extension_page
pointer to extension page
Definition: indexedfile_v201_v301.h:117
FileExtension file_extension
file extension intormation
Definition: indexedfile_v201_v301.h:116

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