adtf_file_library
0.13.2
|
#include <indexedfile_v110.h>
Classes | |
struct | FileExtensionStruct |
File extension structure. More... | |
struct | TagChunkHeader |
struct | TagChunkRef |
struct | TagFileExtension |
struct | TagFileHeader |
struct | TagIndexBlockItem |
Public Types | |
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 |
Public Member Functions | |
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 Types | |
typedef std::list< FileExtensionStruct * > | FileExtensionList |
file extension reference type | |
Protected Member Functions | |
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 | |
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 | |
Static Protected Attributes | |
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 | |
Indexed File for version V1.1
header for chunks
header for a chunk reference
DateTime Structure
typedef struct ifhd::v110::IndexedFileV110::TagFileExtension ifhd::v110::IndexedFileV110::FileExtension |
FileExtension Structure
FileHeader Structure
typedef struct ifhd::v110::IndexedFileV110::TagIndexBlockItem ifhd::v110::IndexedFileV110::IndexBlockItem |
IndexBlockItem Structure
anonymous enum |
ifhd::v110::IndexedFileV110::IndexedFileV110 | ( | ) |
Default constructor.
ifhd::v110::IndexedFileV110::~IndexedFileV110 | ( | ) |
Destructor.
|
protected |
Allocate internal buffer.
size | [in] Size of buffer. |
|
protected |
Allocate cache.
size | [in] Size of cache. |
|
protected |
Allocate extension page.
size | [in] Size of extension page. |
data | [in] Pointer to data. |
|
protected |
Allocate header.
|
protected |
Allocate index block.
count | [in] Number of entries. |
void ifhd::v110::IndexedFileV110::appendExtension | ( | const std::string & | identifier, |
const void * | data, | ||
int | data_size, | ||
uint32_t | type_id = 0 , |
||
uint32_t | version_id = 0 |
||
) |
Adds a new extension to the file.
identifier | [in] The identifier of the extension. |
data | [in] The extension data. |
data_size | [in] The data size. |
type_id | [in] An optional type id |
version_id | [in] An optional version id |
void ifhd::v110::IndexedFileV110::appendExtension | ( | const void * | data, |
const FileExtension * | extension_info | ||
) |
Adds a new extension to the file.
data | [in] The extension data. |
extension_info | [in] The extension info. |
|
protected |
Append index.
pos | [in] Position. |
time_stamp | [in] Timestamp. |
void ifhd::v110::IndexedFileV110::close | ( | ) |
Closes the file.
bool ifhd::v110::IndexedFileV110::findExtension | ( | const std::string & | identifier, |
FileExtension ** | extension_info, | ||
void ** | data | ||
) | const |
Finds an extension with a specific identifier.
identifier | [in] The identifier of the extension |
extension_info | [out] The extension info data. |
data | [out] The extension data. |
|
protected |
Free internal buffer.
|
protected |
Free cache.
void ifhd::v110::IndexedFileV110::freeExtensions | ( | ) |
Frees all extensions.
|
protected |
Free header.
|
protected |
Free index table.
|
protected |
Retrieve cache address.
void ifhd::v110::IndexedFileV110::getDateTime | ( | a_util::datetime::DateTime * | date_time | ) | const |
Get the timestamp of the file.
date_time | [out] The timestamp of the file. |
std::string ifhd::v110::IndexedFileV110::getDescription | ( | ) | const |
Get the description of the file.
void ifhd::v110::IndexedFileV110::getExtension | ( | int | index, |
FileExtension ** | extension_info, | ||
void ** | data | ||
) | const |
Get an extension with a specific index.
index | [in] The index of the extension. |
extension_info | [out] The extension info data. |
data | [out] The extension data. |
int ifhd::v110::IndexedFileV110::getExtensionCount | ( | ) | const |
Returns the amount of extensions in the file.
void ifhd::v110::IndexedFileV110::getHeader | ( | FileHeader ** | file_header | ) | const |
Returns the file header.
file_header | [out] Will point to the file header. |
|
protected |
Get sector size of specified file.
filename | [in] File to retrieve sector size of. |
|
protected |
Internal initialization method.
|
protected |
Internal deallocation method.
memory | [in] Pointer to memory. |
|
protected |
Internal allocation method.
size | [in] Size of Allocation. |
void ifhd::v110::IndexedFileV110::setDateTime | ( | const a_util::datetime::DateTime * | date_time | ) |
Set the timestamp of the file.
date_time | [in] The new timestamp. |
void ifhd::v110::IndexedFileV110::setDescription | ( | const std::string & | description | ) |
Sets the description of the file
description | [in] The new description. |