ADTF  v2.14.3
cIndexedFileReader Class Reference

Class for reading indexed files. More...

Inheritance diagram for cIndexedFileReader:

Public Member Functions

 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 tCharGetStreamName (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...
 
- Public Member Functions inherited from cIndexedFile
 cIndexedFile ()
 Default constructor.
 
virtual ~cIndexedFile ()
 Destructor.
 
tResult SetDescription (const tChar *strDescription)
 Sets the description of the file. More...
 
const tCharGetDescription () 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.
 
- Protected Member Functions inherited from cIndexedFile
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.
 
tVoidGetCacheAddr ()
 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...
 
tVoidInternalMalloc (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).
 
- Protected Attributes inherited from cIndexedFile
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
 
tUInt8m_pBuffer
 internal Buffer
 
tInt64 m_nBufferSize
 internal Buffer size
 
tFileHeaderm_psFileHeader
 current file header
 
tBool m_bWriteGUID
 protection for writing GUID
 
tFileExtensionList m_lstExtensions
 list with all extensions
 
tVoidm_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

- Public Types inherited from IIndexedFile
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 }
 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...
 
- Protected Types inherited from cIndexedFile
typedef std::list< tFileExtensionStruct * > tFileExtensionList
 own type definition for a better work with file extension lists
 
- Static Protected Attributes inherited from cIndexedFile
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 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.
 

Detailed Description

Class for reading indexed files.

Definition at line 25 of file indexedfilereader.h.

Member Function Documentation

tResult CheckFilePtr ( )
protected

Checks whether the current position in the file is valid.

Return values
ERR_END_OF_FILEif past the end or not opened.
ERR_DEVICE_IOif the file position could not be set.
virtual tResult Close ( )
virtual

This function closes all.

Returns
tResult

Reimplemented from cIndexedFile.

tResult FindExtension ( const tChar strIdentifier,
tFileExtension **  ppsExtensionInfo,
tVoid **  ppData 
)

This function gets the extension data.

Parameters
strIdentifier[in] the extension name
ppsExtensionInfo[out] the tFileExtension struct
ppData[out] the extension data
Returns
tResult
This method is real-time safe.
See The ADTF Real-Time Extension.
tResult GetAdditionalStreamInfo ( tUInt16  ui16StreamId,
const tVoid **  pInfoData,
tUInt pnInfoSize 
)

This function gets the additional stream information data of the given stream.

Parameters
ui16StreamId[in] the stream Id
pInfoData[out] the tMediaSampleStreamHeader data
pnInfoSize[out] the size of the returned data
Returns
Standard Result Code.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt64 GetChunkCount ( )

This function returns the number of chunks of the current file.

Returns
tInt64
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt64 GetCurrentPos ( tInt  nTimeFormat)

This function returns the current file position (Index or TimeStamp)

Parameters
nTimeFormat[in] a format value (tTimeFormat)
Returns
tInt64 -> the current file position (Index or TimeStamp)
This method is real-time safe.
See The ADTF Real-Time Extension.
tTimeStamp GetDuration ( )

This function returns the duration of the current file [microsec].

Returns
tTimeStamp
This method is real-time safe.
See The ADTF Real-Time Extension.
tResult GetExtension ( tInt  nIndex,
tFileExtension **  ppsExtensionInfo,
tVoid **  ppData 
)

This function gets the extension data.

Parameters
nIndex[in] the extension index
ppsExtensionInfo[out] the tFileExtension struct
ppData[out] the extension data
Returns
tResult
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt GetExtensionCount ( )

Get the amount of extensions in the file.

Returns
The amount of extensions in the file.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt64 GetFilePos ( )

This function returns the current chunk index.

Returns
tInt64
tTimeStamp GetFirstTime ( tUInt16  ui16StreamId)

This function gets the first time stamp of the given stream.

Parameters
ui16StreamId[in] the stream Id
Returns
The first time appears in file for the stream.
This method is real-time safe.
See The ADTF Real-Time Extension.
tTimeStamp GetLastTime ( tUInt16  ui16StreamId)

This function gets the last time stamp of the given stream.

Parameters
ui16StreamId[in] the stream Id
Returns
The last time in file for the stream.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt64 GetStreamIndexCount ( tUInt16  ui16StreamId)

This function gets the number of chunks of the given stream.

Parameters
ui16StreamId[in] the stream Id
Returns
tInt64
This method is real-time safe.
See The ADTF Real-Time Extension.
const tChar* GetStreamName ( tUInt16  ui16StreamId)

This function gets the stream name which is set.

Parameters
ui16StreamId[in] the stream Id
Returns
The stream name for the given stream id if set. Returns NULL if stream id is invalid.
This method is real-time safe.
See The ADTF Real-Time Extension.
tInt64 GetStreamTableIndexCount ( tUInt16  ui16StreamId)

This function gets the number of indices of the given stream.

Parameters
ui16StreamId[in] the stream Id
Returns
tInt64
This method is real-time safe.
See The ADTF Real-Time Extension.
tTimeStamp GetTimeOffset ( )

This function returns the Time Zero Point Offset every Time is referring to.

Returns
tTimeStamp the time offset of point zero
This method is real-time safe.
See The ADTF Real-Time Extension.
tUInt32 GetVersionId ( )

This function returns the Version Id of the current file.

Returns
tUInt32
This method is real-time safe.
See The ADTF Real-Time Extension.
virtual tResult Initialize ( )
protectedvirtual

Initializes the reader.

Returns
Standard result.

Reimplemented from cIndexedFile.

tInt64 LookupChunkRef ( tUInt16  ui16StreamId,
tInt64  nPosition,
tInt  nTimeFormat 
)

This function gets the chunk index of the given file position.

Parameters
ui16StreamId[in] the stream Id
nPosition[in] the file position
nTimeFormat[in] the format of nPosition (tTimeFormat)
Returns
tInt64 -> the chunk index
This method is real-time safe.
See The ADTF Real-Time Extension.
virtual tResult Open ( const cString strFilename,
tInt  nCacheSize = -1,
tUInt32  ui32Flags = 0 
)
virtual

This function opens a dat-file for reading.

Parameters
strFilename[in] the file name to be opened
nCacheSize[in] cache size; <=0: use system file caching (=default)
ui32Flags[in] a tOpenMode value
Returns
tResult

Reimplemented in cIndexedFileChanger.

tResult QueryChunkInfo ( tChunkHeader **  ppChunkHeader)

This function returns the ChunkInfo of the current chunk.

Parameters
ppChunkHeader[out] the current chunk info
Returns
tResult
tResult ReadChunk ( tVoid **  ppData,
tUInt32  ui32Flags = 0 
)

This function reads and returns the current Chunk and increments the current chunk index.

Parameters
ppData[out] the current chunk data
ui32Flags[in] a tReadFlags the value
Returns
tResult
tResult ReadDataBlock ( tVoid pvBuffer,
long  nBufferSize 
)
protected

Reads a raw data block from the file.

Parameters
[out]pvBufferHere the data will be stored.
[in]nBufferSizeThe amount of bytes to read.
Returns
Standard result.
tResult ReadFileHeader ( )
protected

Reads and initializes the Header struct.

Returns
Standard Result
tResult ReadFileHeaderExt ( )
protected

Reads and initializes the ExtendedHeader.

Returns
Standard Result
tResult ReadIndexTable ( )
protected

Initializes the IndexTable.

Returns
Standard Result
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.

Parameters
ppChunkHeader[out] the current chunk info
ppData[out] the current chunk data
ui32Flags[in] a tReadFlagsthe value
ui32StreamId[in] the stream Id
Returns
tResult
tResult ReadNextChunkInfo ( tChunkHeader **  ppChunkHeader)

This function gets the next chunk information.

Parameters
ppChunkHeader[out] the tChunkHeader data
Returns
tResult
tResult Reset ( )

This function resets the file to the beginning of data.

Returns
tResult
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).

Parameters
ui16StreamId[in] the stream Id
nPosition[in] the new file position
nTimeFormat[in] the format of nPosition (tTimeFormat)
ui32Flags[in] a tSeekFlags value
Returns
tInt64 -> the current chunk index or -1
tInt64 SetCurrentPos ( tInt64  nPosition,
tInt  nTimeFormat 
)

This function sets the file position.

Parameters
nPosition[in] the new file position
nTimeFormat[in] the format of nPosition (tTimeFormat)
Returns
tInt64 -> the current chunk index
tResult SetEOF ( )
protected

Set the end of file indication.

Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
tResult SkipChunk ( )

This function skips the next Chunk by incrementing the current chunk index and setting the new FilePosition.

Returns
tResult
tResult SkipChunkInfo ( )

This function increments the current chunk index.

Returns
tResult

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)