adtf_file_library  0.13.2
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
ifhd::v201_v301::IndexedFile Class Reference

#include <indexedfile_v201_v301.h>

Inheritance diagram for ifhd::v201_v301::IndexedFile:
[legend]
Collaboration diagram for ifhd::v201_v301::IndexedFile:
[legend]

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.
 

Detailed Description

Base class for all indexed file classes.

FILE LAYOUT for Version 2.0.1


+----------------------------------------------------------------------------------—+
|HDR| DATA | EXTENSIONS | EXTENSIONSHEADER-HDR |
+----------------------------------------------------------------------------------—+


FILE LAYOUT for Version 2.0.2


+-----------------------------------------------------------------------------------------------—+
|HDR| QUEUED HISTORY CHUNK DATA | SORTED CHUNK DATA | EXTENSIONS | EXTENSIONSHEADER-HDR |
+-----------------------------------------------------------------------------------------------—+


Special Extensions to provide:
  • GUUID within the File
  • MASTER Index Table
  • Stream Index Tables

Constructor & Destructor Documentation

◆ IndexedFile()

ifhd::v201_v301::IndexedFile::IndexedFile ( )

Default constructor.

◆ ~IndexedFile()

virtual ifhd::v201_v301::IndexedFile::~IndexedFile ( )
virtual

Destructor.

Member Function Documentation

◆ allocBuffer()

void ifhd::v201_v301::IndexedFile::allocBuffer ( uint64_t  size)
protected

Allocates an internal buffer.

Parameters
[in]sizeThe size in bytes to allocate.

◆ allocCache()

void ifhd::v201_v301::IndexedFile::allocCache ( int64_t  size)
protected

Initialzes an internal cache.

Parameters
[in]sizeThe size of the cache.

◆ allocExtensionPage()

void ifhd::v201_v301::IndexedFile::allocExtensionPage ( utils5ext::FileSize  size,
void **  data 
) const
protected

Allocate memory for an extension.

Parameters
[in]sizeThe amount of bytes to allocate.
[out]dataPointer to the allocated space.

◆ allocHeader()

void ifhd::v201_v301::IndexedFile::allocHeader ( )
protected

Allocates the header structure/data.

◆ appendExtension() [1/2]

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.

Warning
The extension 'GUID' is protected and could not be overwritten
Parameters
identifierThe identifier of the extension.
dataThe extension data.
data_sizeThe data size.
type_idAn optional type id
file_version_idAn optional version id
stream_idAn optional stream id
user_idAn optional user id
Exceptions
std::runtime_errorif file not in write mode
std::invalid_argumentif identifier is not valid

◆ appendExtension() [2/2]

void ifhd::v201_v301::IndexedFile::appendExtension ( const void *  data,
const FileExtension extension_info 
)

Adds a new extension to the file.

Warning
The extension 'GUID' is protected and could not be overwritten
Parameters
dataThe extension data.
extension_infoThe extension info.
Exceptions
std::runtime_errorif file not in write mode
std::invalid_argumentif identifier is not valid

◆ close()

virtual void ifhd::v201_v301::IndexedFile::close ( )
virtual

◆ findExtension()

bool ifhd::v201_v301::IndexedFile::findExtension ( const char *  identifier,
FileExtension **  extension_info,
void **  data 
) const

Finds an extension with a specific identifier.

Parameters
identifierThe identifier of the extension
extension_infoThe extension info data.
dataThe extension data.
Return values
trueextension found
falseextension not found

◆ freeBuffer()

void ifhd::v201_v301::IndexedFile::freeBuffer ( )
protected

Releases the internal buffer.

◆ freeCache()

void ifhd::v201_v301::IndexedFile::freeCache ( )
protected

Releases the cache.

◆ freeExtensions()

void ifhd::v201_v301::IndexedFile::freeExtensions ( )

Frees all extensions.

◆ freeHeader()

void ifhd::v201_v301::IndexedFile::freeHeader ( )
protected

Releases the header data.

◆ generateNewGUID()

void ifhd::v201_v301::IndexedFile::generateNewGUID ( std::string &  generated_guid)
protected

Generates a new GUID (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)

Parameters
[out]generated_guidnew generated GUID

◆ getByteOrder()

uint8_t ifhd::v201_v301::IndexedFile::getByteOrder ( ) const

Returns the byteorder of the file.

Returns
PLATFORM_LITTLE_ENDIAN_8 or PLATFORM_BIG_ENDIAN_8

◆ getCacheAddr()

void* ifhd::v201_v301::IndexedFile::getCacheAddr ( ) const
protected

Returns the cache pointer

◆ getDateTime()

a_util::datetime::DateTime ifhd::v201_v301::IndexedFile::getDateTime ( ) const

Get the timestamp of the file.

Returns
The timestamp.

◆ getDescription()

std::string ifhd::v201_v301::IndexedFile::getDescription ( ) const

Returns the description of the file.

Returns
The description of the file.

◆ getExtension()

void ifhd::v201_v301::IndexedFile::getExtension ( size_t  index,
FileExtension **  extension_info,
void **  data 
) const

Get an extension with a specific index.

Parameters
indexThe index of the extension.
extension_infoThe extension info data.
dataThe extension data.
Exceptions
std::out_of_rangeif index is out of range

◆ getExtensionCount()

size_t ifhd::v201_v301::IndexedFile::getExtensionCount ( ) const

Get the amount of extensions in the file.

Returns
The amount of extensions in the file.

◆ getGUID()

std::string ifhd::v201_v301::IndexedFile::getGUID ( ) const

Get the GUID of the file.

Returns
The GUID.

◆ getHeaderRef()

void ifhd::v201_v301::IndexedFile::getHeaderRef ( FileHeader **  file_header) const

Returns the file header.

Parameters
[out]file_headerWill point to the file header.

◆ getSupportedVersions()

virtual std::set<uint32_t> ifhd::v201_v301::IndexedFile::getSupportedVersions ( ) const
virtual

Get a set of all supported versions.

Returns
std::set<uint32_t> see page_ifhd_file_versions

Reimplemented in ifhd::v500::IndexedFileReader, and ifhd::v400::IndexedFileReader.

◆ initialize()

virtual void ifhd::v201_v301::IndexedFile::initialize ( )
protectedvirtual

Initializes internal data.

Reimplemented in ifhd::v201_v301::IndexedFileWriter, and ifhd::v201_v301::IndexedFileReader.

◆ internalFree()

void ifhd::v201_v301::IndexedFile::internalFree ( void *  memory) const
protected

Release memory.

Parameters
[in]memoryThe memory which should be free'd.

◆ internalMalloc()

void* ifhd::v201_v301::IndexedFile::internalMalloc ( size_t  size) const
protected

Allocates memory.

Parameters
[in]sizeThe size of the data block.
Returns
Pointer to the allocated space.

◆ setDateTime()

void ifhd::v201_v301::IndexedFile::setDateTime ( const a_util::datetime::DateTime &  date_time)
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.

Parameters
[in]date_timeThe new date/time for the timestamp.

◆ setDescription()

void ifhd::v201_v301::IndexedFile::setDescription ( const std::string &  description)

Sets the description of the file.

Parameters
description[in] The new description.

◆ setGUID()

void ifhd::v201_v301::IndexedFile::setGUID ( )
protected

Sets the GUID of the file.

Member Data Documentation

◆ byte_order

const uint8_t ifhd::v201_v301::IndexedFile::byte_order
staticprotected

current value of platform ByteOrder (

See also
PLATFORM_BYTEORDER_UINT8)

The documentation for this class was generated from the following file:

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