adtf_file_library  0.13.2
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ifhd::v110::IndexedFileReaderV110 Class Reference

#include <indexedfilereader_v110.h>

Inheritance diagram for ifhd::v110::IndexedFileReaderV110:
[legend]
Collaboration diagram for ifhd::v110::IndexedFileReaderV110:
[legend]

Public Member Functions

 IndexedFileReaderV110 ()
 
 ~IndexedFileReaderV110 ()
 
void attach (utils5ext::File *file, const a_util::filesystem::Path &file_name, int cache_size=-1, uint32_t flags=0)
 
void close ()
 
void reset ()
 
int64_t getCurrentPos (int time_format) const
 
int64_t setCurrentPos (int64_t position, int time_format)
 
int64_t getChunkIndexForIndexPos (int64_t index_pos) const
 
int64_t getChunkIndexForIndexPos () const
 
int64_t seek (int64_t position, int time_format, uint32_t flags=0)
 
void queryChunkInfo (ChunkHeader **chunk_header)
 
void readChunk (void **data)
 
void skipChunk ()
 
void readNextChunk (ChunkHeader **chunk_header, void **data)
 
void skipChunkInfo ()
 
void readNextChunkInfo (ChunkHeader **chunk_header)
 
int64_t getFilePos () const
 
int64_t getChunkCount () const
 
int64_t getIndexCount () const
 
timestamp_t getDuration () const
 
uint32_t getVersionId () const
 
bool findExtension (const std::string &identifier, FileExtension **extension_info, void **data) const
 
void getExtension (int index, FileExtension **extension_info, void **data) const
 
- Public Member Functions inherited from ifhd::v110::IndexedFileV110
 IndexedFileV110 ()
 
 ~IndexedFileV110 ()
 
void close ()
 
void setDescription (const std::string &description)
 
std::string getDescription () const
 
void setDateTime (const a_util::datetime::DateTime *date_time)
 
void getDateTime (a_util::datetime::DateTime *date_time) const
 
int getExtensionCount () const
 
bool findExtension (const std::string &identifier, FileExtension **extension_info, void **data) const
 
void getExtension (int index, FileExtension **extension_info, void **data) const
 
void appendExtension (const std::string &identifier, const void *data, int data_size, uint32_t type_id=0, uint32_t version_id=0)
 
void appendExtension (const void *data, const FileExtension *extension_info)
 
void freeExtensions ()
 
void getHeader (FileHeader **file_header) const
 

Protected Member Functions

void initialize ()
 
void readFileHeader ()
 
void readFileHeaderExt ()
 
void readIndexTable ()
 
int64_t lookupChunkRef (int64_t position, int time_format)
 
void readCurrentChunkHeader ()
 
void readCurrentChunkData ()
 
void setEOF ()
 
void readDataBlock (void *buffer, long buffer_size)
 
void checkFilePtr ()
 
void allocReadBuffers ()
 
void freeReadBuffers ()
 
- Protected Member Functions inherited from ifhd::v110::IndexedFileV110
void initialize ()
 
void allocBuffer (int size)
 
void freeBuffer ()
 
void appendIndex (uint64_t pos, timestamp_t time_stamp)
 
void allocIndexBlock (int count=-1)
 
void freeIndexTable ()
 
void allocHeader ()
 
void freeHeader ()
 
void allocExtensionPage (utils5ext::FileSize size, void **data)
 
void allocCache (int size)
 
void freeCache ()
 
void * getCacheAddr ()
 
int getSectorSize (const a_util::filesystem::Path &filename) const
 
void * internalMalloc (int size)
 
void internalFree (void *memory)
 

Protected Attributes

uint32_t _flags
 internal flags
 
IndexedFileV110::ChunkRef_index_table
 index table
 
int _index_table_size
 index table size (amount of entries)
 
int64_t _end_of_data_marker
 end of data marker
 
bool _file_pos_invalid
 validation state of file position
 
IndexedFileV110::ChunkHeader_current_chunk
 current chunk header pointer
 
void * _current_chunk_data
 current chank data size in bytes
 
bool _header_valid
 validation state of chunk header
 
bool _data_valid
 validation state of chunk data
 
bool _prefetched
 prefechted state of chunk
 
int64_t _chunk_index
 current chunk index
 
int64_t _index_table_index
 current index table index position
 
bool _compatibility_v100
 reader in compatibility state
 
void * _delegate
 delegate object for compatibility
 
IndexedFileV110::FileExtension _extension_info_v100
 compatibility file extension
 
- Protected Attributes inherited from ifhd::v110::IndexedFileV110
int _sector_size
 current sector size in bytes
 
utils5ext::File_file
 the file pointer
 
FilePos _file_pos
 current file pos
 
uint8_t * _buffer
 current data buffer reference
 
int _buffer_size
 current data buffer size in bytes
 
IndexBlockItem_index_blocks
 indexed table reference
 
IndexBlockItem_active_index_block
 current index block
 
FileHeader_file_header
 file header
 
FileExtensionList _extensions
 file extension references
 
void * _cache
 current cache buffer
 
int _cache_size
 current cache size
 
bool _write_mode
 writing or reading mode
 

Additional Inherited Members

- Public Types inherited from ifhd::v110::IndexedFileV110
enum  { tf_chunk_index = 1 , tf_chunk_time = 2 }
 
enum  SeekFlags { sf_default = 0x0 , sf_keydata = 0x1 }
 SeekFlags. More...
 
enum  OpenMode { om_none = 0x0 , om_query_info = 0x4 }
 OpenMode. More...
 
using DateTime = v100::IndexedFileV100::DateTime
 
typedef struct ifhd::v110::IndexedFileV110::TagFileHeader FileHeader
 
typedef struct ifhd::v110::IndexedFileV110::TagFileExtension FileExtension
 
typedef struct ifhd::v110::IndexedFileV110::TagChunkHeader ChunkHeader
 
typedef struct ifhd::v110::IndexedFileV110::TagChunkRef ChunkRef
 
typedef struct ifhd::v110::IndexedFileV110::TagIndexBlockItem IndexBlockItem
 
- Protected Types inherited from ifhd::v110::IndexedFileV110
typedef std::list< FileExtensionStruct * > FileExtensionList
 file extension reference type
 
- Static Protected Attributes inherited from ifhd::v110::IndexedFileV110
static int default_block_size
 default block size in bytes
 
static int default_cache_size
 default cache size in bytes
 
static int index_table_cluster_size
 default index table allocation at once size in bytes
 

Detailed Description

Class for reading indexed file in version 110

Constructor & Destructor Documentation

◆ IndexedFileReaderV110()

ifhd::v110::IndexedFileReaderV110::IndexedFileReaderV110 ( )

Default constructor.

◆ ~IndexedFileReaderV110()

ifhd::v110::IndexedFileReaderV110::~IndexedFileReaderV110 ( )

Destructor.

Member Function Documentation

◆ allocReadBuffers()

void ifhd::v110::IndexedFileReaderV110::allocReadBuffers ( )
protected

allocate the internal reader buffers

◆ attach()

void ifhd::v110::IndexedFileReaderV110::attach ( utils5ext::File file,
const a_util::filesystem::Path &  file_name,
int  cache_size = -1,
uint32_t  flags = 0 
)

This function attaches a dat-file for reading

Parameters
file[in] the file where
file_name[in] the filename of the file to be attached
cache_size[in] cache size; <=0: use system file caching (=default)
flags[in] additional flags

◆ checkFilePtr()

void ifhd::v110::IndexedFileReaderV110::checkFilePtr ( )
protected

file pointer check

◆ close()

void ifhd::v110::IndexedFileReaderV110::close ( )

Closes all

◆ findExtension()

bool ifhd::v110::IndexedFileReaderV110::findExtension ( const std::string &  identifier,
FileExtension **  extension_info,
void **  data 
) const

Finds an extension with a specific identifier.

Parameters
identifier[in] The identifier of the extension
extension_info[out] The extension info data.
data[out] The extension data.

◆ freeReadBuffers()

void ifhd::v110::IndexedFileReaderV110::freeReadBuffers ( )
protected

free the internal reader buffers

◆ getChunkCount()

int64_t ifhd::v110::IndexedFileReaderV110::getChunkCount ( ) const

Returns the number of chunks of the current file

Returns
Number of chunks

◆ getChunkIndexForIndexPos() [1/2]

int64_t ifhd::v110::IndexedFileReaderV110::getChunkIndexForIndexPos ( ) const

Get the current index position.

Returns
The current index position.

◆ getChunkIndexForIndexPos() [2/2]

int64_t ifhd::v110::IndexedFileReaderV110::getChunkIndexForIndexPos ( int64_t  index_pos) const

Returns the chunk index of an entry in the index table.

Parameters
index_pos[in] The index of the entry in the index table.
Returns
The chunk index.

◆ getCurrentPos()

int64_t ifhd::v110::IndexedFileReaderV110::getCurrentPos ( int  time_format) const

Returns the current file position (Index or TimeStamp)

Parameters
time_format[in] Format of position (TF_ChunkTime / TF_ChunkIndex);
Returns
Current Position

◆ getDuration()

timestamp_t ifhd::v110::IndexedFileReaderV110::getDuration ( ) const

Returns the duration of the current file [microsec]

Returns
File duration

◆ getExtension()

void ifhd::v110::IndexedFileReaderV110::getExtension ( int  index,
FileExtension **  extension_info,
void **  data 
) const

Get an extension with a specific index.

Parameters
index[in] The index of the extension.
extension_info[out] The extension info data.
data[out] The extension data.

◆ getFilePos()

int64_t ifhd::v110::IndexedFileReaderV110::getFilePos ( ) const

Returns the current index of the IndexTable

Returns
Index

◆ getIndexCount()

int64_t ifhd::v110::IndexedFileReaderV110::getIndexCount ( ) const

Get the amount of indexes in the file.

Returns
The amount of indexes in the file.

◆ getVersionId()

uint32_t ifhd::v110::IndexedFileReaderV110::getVersionId ( ) const

Returns the Version ID of the current file

Returns
Version ID

◆ initialize()

void ifhd::v110::IndexedFileReaderV110::initialize ( )
protected

internal initialize

◆ lookupChunkRef()

int64_t ifhd::v110::IndexedFileReaderV110::lookupChunkRef ( int64_t  position,
int  time_format 
)
protected

Lookup for index table entry by time or by

Parameters
positionPosition (time or index)
time_formatTime format flag (ifhd::v10::IndexedFileV110::tf_chunk_index or ifhd::v110::IndexedFileV110::tf_chunk_time)

◆ queryChunkInfo()

void ifhd::v110::IndexedFileReaderV110::queryChunkInfo ( ChunkHeader **  chunk_header)

Returns the current ChunkInfo from IndexTable

Parameters
chunk_header[out] Current chunk info struct

◆ readChunk()

void ifhd::v110::IndexedFileReaderV110::readChunk ( void **  data)

Reads and returns the next Chunk and increments the IndexTable index

Parameters
data[out] Current chunk data

◆ readCurrentChunkData()

void ifhd::v110::IndexedFileReaderV110::readCurrentChunkData ( )
protected

read the current chunk data

◆ readCurrentChunkHeader()

void ifhd::v110::IndexedFileReaderV110::readCurrentChunkHeader ( )
protected

read the current chunk header

◆ readDataBlock()

void ifhd::v110::IndexedFileReaderV110::readDataBlock ( void *  buffer,
long  buffer_size 
)
protected

read a data block into the given buffer

Parameters
bufferPointer to buffer
buffer_sizeSize of buffer in bytes

◆ readFileHeader()

void ifhd::v110::IndexedFileReaderV110::readFileHeader ( )
protected

read the file header

◆ readFileHeaderExt()

void ifhd::v110::IndexedFileReaderV110::readFileHeaderExt ( )
protected

read the file header extension

◆ readIndexTable()

void ifhd::v110::IndexedFileReaderV110::readIndexTable ( )
protected

read the index table

◆ readNextChunk()

void ifhd::v110::IndexedFileReaderV110::readNextChunk ( ChunkHeader **  chunk_header,
void **  data 
)

Reads and returns the next Chunk and ChunkInfo struct and increments the IndexTable index

Parameters
chunk_header[out] Current chunk info
data[out] Current chunk data

◆ readNextChunkInfo()

void ifhd::v110::IndexedFileReaderV110::readNextChunkInfo ( ChunkHeader **  chunk_header)

Reads the next chunk info

Parameters
chunk_header[out] Will point to the chunk info.

◆ reset()

void ifhd::v110::IndexedFileReaderV110::reset ( )

Resets the file to the beginning of data

◆ seek()

int64_t ifhd::v110::IndexedFileReaderV110::seek ( int64_t  position,
int  time_format,
uint32_t  flags = 0 
)

Sets the file position to the Chunk of index and returns the respective ChunkInfo

Parameters
positionthe new file position
time_formatthe format of position
flagsa SeekFlags value
Returns
int64_t -> the current chunk index

◆ setCurrentPos()

int64_t ifhd::v110::IndexedFileReaderV110::setCurrentPos ( int64_t  position,
int  time_format 
)

Sets the file position by Index or by TimeStamp

Parameters
position[in] New file position
time_format[in] Format of position (TF_ChunkTime / TF_ChunkIndex);
Returns
New Index

◆ setEOF()

void ifhd::v110::IndexedFileReaderV110::setEOF ( )
protected

set end of file state to EOF.

◆ skipChunk()

void ifhd::v110::IndexedFileReaderV110::skipChunk ( )

Skips the next Chunk by incrementing the IndexTable index and setting the new FilePosition

◆ skipChunkInfo()

void ifhd::v110::IndexedFileReaderV110::skipChunkInfo ( )

Skips the next chunk info


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