adtf_file_library
0.13.2
|
#include <indexedfile_v201_v301.h>
Classes | |
struct | FileExtensionStruct |
Public Member Functions | |
IndexedFile () | |
virtual | ~IndexedFile () |
virtual void | close () |
virtual std::set< uint32_t > | getSupportedVersions () const |
Get a set of all supported versions. More... | |
void | setDescription (const std::string &description) |
std::string | getDescription () const |
std::string | getGUID () const |
a_util::datetime::DateTime | getDateTime () const |
uint8_t | getByteOrder () const |
size_t | getExtensionCount () const |
bool | findExtension (const char *identifier, FileExtension **extension_info, void **data) const |
void | getExtension (size_t index, FileExtension **extension_info, void **data) 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 | appendExtension (const void *data, const FileExtension *extension_info) |
void | freeExtensions () |
void | getHeaderRef (FileHeader **file_header) const |
Protected Types | |
typedef std::list< FileExtensionStruct * > | FileExtensionList |
own type definition for a better work with file extension lists | |
Protected Member Functions | |
void | setDateTime (const a_util::datetime::DateTime &date_time) |
virtual void | initialize () |
void | allocBuffer (uint64_t size) |
void | freeBuffer () |
void | allocHeader () |
void | freeHeader () |
void | allocExtensionPage (utils5ext::FileSize size, void **data) const |
void | setGUID () |
void | generateNewGUID (std::string &generated_guid) |
void | allocCache (int64_t size) |
void | freeCache () |
void * | getCacheAddr () const |
void * | internalMalloc (size_t size) const |
void | internalFree (void *memory) const |
Protected Attributes | |
utils5ext::File | _file |
the open file | |
FilePos | _file_pos |
current filepos | |
uint8_t * | _buffer |
internal Buffer | |
int64_t | _buffer_size |
internal Buffer size | |
FileHeader * | _file_header |
current file header | |
bool | _write_guid |
protection for writing GUID | |
FileExtensionList | _extensions |
list with all extensions | |
void * | _cache |
cache data area | |
uint64_t | _cache_size |
size of cache | |
bool | _write_mode |
For internal use only (will be moved to a private implementation). | |
Static Protected Attributes | |
static const uint8_t | byte_order |
current value of platform ByteOrder ( More... | |
static int64_t | default_block_size |
Default block size in bytes. | |
static int64_t | default_cache_size |
Default cache size in bytes. | |
Base class for all indexed file classes.
ifhd::v201_v301::IndexedFile::IndexedFile | ( | ) |
Default constructor.
|
virtual |
Destructor.
|
protected |
Allocates an internal buffer.
[in] | size | The size in bytes to allocate. |
|
protected |
Initialzes an internal cache.
[in] | size | The size of the cache. |
|
protected |
Allocate memory for an extension.
[in] | size | The amount of bytes to allocate. |
[out] | data | Pointer to the allocated space. |
|
protected |
Allocates the header structure/data.
void ifhd::v201_v301::IndexedFile::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 |
||
) |
Adds a new extension to the file.
identifier | The identifier of the extension. |
data | The extension data. |
data_size | The data size. |
type_id | An optional type id |
file_version_id | An optional version id |
stream_id | An optional stream id |
user_id | An optional user id |
std::runtime_error | if file not in write mode |
std::invalid_argument | if identifier is not valid |
void ifhd::v201_v301::IndexedFile::appendExtension | ( | const void * | data, |
const FileExtension * | extension_info | ||
) |
Adds a new extension to the file.
data | The extension data. |
extension_info | The extension info. |
std::runtime_error | if file not in write mode |
std::invalid_argument | if identifier is not valid |
|
virtual |
Closes the file.
Reimplemented in ifhd::v201_v301::IndexedFileWriter, and ifhd::v201_v301::IndexedFileReader.
bool ifhd::v201_v301::IndexedFile::findExtension | ( | const char * | identifier, |
FileExtension ** | extension_info, | ||
void ** | data | ||
) | const |
Finds an extension with a specific identifier.
identifier | The identifier of the extension |
extension_info | The extension info data. |
data | The extension data. |
true | extension found |
false | extension not found |
|
protected |
Releases the internal buffer.
|
protected |
Releases the cache.
void ifhd::v201_v301::IndexedFile::freeExtensions | ( | ) |
Frees all extensions.
|
protected |
Releases the header data.
|
protected |
Generates a new GUID (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)
[out] | generated_guid | new generated GUID |
uint8_t ifhd::v201_v301::IndexedFile::getByteOrder | ( | ) | const |
Returns the byteorder of the file.
|
protected |
Returns the cache pointer
a_util::datetime::DateTime ifhd::v201_v301::IndexedFile::getDateTime | ( | ) | const |
Get the timestamp of the file.
std::string ifhd::v201_v301::IndexedFile::getDescription | ( | ) | const |
Returns the description of the file.
void ifhd::v201_v301::IndexedFile::getExtension | ( | size_t | index, |
FileExtension ** | extension_info, | ||
void ** | data | ||
) | const |
Get an extension with a specific index.
index | The index of the extension. |
extension_info | The extension info data. |
data | The extension data. |
std::out_of_range | if index is out of range |
size_t ifhd::v201_v301::IndexedFile::getExtensionCount | ( | ) | const |
Get the amount of extensions in the file.
std::string ifhd::v201_v301::IndexedFile::getGUID | ( | ) | const |
Get the GUID of the file.
void ifhd::v201_v301::IndexedFile::getHeaderRef | ( | FileHeader ** | file_header | ) | const |
Returns the file header.
[out] | file_header | Will point to the file header. |
|
virtual |
Get a set of all supported versions.
Reimplemented in ifhd::v500::IndexedFileReader, and ifhd::v400::IndexedFileReader.
|
protectedvirtual |
Initializes internal data.
Reimplemented in ifhd::v201_v301::IndexedFileWriter, and ifhd::v201_v301::IndexedFileReader.
|
protected |
Release memory.
[in] | memory | The memory which should be free'd. |
|
protected |
Allocates memory.
[in] | size | The size of the data block. |
|
protected |
Set the timestamp of the file. The timestamp is calculated from the passed date/time structure while the current time zone from the system is used.
[in] | date_time | The new date/time for the timestamp. |
void ifhd::v201_v301::IndexedFile::setDescription | ( | const std::string & | description | ) |
Sets the description of the file.
description | [in] The new description. |
|
protected |
Sets the GUID of the file.
|
staticprotected |
current value of platform ByteOrder (