ADTF File Library
Loading...
Searching...
No Matches
ifhd::v201_v301 Namespace Reference

namespace for indexed file definitions in version 2.0, 2.1, 3.0 and 3.1 More...

Classes

struct  AdditionalIndexInfo
 Additional index table information. More...
 
struct  ChecksumExtensionHeader
 Header of the "checksums" extension. More...
 
struct  ChunkHeader
 header for chunks Each Chunk header 16 Byte aligned within the file. More...
 
struct  ChunkRef
 header for a chunk reference More...
 
struct  FileExtension
 Header for a file extensions. More...
 
struct  FileHeader
 The File header for dat-files. More...
 
struct  FileRangeChecksumXxh3_64
 A checksum over a range within the file itself. More...
 
class  IndexedFile
 
class  IndexedFileReader
 
class  IndexedFileWriter
 
class  IndexReadTable
 
class  IndexWriteTable
 
class  OutputStream
 
class  SourceFile
 
struct  StreamInfoHeader
 
struct  StreamRef
 

Enumerations

enum  TimeFormat { tf_chunk_index = 1 , tf_chunk_time = 2 , tf_stream_index = 3 }
 
enum  FieldMask { fm_none = 0x00 , fm_description = 0x01 , fm_date_time = 0x02 }
 
enum  ReadFlags { rf_none = 0x0 , rf_use_external_buffer = 0x1 , rf_backwards = 0x2 }
 
enum  ChecksumType : uint32_t { xxh3_64 = 0 }
 Type of the checksum function used for calculating the checksum in the "checksums" extension.
 
enum  SeekFlags { sf_default = 0x0 , sf_keydata = 0x1 , sf_before = 0x02 }
 
enum  ChunkType {
  ct_data = 0x00 , ct_keydata = 0x01 , ct_info = 0x02 , ct_marker = 0x04 ,
  ct_type = 0x08 , ct_trigger = 0x10
}
 
enum  OpenMode {
  om_none = 0x00 , om_query_info = 0x04 , om_validate_chunk_header = 0x08 , om_file_change_mode = 0x10 ,
  om_no_overwrite = 0x20 , om_store_checksums = 0x40
}
 

Functions

a_util::datetime::DateTime getDateTimeHelper (const FileHeader &file_header)
 Retrieve the date time from the file_header.
 
a_util::datetime::DateTime getDateTime (const a_util::filesystem::Path &filename)
 Retrieve the date time from the filename , if it is an indexed file.
 
void getHeader (const std::string &filename, FileHeader &file_header)
 
void updateHeader (const std::string &filename, const FileHeader &file_header, uint32_t mask)
 
void queryFileInfo (const std::string &filename, std::string &file_info)
 
void queryFileInfo (const std::string &filename, std::string &file_info, std::list< std::string > &extensions)
 
void getExtension (const std::string &filename, const std::string &extension, FileExtension *extension_info, void **data)
 
void writeExtension (const std::string &filename, const FileExtension &extension_info, const void *data)
 
void isIfhdFile (const std::string &filename)
 
void stream2FileHeader (FileHeader &file_header)
 
void stream2FileHeaderExtension (const FileHeader &file_header, FileExtension *header_ext, size_t num_extensions)
 
void stream2ChunkHeader (const FileHeader &file_header, ChunkHeader &chunk)
 
void stream2ChunkRef (const FileHeader &file_header, ChunkRef &chunk_ref)
 
void stream2StreamRef (const FileHeader &file_header, StreamRef &stream_ref)
 
void stream2StreamInfoHeader (const FileHeader &file_header, StreamInfoHeader &stream_info)
 
void stream2AdditionalStreamIndexInfo (const FileHeader &file_header, AdditionalIndexInfo &additional_index_info)
 
void verifyIntegrity (const std::string &file_name)
 

Detailed Description

namespace for indexed file definitions in version 2.0, 2.1, 3.0 and 3.1

Enumeration Type Documentation

◆ ChunkType

The chunk types.

Enumerator
ct_data 

marks the chunk as data

ct_keydata 

marks the chunk as KEY data (results to an index table entry)

ct_info 

marks the chunk as info data

ct_marker 

marks the chunk as marker data

ct_type 

marks the chunk as type data

ct_trigger 

marks the chunk as trigger data

◆ FieldMask

Mask which fields of the file header should be updated.

◆ OpenMode

File open modes.

Enumerator
om_none 

No Flag set.

om_query_info 

Only valid for reading file operations. Will only open the extension table.

om_validate_chunk_header 

Only valid for writing file. An additional check of chunk validity is made! This Flag is available as performance reasons.

om_file_change_mode 

Only valid for modify file operations.

om_no_overwrite 

Only valid for writing file. If open for write mode, an existing file will not be overwritten or truncated.

om_store_checksums 

Store checksums. Only valid for writing file.

◆ ReadFlags

Read options.

◆ SeekFlags

Seek flags.

Enumerator
sf_default 

The default seek flag.

sf_keydata 

Just seek in index table.

sf_before 

Seek to the last chunk before the seek time.

◆ TimeFormat

Time format (for seek etc.)

Enumerator
tf_chunk_index 

The earliest chunk at or after this index counter within within the whole file, filtered by the stream Id.

tf_chunk_time 

The earliest chunk at or after this timestamp, filtered by the stream Id.

tf_stream_index 

The chunk at this index counter within the stream which is specified by the stream Id. Behaves identical to tf_chunk_index for stream Id 0.

Function Documentation

◆ getDateTime()

a_util::datetime::DateTime ifhd::v201_v301::getDateTime ( const a_util::filesystem::Path & filename)

Retrieve the date time from the filename , if it is an indexed file.

Parameters
filenamethe filepath to open and to retrieve the date time from
Returns
a_util::datetime::DateTime
Exceptions
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file

◆ getDateTimeHelper()

a_util::datetime::DateTime ifhd::v201_v301::getDateTimeHelper ( const FileHeader & file_header)

Retrieve the date time from the file_header.

Parameters
file_headerthe file header to retrieve the date time from
Returns
a_util::datetime::DateTime

◆ getExtension()

void ifhd::v201_v301::getExtension ( const std::string & filename,
const std::string & extension,
FileExtension * extension_info,
void ** data )

Return the requested file extension. You have to release the memory for the return value data with delete [] data;

Parameters
filenameThe input file name.
extensionThe requested file extension.
extension_infoThis will be filled with the file extension information.
dataThis will be filled with the file extension data.
Exceptions
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file

◆ getHeader()

void ifhd::v201_v301::getHeader ( const std::string & filename,
FileHeader & file_header )

Returns the header of a file.

Parameters
filenameThe filename
file_headerThis will be filled with the information.
Exceptions
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file

◆ isIfhdFile()

void ifhd::v201_v301::isIfhdFile ( const std::string & filename)

Check if a particular file is a DAT file.

Parameters
filenameName of the file to check.
Exceptions
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file

◆ queryFileInfo() [1/2]

void ifhd::v201_v301::queryFileInfo ( const std::string & filename,
std::string & file_info )

Returns the date and the description of a file in a string.

Parameters
filename[in] The filename.
file_info[out] The info string.
Exceptions
exceptions::ErrorFileAlreadyExists
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file

◆ queryFileInfo() [2/2]

void ifhd::v201_v301::queryFileInfo ( const std::string & filename,
std::string & file_info,
std::list< std::string > & extensions )

Returns the date and the description of a file in a string. It will also check if the given extension exits.

Parameters
filename[in] The filename.
file_info[out] The info string.
extensions[inout] the list of extensions.
Exceptions
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file

◆ stream2AdditionalStreamIndexInfo()

void ifhd::v201_v301::stream2AdditionalStreamIndexInfo ( const FileHeader & file_header,
AdditionalIndexInfo & additional_index_info )

Convert a additional stream info structure to native byte order.

Parameters
[in]file_headerThe header
[in]additional_index_infoThe additional index info.
Remarks
implemented rt safe

◆ stream2ChunkHeader()

void ifhd::v201_v301::stream2ChunkHeader ( const FileHeader & file_header,
ChunkHeader & chunk )

Convert a chunk header structure to native byte order.

Parameters
[in]file_headerThe header
[in]chunkThe chunk header.
Remarks
implemented rt safe

◆ stream2ChunkRef()

void ifhd::v201_v301::stream2ChunkRef ( const FileHeader & file_header,
ChunkRef & chunk_ref )

Convert a chunk reference structure to native byte order.

Parameters
[in]file_headerThe header
[in]chunk_refThe chunk reference
Remarks
implemented rt safe

◆ stream2FileHeader()

void ifhd::v201_v301::stream2FileHeader ( FileHeader & file_header)

Convert a file header structure to native byte order.

Parameters
[in]file_headerThe header
Remarks
implemented rt safe
Exceptions
std::runtime_errorif file version in file_header is not supported

◆ stream2FileHeaderExtension()

void ifhd::v201_v301::stream2FileHeaderExtension ( const FileHeader & file_header,
FileExtension * header_ext,
size_t num_extensions )

Convert a file header extension structure to native byte order.

Parameters
[in]file_headerThe header
[in]header_extThe header extension.
[in]num_extensionsThe number of Extensions.
Remarks
implemented rt safe

◆ stream2StreamInfoHeader()

void ifhd::v201_v301::stream2StreamInfoHeader ( const FileHeader & file_header,
StreamInfoHeader & stream_info )

Convert a stream info header structure to native byte order.

Parameters
[in]file_headerThe header
[in]stream_infoThe stream info.
Remarks
implemented rt safe

◆ stream2StreamRef()

void ifhd::v201_v301::stream2StreamRef ( const FileHeader & file_header,
StreamRef & stream_ref )

Convert a stream reference structure to native byte order.

Parameters
[in]file_headerThe header
[in]stream_refThe stream reference
Remarks
implemented rt safe

◆ updateHeader()

void ifhd::v201_v301::updateHeader ( const std::string & filename,
const FileHeader & file_header,
uint32_t mask )

Update header info.

Parameters
filenameThe filename.
file_headerThe new header info.
maskWhich fields to update, see FieldMask
Exceptions
exceptions::ErrorFileAlreadyExists
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file

◆ verifyIntegrity()

void ifhd::v201_v301::verifyIntegrity ( const std::string & file_name)

Verify the integrity of the given file by checking the contained hashes

Exceptions
std::runtime_errorin case of an error

◆ writeExtension()

void ifhd::v201_v301::writeExtension ( const std::string & filename,
const FileExtension & extension_info,
const void * data )

Write an extension If the extension already exists, it will be overwritten

Warning
The extension 'GUID' is protected and could not be overwritten
Parameters
filenameThe input file name.
extension_infoThis will be filled with the file extension information.
dataThis will be filled with the file extension data.
Exceptions
exceptions::ErrorFileAccess
std::runtime_errorif file is not a valid IFHD file