ADTF
|
Class for reading indexed files. More...
Public Member Functions | |
A_UTILS_DEPRECATED_MESSAGE ("The class 'cIndexedFileReader' is deprecated. Please use the aquivalent from the " "adtf_file library instead.") cIndexedFileReader() | |
Default constructor. | |
~cIndexedFileReader () | |
Destructor. | |
virtual tResult | Open (const cString &strFilename, tInt nCacheSize=-1, tUInt32 ui32Flags=0) |
This function opens a dat-file for reading. More... | |
virtual tResult | Close () |
This function closes all. More... | |
tResult | Reset () |
This function resets the file to the beginning of data. More... | |
tInt64 | GetCurrentPos (tInt nTimeFormat) |
This function returns the current file position (Index or TimeStamp) More... | |
tInt64 | SetCurrentPos (tInt64 nPosition, tInt nTimeFormat) |
This function sets the file position. More... | |
tInt64 | Seek (tUInt16 ui16StreamId, tInt64 nPosition, tInt nTimeFormat, tUInt32 ui32Flags=0) |
This function sets the new file position and returns the new chunk index or -1 in case the chunk can not be found (for example stream Id is invalid or file position is out of range). More... | |
tResult | QueryChunkInfo (tChunkHeader **ppChunkHeader) |
This function returns the ChunkInfo of the current chunk. More... | |
tResult | ReadChunk (tVoid **ppData, tUInt32 ui32Flags=0) |
This function reads and returns the current Chunk and increments the current chunk index. More... | |
tResult | SkipChunk () |
This function skips the next Chunk by incrementing the current chunk index and setting the new FilePosition. More... | |
tResult | ReadNextChunk (tChunkHeader **ppChunkHeader, tVoid **ppData, tUInt32 ui32Flags=0, tUInt32 ui32StreamId=0) |
This function reads and returns the current Chunk and ChunkInfo struct and increments the current chunk index. More... | |
tResult | SkipChunkInfo () |
This function increments the current chunk index. More... | |
tResult | ReadNextChunkInfo (tChunkHeader **ppChunkHeader) |
This function gets the next chunk information. More... | |
tInt64 | GetFilePos () |
This function returns the current chunk index. More... | |
tInt64 | GetChunkCount () |
This function returns the number of chunks of the current file. More... | |
tTimeStamp | GetDuration () |
This function returns the duration of the current file [microsec]. More... | |
tUInt32 | GetVersionId () |
This function returns the Version Id of the current file. More... | |
tTimeStamp | GetTimeOffset () |
This function returns the Time Zero Point Offset every Time is referring to. More... | |
tInt64 | GetStreamTableIndexCount (tUInt16 ui16StreamId) |
This function gets the number of indices of the given stream. More... | |
tInt64 | GetStreamIndexCount (tUInt16 ui16StreamId) |
This function gets the number of chunks of the given stream. More... | |
tResult | GetAdditionalStreamInfo (tUInt16 ui16StreamId, const tVoid **pInfoData, tUInt *pnInfoSize) |
This function gets the additional stream information data of the given stream. More... | |
const tChar * | GetStreamName (tUInt16 ui16StreamId) |
This function gets the stream name which is set. More... | |
tTimeStamp | GetFirstTime (tUInt16 ui16StreamId) |
This function gets the first time stamp of the given stream. More... | |
tTimeStamp | GetLastTime (tUInt16 ui16StreamId) |
This function gets the last time stamp of the given stream. More... | |
tInt | GetExtensionCount () |
Get the amount of extensions in the file. More... | |
tResult | FindExtension (const tChar *strIdentifier, tFileExtension **ppsExtensionInfo, tVoid **ppData) |
This function gets the extension data. More... | |
tResult | GetExtension (tInt nIndex, tFileExtension **ppsExtensionInfo, tVoid **ppData) |
This function gets the extension data. More... | |
tInt64 | LookupChunkRef (tUInt16 ui16StreamId, tInt64 nPosition, tInt nTimeFormat) |
This function gets the chunk index of the given file position. More... | |
![]() | |
cIndexedFile () | |
Default constructor. | |
virtual | ~cIndexedFile () |
Destructor. | |
tResult | SetDescription (const tChar *strDescription) |
Sets the description of the file. More... | |
const tChar * | GetDescription () const |
Returns the description of the file. More... | |
tResult | GetGUID (cString &strGUID) |
Get the GUID of the file. More... | |
tResult | SetDateTime (const tDateTime *psDateTime) |
Set the timestamp of the file. More... | |
tResult | GetDateTime (tDateTime *psDateTime) |
Get the timestamp of the file. More... | |
tUInt8 | GetByteOrder () |
Returns the byteorder of the file. More... | |
tInt | GetExtensionCount () |
Get the amount of extensions in the file. More... | |
tResult | FindExtension (const tChar *strIdentifier, tFileExtension **ppsExtensionInfo, tVoid **ppData) |
Finds an extension with a specific identifier. More... | |
tResult | GetExtension (tInt nIndex, tFileExtension **ppsExtensionInfo, tVoid **ppData) |
Get an extension with a specific index. More... | |
tResult | AppendExtension (const tChar *strIdentifier, const tVoid *pData, tInt nDataSize, tUInt32 ui32TypeId=0, tUInt32 ui32VersionId=0, tUInt16 ui16StreamId=0, tUInt32 ui32UserId=0) |
Adds a new extension to the file. More... | |
tResult | AppendExtension (const tVoid *pData, const tFileExtension *psExtensionInfo) |
Adds a new extension to the file. More... | |
tResult | FreeExtension (const tChar *strIdentifier) |
Frees specific extensions. More... | |
tResult | FreeExtensions () |
Frees all extensions. More... | |
tResult | GetHeader (tFileHeader **ppsFileHeader) |
Returns the file header. More... | |
Protected Member Functions | |
virtual tResult | Initialize () |
Initializes the reader. More... | |
tResult | ReadFileHeader () |
Reads and initializes the Header struct. More... | |
tResult | ReadFileHeaderExt () |
Reads and initializes the ExtendedHeader. More... | |
tResult | ReadIndexTable () |
Initializes the IndexTable. More... | |
tResult | ReadCurrentChunkHeader () |
Reads the next chunk header. | |
tResult | ReadCurrentChunkData (tVoid *pBuffer) |
Reads the data of the current chunk. | |
tResult | SetEOF () |
Set the end of file indication. More... | |
tResult | ReadDataBlock (tVoid *pvBuffer, long nBufferSize) |
Reads a raw data block from the file. More... | |
tResult | ClearCache () |
Resets the cache. | |
tResult | CheckFilePtr () |
Checks whether the current position in the file is valid. More... | |
tResult | AllocReadBuffers () |
Initializes the internal read buffers. | |
tResult | FreeReadBuffers () |
Releases the internal read buffers. | |
![]() | |
tResult | AllocBuffer (tInt64 nSize) |
Allocates an internal buffer. More... | |
tResult | FreeBuffer () |
Releases the internal buffer. | |
tResult | AllocHeader () |
Allocates the header structure/data. | |
tResult | FreeHeader () |
Releases the header data. | |
tResult | AllocExtensionPage (tFileSize nSize, tVoid **ppData) |
Allocate memory for an extension. More... | |
tResult | SetGUID () |
Sets the GUID of the file. More... | |
tResult | GenerateNewGUID (cString &strGeneratedGUID) |
Generates a new GUID (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) More... | |
tResult | AllocCache (tInt64 nSize) |
Initialzes an internal cache. More... | |
tResult | FreeCache () |
Releases the cache. | |
tVoid * | GetCacheAddr () |
Returns the cache pointer. | |
tInt | GetSectorSize (const tChar *strFilename) const |
Get the sector size of the filesystem that a specified file resides on. More... | |
tFileSize | GetSizeOnDisk (tFileSize nSize, tBool bUseSegmentSize) |
Calculates the size a data block requires on disk. More... | |
tVoid * | InternalMalloc (tInt64 nSize, tBool bUseSegmentSize) |
Allocates memory. More... | |
tVoid | InternalFree (tVoid *pMemory) |
Release memory. More... | |
Protected Attributes | |
tInt | m_nCacheOffset |
For internal use only (will be moved to a private implementation). | |
tInt | m_nCacheUsage |
For internal use only (will be moved to a private implementation). | |
![]() | |
tInt64 | m_nSectorSize |
current sector size used for disk device depend on drive given by filename within Create method of cIndexedFileReader or cIndexFileWriter | |
tBool | m_bSystemCacheDisabled |
whether system cache used or not depend on flags given within Create method of cIndexedFileReader or cIndexFileWriter | |
cFile | m_oFile |
the open file | |
tFilePos | m_nFilePos |
current filepos | |
tUInt8 * | m_pBuffer |
internal Buffer | |
tInt64 | m_nBufferSize |
internal Buffer size | |
tFileHeader * | m_psFileHeader |
current file header | |
tBool | m_bWriteGUID |
protection for writing GUID | |
tFileExtensionList | m_lstExtensions |
list with all extensions | |
tVoid * | m_pCache |
cache data area | |
tInt64 | m_nCacheSize |
size of cache | |
tBool | m_bWriteMode |
For internal use only (will be moved to a private implementation). | |
Additional Inherited Members | |
![]() | |
enum | tTimeFormat { TF_ChunkIndex = 1 , TF_ChunkTime = 2 , TF_StreamIndex = 3 } |
Time format (for seek etc.) More... | |
enum | tReadFlags { RF_None = 0x0 , RF_UseExternalBuffer = 0x1 , RF_Backwards = 0x2 } |
Read options. | |
enum | tSeekFlags { SF_DEFAULT = 0x0 , SF_KEYDATA = 0x1 , SF_BEFORE = 0x02 } |
Seek flags. More... | |
enum | tChunkType { CT_DATA = 0x00 , CT_KEYDATA = 0x01 , CT_INFO = 0x02 , CT_MARKER = 0x04 , CT_TYPE = 0x08 , CT_TRIGGER = 0x10 } |
The chunk types. More... | |
enum | tOpenMode { OM_None = 0x00 , OM_DisableFileSystemCache = 0x01 , OM_SyncWrite = 0x02 , OM_QueryInfo = 0x04 , OM_ValidateChunkHeader = 0x08 , OM_FileChangeMode = 0x10 } |
File open modes. More... | |
![]() | |
typedef std::list< tFileExtensionStruct * > | tFileExtensionList |
own type definition for a better work with file extension lists | |
![]() | |
static const tUInt32 | m_nFileId |
For internal use only (will be moved to a private implementation). | |
static const tUInt32 | m_nVersionId |
supported Version of Indexed File within ADTF 2.0 until 2.12 and >= 2.13 if NO History is used while writing file (currently 0x00000201) | |
static const tUInt32 | m_nVersionIdWithHistory |
supported Version of Indexed File within >= ADTF 2.13 if a file buffered history is used while writing file (currently 0x00000300) | |
static const tUInt32 | m_nVersionIdWithHistoryEndOffset |
supported Version of Indexed File within >= ADTF 2.13.1 if a file buffered history is used while writing file (currently 0x00000301) | |
static const tUInt32 | m_nVersionADTF3 |
supported Version of Indexed File within >= ADTF 3.0.0 (currently 0x00000301) | |
static const tUInt8 | m_ui8ByteOrder |
current value of platform ByteOrder ( More... | |
static tInt64 | m_nDefaultBlockSize |
Default block size in bytes. | |
static tInt64 | m_nDefaultCacheSize |
Default cache size in bytes. | |
Class for reading indexed files.
Definition at line 17 of file indexedfilereader.h.
|
protected |
Checks whether the current position in the file is valid.
ERR_END_OF_FILE | if past the end or not opened. |
ERR_DEVICE_IO | if the file position could not be set. |
|
virtual |
tResult FindExtension | ( | const tChar * | strIdentifier, |
tFileExtension ** | ppsExtensionInfo, | ||
tVoid ** | ppData | ||
) |
This function gets the extension data.
strIdentifier | [in] the extension name |
ppsExtensionInfo | [out] the tFileExtension struct |
ppData | [out] the extension data |
tResult GetAdditionalStreamInfo | ( | tUInt16 | ui16StreamId, |
const tVoid ** | pInfoData, | ||
tUInt * | pnInfoSize | ||
) |
This function gets the additional stream information data of the given stream.
ui16StreamId | [in] the stream Id |
pInfoData | [out] the tSampleStreamHeader data |
pnInfoSize | [out] the size of the returned data |
tInt64 GetChunkCount | ( | ) |
This function returns the number of chunks of the current file.
This function returns the current file position (Index or TimeStamp)
nTimeFormat | [in] a format value (tTimeFormat) |
tTimeStamp GetDuration | ( | ) |
This function returns the duration of the current file [microsec].
tResult GetExtension | ( | tInt | nIndex, |
tFileExtension ** | ppsExtensionInfo, | ||
tVoid ** | ppData | ||
) |
This function gets the extension data.
nIndex | [in] the extension index |
ppsExtensionInfo | [out] the tFileExtension struct |
ppData | [out] the extension data |
tInt GetExtensionCount | ( | ) |
Get the amount of extensions in the file.
tInt64 GetFilePos | ( | ) |
This function returns the current chunk index.
tTimeStamp GetFirstTime | ( | tUInt16 | ui16StreamId | ) |
This function gets the first time stamp of the given stream.
ui16StreamId | [in] the stream Id |
tTimeStamp GetLastTime | ( | tUInt16 | ui16StreamId | ) |
This function gets the last time stamp of the given stream.
ui16StreamId | [in] the stream Id |
This function gets the number of chunks of the given stream.
ui16StreamId | [in] the stream Id |
This function gets the stream name which is set.
ui16StreamId | [in] the stream Id |
This function gets the number of indices of the given stream.
ui16StreamId | [in] the stream Id |
tTimeStamp GetTimeOffset | ( | ) |
This function returns the Time Zero Point Offset every Time is referring to.
tUInt32 GetVersionId | ( | ) |
This function returns the Version Id of the current file.
|
protectedvirtual |
This function gets the chunk index of the given file position.
ui16StreamId | [in] the stream Id |
nPosition | [in] the file position |
nTimeFormat | [in] the format of nPosition (tTimeFormat) |
|
virtual |
This function opens a dat-file for reading.
strFilename | [in] the file name to be opened |
nCacheSize | [in] cache size; <=0: use system file caching (=default) |
ui32Flags | [in] a tOpenMode value |
Reimplemented in cIndexedFileChanger.
tResult QueryChunkInfo | ( | tChunkHeader ** | ppChunkHeader | ) |
This function returns the ChunkInfo of the current chunk.
ppChunkHeader | [out] the current chunk info |
This function reads and returns the current Chunk and increments the current chunk index.
ppData | [out] the current chunk data |
ui32Flags | [in] a tReadFlags the value |
Reads a raw data block from the file.
[out] | pvBuffer | Here the data will be stored. |
[in] | nBufferSize | The amount of bytes to read. |
|
protected |
Reads and initializes the Header struct.
|
protected |
Reads and initializes the ExtendedHeader.
|
protected |
Initializes the IndexTable.
tResult ReadNextChunk | ( | tChunkHeader ** | ppChunkHeader, |
tVoid ** | ppData, | ||
tUInt32 | ui32Flags = 0 , |
||
tUInt32 | ui32StreamId = 0 |
||
) |
This function reads and returns the current Chunk and ChunkInfo struct and increments the current chunk index.
If a stream Id is specified, the next Chunk and ChunkInfo struct of this stream will be returned.
ppChunkHeader | [out] the current chunk info |
ppData | [out] the current chunk data |
ui32Flags | [in] a tReadFlagsthe value |
ui32StreamId | [in] the stream Id |
tResult ReadNextChunkInfo | ( | tChunkHeader ** | ppChunkHeader | ) |
This function gets the next chunk information.
ppChunkHeader | [out] the tChunkHeader data |
tResult Reset | ( | ) |
This function resets the file to the beginning of data.
This function sets the new file position and returns the new chunk index or -1 in case the chunk can not be found (for example stream Id is invalid or file position is out of range).
ui16StreamId | [in] the stream Id |
nPosition | [in] the new file position |
nTimeFormat | [in] the format of nPosition (tTimeFormat) |
ui32Flags | [in] a tSeekFlags value |
This function sets the file position.
nPosition | [in] the new file position |
nTimeFormat | [in] the format of nPosition (tTimeFormat) |
|
protected |
Set the end of file indication.
tResult SkipChunk | ( | ) |
This function skips the next Chunk by incrementing the current chunk index and setting the new FilePosition.
tResult SkipChunkInfo | ( | ) |
This function increments the current chunk index.