|
ADTF File Library
|
#include <indexedfilewriter_v201_v301.h>
Classes | |
| class | ChunkDroppedCallback |
Public Member Functions | |
| std::string | getTempSaveFileName () |
| void | setPrefixTempFileExtension (bool use_mode) |
| bool | getPrefixTempFileExtensionMode () const |
| std::string | getPrefix () const |
| std::string | getNewFileNameWithPrefix (const std::string &filename) const |
| IndexedFileWriter () | |
| ~IndexedFileWriter () | |
| void | setDateTime (const a_util::datetime::DateTime &date_time) |
| Sets the date and time of the file. | |
| void | open (const std::string &filename, uint32_t flags=0, uint64_t file_time_offset=0, timestamp_t history=0, utils5ext::FileSize history_size=0, ChunkDroppedCallback *drop_callback=nullptr, timestamp_t index_delay=1000000) |
| void | close () |
| void | writeChunk (uint16_t stream_id, const void *data, uint32_t data_size, timestamp_t time_stamp, uint32_t flags) |
| void | setAdditionalStreamInfo (uint16_t stream_id, const void *info_data, uint32_t info_data_size, bool use_as_reference=false) |
| void | setStreamName (uint16_t stream_id, const char *stream_name) |
| void | quitHistory () |
| std::shared_ptr< OutputStream > | getExtensionStream (const std::string &name, uint32_t user_id, uint32_t type_id, uint32_t file_version_id) |
| Creates and gets an extension stream to write extension data directly to the underlying file. | |
Public Member Functions inherited from ifhd::v201_v301::IndexedFile | |
| IndexedFile () | |
| virtual | ~IndexedFile () |
| virtual std::set< uint32_t > | getSupportedVersions () const |
| Get a set of all supported versions. | |
| 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 Member Functions | |
| void | initialize () |
| void | writeFileHeader (bool store_checksum=false) |
| void | writeFileHeaderExt () |
| void | writeIndexTable () |
| void | updateChecksumsExtension () |
Protected Member Functions inherited from ifhd::v201_v301::IndexedFile | |
| void | setDateTime (const a_util::datetime::DateTime &date_time) |
| 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 | |
| bool | _use_prefix_temp_file_extension |
Protected Attributes inherited from ifhd::v201_v301::IndexedFile | |
| 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). | |
Additional Inherited Members | |
Protected Types inherited from ifhd::v201_v301::IndexedFile | |
| typedef std::list< FileExtensionStruct > | FileExtensionList |
| own type definition for a better work with file extension lists | |
Static Protected Attributes inherited from ifhd::v201_v301::IndexedFile | |
| static const uint8_t | byte_order |
| current value of platform ByteOrder ( | |
| static int64_t | default_block_size |
| Default block size in bytes. | |
| static int64_t | default_cache_size |
| Default cache size in bytes. | |
Class for writing indexed files.
| ifhd::v201_v301::IndexedFileWriter::IndexedFileWriter | ( | ) |
Default constructor.
| ifhd::v201_v301::IndexedFileWriter::~IndexedFileWriter | ( | ) |
Destructor.
|
virtual |
Finishes writing to and closes the file.
Reimplemented from ifhd::v201_v301::IndexedFile.
| std::shared_ptr< OutputStream > ifhd::v201_v301::IndexedFileWriter::getExtensionStream | ( | const std::string & | name, |
| uint32_t | user_id, | ||
| uint32_t | type_id, | ||
| uint32_t | file_version_id ) |
Creates and gets an extension stream to write extension data directly to the underlying file.
| name | name of the extension. |
| user_id | the user id for the extension. |
| type_id | the type id for the extension. |
| file_version_id | the file version id for the extension. |
| std::string ifhd::v201_v301::IndexedFileWriter::getNewFileNameWithPrefix | ( | const std::string & | filename | ) | const |
Set a prefix to the incoming filename and return the new name
| filename | The filename to prefix. |
| std::string ifhd::v201_v301::IndexedFileWriter::getPrefix | ( | ) | const |
Returns the prefix
| bool ifhd::v201_v301::IndexedFileWriter::getPrefixTempFileExtensionMode | ( | ) | const |
Retrieves the mode, if the prefix mode was set with setPrefixTempFileExtension.
| true | The mode is set. |
| false | The mode is set. |
| std::string ifhd::v201_v301::IndexedFileWriter::getTempSaveFileName | ( | ) |
Get the Temp Save File Name (Filename during the Save Mode)
|
protectedvirtual |
Initializes the writer.
Reimplemented from ifhd::v201_v301::IndexedFile.
| void ifhd::v201_v301::IndexedFileWriter::open | ( | const std::string & | filename, |
| uint32_t | flags = 0, | ||
| uint64_t | file_time_offset = 0, | ||
| timestamp_t | history = 0, | ||
| utils5ext::FileSize | history_size = 0, | ||
| ChunkDroppedCallback * | drop_callback = nullptr, | ||
| timestamp_t | index_delay = 1000000 ) |
Create a new indexed file.
| filename | The filename. |
| flags | Creation flags, see OpenMode |
| file_time_offset | unused. |
| history | Timestamp of history. |
| history_size | Size of the history. |
| index_delay | The maximum time difference between index entries. |
| drop_callback | CallBack implementation if chunk was dropped |
| void ifhd::v201_v301::IndexedFileWriter::quitHistory | ( | ) |
In case there is a history set up, this switches over to permanent storage.
| void ifhd::v201_v301::IndexedFileWriter::setAdditionalStreamInfo | ( | uint16_t | stream_id, |
| const void * | info_data, | ||
| uint32_t | info_data_size, | ||
| bool | use_as_reference = false ) |
Sets additional info for a stream.
| stream_id | The stream id. |
| info_data | The info data. |
| info_data_size | The info data size. |
| use_as_reference | Whether to store the data in an internal buffer or not (The data is accessed when the file is closed). |
| void ifhd::v201_v301::IndexedFileWriter::setDateTime | ( | const a_util::datetime::DateTime & | date_time | ) |
Sets the date and time of the file.
| date_time | the date and time to set |
| std::logic_error |
| void ifhd::v201_v301::IndexedFileWriter::setPrefixTempFileExtension | ( | bool | use_mode | ) |
Set the mode, if a prefix is set by a temp Save File Name or not
| use_mode | The filename. |
| void ifhd::v201_v301::IndexedFileWriter::setStreamName | ( | uint16_t | stream_id, |
| const char * | stream_name ) |
Set the name of a stream.
| stream_id | The stream id. |
| stream_name | The new name. |
|
protected |
Store the hashes in the reserved extension within the file.
| void ifhd::v201_v301::IndexedFileWriter::writeChunk | ( | uint16_t | stream_id, |
| const void * | data, | ||
| uint32_t | data_size, | ||
| timestamp_t | time_stamp, | ||
| uint32_t | flags ) |
Writes a new chunk to the file. This function is not thread safe! (sync must be done outside in caller)!
| stream_id | The stream id. |
| data | The chunk data. |
| data_size | The data size. |
| time_stamp | The timestamp of the chunk. |
| flags | Chunk flags, see ChunkHeader |
|
protected |
Write the file header
|
protected |
write the extension file header
|
protected |
write index table
|
protected |
if true the tempfilename (savemode) is used with prefix