ADTF  3.18.2
indexreadtable.h
Go to the documentation of this file.
1 
7 #ifndef _INDEX_READ_TABLE_CLASS_HEADER_
8 #define _INDEX_READ_TABLE_CLASS_HEADER_
9 
10 
11 
12 namespace A_UTILS_NS
13 {
14 
18 class DOEXPORT cIndexReadTable
19 {
21 
22  private:
23  struct tIndexTable
24  {
25  tIndexTable():nIndexTableOffset(0), nIndexCount(0), tmLastIndex(0), nIndexOffset(0) {}
26 
27  tUInt64 nIndexTableOffset;
28  tUInt64 nIndexCount;
29  //the timestamp of the last index entry
30  tTimeStamp tmLastIndex;
31  //the chunk position of the last index entry
32  tUInt64 nIndexOffset;
33  };
34 
36  {
38  pMasterChunkRefTable(nullptr)
39  {}
40 
41  IIndexedFile::tChunkRef *pMasterChunkRefTable;
42  };
43 
45  {
47  pStreamInfoHeader(nullptr),
48  pStreamRefTable(nullptr),
49  pAdditionalStreamInfo(nullptr)
50  {}
51 
52  IIndexedFile::tStreamInfoHeader* pStreamInfoHeader;
53  IIndexedFile::tStreamRef* pStreamRefTable;
54  tVoid* pAdditionalStreamInfo;
55  };
56 
57  typedef std::vector<tStreamIndexTable> tStreamIndexTableVector;
58 
59  // master table
60  tMasterIndexTable m_oMasterIndexTable;
61 
62  // stream tables
63  tStreamIndexTable m_aStreamIndexTables[MAX_INDEXED_STREAMS + 1];
64 
65  // pointer to indexed source file
66  cIndexedFile *m_pIndexedFile;
67  IIndexedFile::tFileHeader *m_pFileHeader;
68 
69  public:
70 
76  tResult Create(cIndexedFile *pIndexedFile);
77 
83 
89 
99  const tChar* GetStreamName(tUInt16 ui16StreamId);
100 
110  const IIndexedFile::tStreamInfoHeader* GetStreamInfo(tUInt16 ui16StreamId);
111 
112 
123 
134 
144  const void* GetAdditionalStreamInfo(tUInt16 ui16StreamId);
145 
152  tInt64 GetItemCount(tUInt16 ui16StreamId);
153 
159  tResult AdjustChunkHeader(IIndexedFile::tChunkHeader* pHeader);
160 
169  tResult FillChunkHeaderFromIndex(tUInt32 ui32MasterIdx, IIndexedFile::tChunkHeader* pHeader,
170  tInt64* pChunkIndex, tInt64* pChunkOffset);
171 
187  tInt32 LookupChunkRef(tUInt16 ui16StreamId, tInt64 nPos,
188  tInt nTimeFormat, tInt64 *pChunkIndex,
189  tInt64* pChunkOffset, tInt64* pEndChunkIndex,
190  tInt64* pMasterIndex);
191 
201  tUInt16 nChunkFlags, tInt64* pMasterIndex);
202 
209  tResult ValidateRawMasterIndex(tUInt32 ui32RefMasterTableIndex);
210 
211  private:
212 
213 
221  IIndexedFile::tAdditionalIndexInfo& rAdditionalIndexInfo);
222 
232  tResult AddStreamIndexTableEntry(tUInt16 ui16StreamId, IIndexedFile::tStreamRef* pStreamRef,
233  IIndexedFile::tStreamInfoHeader* pStreamInfo,
234  tVoid *pAdditionalStreamInfo,
235  tUInt64 uiCount);
236 
243  tResult AddMasterIndexTableEntry(void* pRefTbl, tUInt64 uiCount);
244 
256  tResult GetStreamRef(tUInt16 ui16StreamId, tUInt32 ui32StreamIdx,
257  IIndexedFile::tStreamRef *pStreamRef);
258 };
259 
260 } // namespace
261 #endif // _INDEX_READ_TABLE_CLASS_HEADER_
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
int64_t tInt64
type definition for signed integer values (64bit) (platform and compiler independent type).
int32_t tInt32
type definition for signed integer values (32bit) (platform and compiler independent type).
void tVoid
The tVoid is always the definition for the void (non-type).
uint16_t tUInt16
type definition for unsigned integer values (16bit) (platform and compiler independent type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
uint64_t tUInt64
type definition for unsigned integer values (64bit) (platform and compiler independent type).
Class for storing an index table of an indexed file.
tResult AdjustChunkHeader(IIndexedFile::tChunkHeader *pHeader)
Adjusts the indices in the given chunk header.
tResult GetStreamRef(tUInt16 ui16StreamId, tUInt32 ui32StreamIdx, IIndexedFile::tStreamRef *pStreamRef)
This function gets a stream reference of the given id and index.
tResult ValidateRawMasterIndex(tUInt32 ui32RefMasterTableIndex)
Checks if the specified index is valid.
const tChar * GetStreamName(tUInt16 ui16StreamId)
This function gets the name of a stream by its id.
tResult AddStreamIndexTableEntry(tUInt16 ui16StreamId, IIndexedFile::tStreamRef *pStreamRef, IIndexedFile::tStreamInfoHeader *pStreamInfo, tVoid *pAdditionalStreamInfo, tUInt64 uiCount)
Adds a new item to the stream index table.
tResult FillChunkHeaderFromIndex(tUInt32 ui32MasterIdx, IIndexedFile::tChunkHeader *pHeader, tInt64 *pChunkIndex, tInt64 *pChunkOffset)
Filles a chunk header from a master index entry.
tResult Free()
Frees all allocated resources.
tResult ReadIndexTable()
Build stream index tables.
tResult FindNearestEntryWithFlags(tUInt16 ui16StreamId, tUInt64 nChunkIndex, tUInt16 nChunkFlags, tInt64 *pMasterIndex)
Tries to find an entry before or at a given timestamp that has certain flags set.
const IIndexedFile::tStreamInfoHeader * GetStreamInfo(tUInt16 ui16StreamId)
This function gets the information header of a stream by its id.
const void * GetAdditionalStreamInfo(tUInt16 ui16StreamId)
This function gets the additional stream information by its id.
tResult Create(cIndexedFile *pIndexedFile)
Allocates all neccessary resources.
tTimeStamp GetLastTime(tUInt16 ui16StreamId)
This function gets the last time stamp of the given stream.
tResult SetIndexOffsetInfos(tUInt16 ui16StreamId, IIndexedFile::tAdditionalIndexInfo &rAdditionalIndexInfo)
Sets additional index offsets.
tTimeStamp GetFirstTime(tUInt16 ui16StreamId)
This function gets the first time stamp of the given stream.
tInt64 GetItemCount(tUInt16 ui16StreamId)
Returns the item count of a stream.
tInt32 LookupChunkRef(tUInt16 ui16StreamId, tInt64 nPos, tInt nTimeFormat, tInt64 *pChunkIndex, tInt64 *pChunkOffset, tInt64 *pEndChunkIndex, tInt64 *pMasterIndex)
This function gets the chunk index of the given file position.
tResult AddMasterIndexTableEntry(void *pRefTbl, tUInt64 uiCount)
Adds a new item to the master index table.
Base class for all indexed file classes.
Definition: indexedfile.h:74
#define A_UTILS_D(__pclassname_)
Helper macro for d-pattern definitions.
Definition: d_ptr.h:270
#define MAX_INDEXED_STREAMS
Maximum of indexed streams.
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11