df_SplitInfoUnpacker Class Reference
[IVD Data format.]

#include <df.h>

Inheritance diagram for df_SplitInfoUnpacker:

Inheritance graph
[legend]
Collaboration diagram for df_SplitInfoUnpacker:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 1665 of file df.h.


Public Member Functions

 df_SplitInfoUnpacker (ivd_MedVolNum_t a_medVolNum, ivd_MediaKey_t a_mediaKey, df_BlockProxy *a_reader, bool a_unpackNSCfields=false, ivd_BlockOffset_t a_lastDataVolBlkOfs=0, const cmn_UUID_t &a_volumeID=cmn_UUID_t(string("")))
 Default constructor.
virtual ~df_SplitInfoUnpacker ()
ivd_MedVolNum_t GetMedVolNum ()
ivd_MediaKey_t GetMediumKey ()
vector< UInt64_tGetMinorCollocationIds ()

Protected Member Functions

virtual void ProcRecFileHdr (const df_RecCmn_t *a_recCmn_p)
virtual void ProcRecFileEnd (const df_RecCmn_t *a_recCmn_p)
virtual void ProcRecBSStart (const df_RecCmn_t *a_recCmn_p)
virtual void ProcRecEmbData (const df_RecCmn_t *a_recCmn_p)
virtual void ProcRecRawData (const UInt8_t *a_block_p)
virtual void ProcRecBSEnd (const df_RecCmn_t *a_recCmn_p)
virtual void ProcRecFRIEnd (const df_RecCmn_t *a_recCmn_p)
virtual void ProcRecFRISpInfo (const df_RecCmn_t *a_recCmn_p)
virtual void ProcEndOfInput ()
 method ProcEndOfInput() must be called at the end of input when block per block parsing is used (migration, FRI check before wirtten to media.
void ExtractCollocationIds (const char *a_block_p, UInt32_t a_size)

Protected Attributes

ivd_BlockOffset_t m_lastDataVolBlkOfs
ivd_BlockOffset_t m_lastDataPosInFRI
bool m_collocationDataValid
UInt64_t m_majorColId
UInt64_t m_lastMinorColId
vector< UInt64_tm_minorColIds

Private Member Functions

virtual void ProcSplitInfo (df_SplitInfo *a_splitInfo)
 when one split info is parsed then call ProcSplitInfo()

Private Attributes

 log_CLASSID_m
 Macro to add class name member s_className.
const bool m_unpackNSCfields
bool m_unpackMetaData
string m_lastStreamName
const ivd_MedVolNum_t m_medVolNum
const ivd_MediaKey_t m_mediaKey
df_SplitInfo m_splitInfo
UInt64_t m_streamOfs
 TODO reuse following members from inherited class df_RecordReader m_curStreamOffset, m_curStreamLeft, m_curStreamType, m_curStreamName.clear().
UInt64_t m_streamSizeToRead
 size of stream that need to be read streamsize - streamOfs
UInt64_t m_readStreamSize
 how much atream is realy read
UInt64_t m_allStreamOfs
 point in data format where stream is written
bool m_headerToWrite
 Does the header for this stream have to be written?

Friends

IVD_DF_DECL_d ostream & operator<< (ostream &a_os, const df_SplitInfoUnpacker &a_obj)

Constructor & Destructor Documentation

df_SplitInfoUnpacker::df_SplitInfoUnpacker ( ivd_MedVolNum_t  a_medVolNum,
ivd_MediaKey_t  a_mediaKey,
df_BlockProxy a_reader,
bool  a_unpackNSCfields = false,
ivd_BlockOffset_t  a_lastDataVolBlkOfs = 0,
const cmn_UUID_t a_volumeID = cmn_UUID_t(string("")) 
)

Default constructor.

Definition at line 39 of file df_splitinfounpacker.cpp.

References ie_PRECONDITION, ivd_Error, m_splitInfo, and df_SplitInfo::mediaKey.

00046         :
00047         df_RecReader(a_reader, a_volumeID),
00048         m_unpackNSCfields(a_unpackNSCfields),
00049         m_unpackMetaData(false),
00050         m_medVolNum(a_medVolNum),
00051         m_mediaKey(a_mediaKey),
00052         m_headerToWrite(false),
00053         m_lastDataVolBlkOfs(a_lastDataVolBlkOfs),
00054         m_lastDataPosInFRI(0),
00055         m_collocationDataValid(false),
00056         m_majorColId(0),
00057         m_lastMinorColId(0)
00058 {
00059     // empty
00060     m_splitInfo.mediaKey = 0;
00061     if (a_mediaKey > USHRT_MAX) {
00062         stringstream err;
00063         err << " The medium key is too large ("
00064             << a_mediaKey << "). "
00065             << " Not supported by the FSC.\n";
00066         throw ivd_Error(ie_PRECONDITION, err.str(), true);
00067     }
00068 }
//============================================================================//

virtual df_SplitInfoUnpacker::~df_SplitInfoUnpacker (  )  [inline, virtual]

Definition at line 1677 of file df.h.

01677 {};


Member Function Documentation

void df_SplitInfoUnpacker::ProcRecFileHdr ( const df_RecCmn_t a_recCmn_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 83 of file df_splitinfounpacker.cpp.

References df_SplitInfo::attrStream, df_SplitInfo::chunkOffset, df_RecFile_t::chunkSize, df_SplitInfo::chunkSize, df_Stream::Clear(), df_SplitInfo::continueSplit, df_SplitInfo::dataType, df_RF_CONTINUED, df_SplitInfo::failedDataType, df_SplitInfo::fileID, df_SplitInfo::fileName, df_SplitInfo::fileSize, df_SplitInfo::fileType, df_RecCmn_t::flags, df_RecCmn_t::GetVarDataNet(), df_RecFile_t::idFile, df_RecFile_t::idMig, df_RecFile_t::idParent, df_RecFile_t::idParentOld, ivd_ATTR_d, df_SplitInfo::lastSplit, m_mediaKey, m_medVolNum, m_splitInfo, df_SplitInfo::mediaKey, df_SplitInfo::medVolNum, df_SplitInfo::migrationID, df_RecFile_t::name, df_RecFile_t::nameOld, df_SplitInfo::noCopies, ntoh(), df_RecFile_t::numCopies, df_StandardAttr_t::numLinks, df_SplitInfo::numLinks, df_SplitInfo::oldFileName, df_SplitInfo::oldOwnerID, OnlyFileName(), df_SplitInfo::ownerID, ivd_VarData_t::size, df_StandardAttr_t::size, df_SplitInfo::splitOffset, df_SplitInfo::splitSize, df_RecFile_t::stdAttr, df_StandardAttr_t::type, and df_Stream::Write().

00083                                                                       {
00084     const df_RecFile_t *file_p = df_GetSpecificRec<df_RecFile_t>(a_recCmn_p);
00085 
00086     m_splitInfo.fileType     = static_cast<ivd_FileType_e>( ntoh(file_p->stdAttr.type) );
00087     m_splitInfo.dataType     = ivd_ATTR_d;
00088     m_splitInfo.failedDataType = 0;
00089 
00090 #if IVD_POSIX_OS
00091     #warning "do we use numLinks"
00092 #elif TGT_OS_windows
00093     #pragma message ("WARNING: do we use numLinks")
00094 #endif
00095     m_splitInfo.numLinks     = ntoh(file_p->stdAttr.numLinks);
00096     m_splitInfo.lastSplit    = false;        // we do not know yet
00097 
00098     m_splitInfo.medVolNum    = m_medVolNum;
00099     m_splitInfo.mediaKey     = m_mediaKey;
00100 
00101     m_splitInfo.noCopies     = ntoh(file_p->numCopies);
00102 
00103     m_splitInfo.fileID       = static_cast<ivd_FileID_t>(ntoh(file_p->idFile));
00104     m_splitInfo.migrationID  = ntoh(file_p->idMig);
00105     m_splitInfo.fileSize     = ntoh(file_p->stdAttr.size);
00106     m_splitInfo.chunkSize    = ntoh(file_p->chunkSize);
00107     m_splitInfo.ownerID      = static_cast<ivd_FileID_t>(ntoh(file_p->idParent));
00108     m_splitInfo.oldOwnerID   = static_cast<ivd_FileID_t>(ntoh(file_p->idParentOld));
00109 
00110     m_splitInfo.fileName = OnlyFileName(a_recCmn_p->GetVarDataNet(file_p->name),
00111                                         ntoh(file_p->name.size));
00112 
00113     m_splitInfo.oldFileName = OnlyFileName(a_recCmn_p->GetVarDataNet(file_p->nameOld),
00114                                         ntoh(file_p->nameOld.size));
00115 
00116     m_splitInfo.chunkOffset  = 0;
00117     m_splitInfo.splitOffset  = 0;
00118     m_splitInfo.splitSize    = 0;
00119 
00120     m_splitInfo.attrStream.Clear();
00121     m_splitInfo.attrStream.Write((const char*)&file_p->stdAttr,
00122                                  sizeof(file_p->stdAttr));
00123 
00124     m_splitInfo.continueSplit = ntoh(a_recCmn_p->flags) & df_RF_CONTINUED;
00125 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcRecFileEnd ( const df_RecCmn_t a_recCmn_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 129 of file df_splitinfounpacker.cpp.

References at_FIRSTSPLIT, at_LASTSPLIT, at_SPLIT, df_SplitInfo::attrStream, df_SplitInfo::continueSplit, dbg_DETAIL, df_FS_COMPLETE, df_RF_SPLITTED, df_SplitInfo::Dump(), df_SplitInfo::fileID, df_RecCmn_t::flags, df_RecReader::GetLastKnownGoodBlockID(), ie_DF_INVSEQ, df_SplitInfo::lastSplit, log_DBG_m, log_FUNC_m, m_splitInfo, df_SplitInfo::mediaKey, ntoh(), ProcSplitInfo(), df_SplitInfo::splitOffset, df_SplitInfo::splitSize, and df_Stream::Write().

00129                                                                       {
00130     log_FUNC_m(ProcRecFileEnd);
00131 
00132     // if not splited then is last split
00133 
00134     // df_distiler did not set df_RF_SPLITTED at fileEnd record before version 3.0.131 Beta_01
00135     // Work around: recreate FRI for particular volume.
00136     UInt32_t flags = ntoh(a_recCmn_p->flags);
00137     m_splitInfo.lastSplit = !(flags & df_RF_SPLITTED);
00138 
00139     log_DBG_m(dbg_DETAIL, "last split " << boolalpha << m_splitInfo.lastSplit
00140                     << ", flags " << hex << flags << dec);
00141 
00142     if (  !m_splitInfo.mediaKey) {
00143         throw ivd_DFError(
00144             ie_DF_INVSEQ,
00145             GetLastKnownGoodBlockID(),
00146             "No File record before FileEnd");
00147     }
00148     log_DBG_m(dbg_DETAIL, "At FEnd extracted from FRI " << m_splitInfo.Dump());
00149     const df_RecFileEnd_t *recFileEnd_p = df_GetSpecificRec<df_RecFileEnd_t>(a_recCmn_p);
00150 
00151 
00152     if (ntoh(recFileEnd_p->status) == df_FS_COMPLETE) { // skip it if not valid
00153         if (m_splitInfo.continueSplit || (flags & df_RF_SPLITTED) != 0) { //
00154             // write info about the split
00155 
00156             df_AttrType_e splitPosition = at_LASTSPLIT;
00157             if ( (flags & df_RF_SPLITTED) != 0) {
00158                 splitPosition = (m_splitInfo.continueSplit) ? at_SPLIT : at_FIRSTSPLIT;
00159             }
00160             log_DBG_m(dbg_DETAIL,
00161                 "File ID: " << m_splitInfo.fileID <<
00162                 ", splitPosition:" << splitPosition);
00163 
00164             df_AttrHeader_t at(splitPosition, m_splitInfo.splitOffset, m_splitInfo.splitSize);
00165             m_splitInfo.attrStream.Write((char*)&at, sizeof(at));
00166         }
00167         ProcSplitInfo(&m_splitInfo);
00168     }
00169     // clear mediaKey
00170     m_splitInfo.mediaKey = 0;
00171 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcRecBSStart ( const df_RecCmn_t a_recCmn_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 175 of file df_splitinfounpacker.cpp.

References df_RecByteStreamStart_t::allStreamSize, at_ADS, df_SplitInfo::attrStream, df_ST_ALTDATA, df_ST_META, df_RecCmn_t::GetVarDataNet(), m_allStreamOfs, df_RecReader::m_curStreamLeft, df_RecReader::m_curStreamType, m_headerToWrite, m_lastStreamName, m_readStreamSize, m_splitInfo, m_streamOfs, m_streamSizeToRead, m_unpackMetaData, m_unpackNSCfields, ntoh(), ivd_VarData_t::size, df_RecByteStreamStart_t::streamName, df_RecByteStreamStart_t::streamOffset, df_RecByteStreamStart_t::streamSize, and df_Stream::Write().

00175                                                                        {
00176     if (!m_unpackNSCfields) {
00177         return;
00178     }
00179     const df_RecByteStreamStart_t *bss_p = df_GetSpecificRec<df_RecByteStreamStart_t>(a_recCmn_p);
00180     if (m_curStreamType == df_ST_META) {
00181         m_lastStreamName = a_recCmn_p->GetVarDataNet(bss_p->streamName);
00182 //        if (m_lastStreamName == c_df_StreamNameMetaWinACL) {
00183         m_unpackMetaData = true;
00184         // to know where is stored
00185         m_readStreamSize    = 0;
00186         m_streamOfs         = ntoh(bss_p->streamOffset);
00187         UInt64_t streamSize = ntoh(bss_p->streamSize);
00188         m_streamSizeToRead  = streamSize - m_streamOfs ;
00189         m_allStreamOfs      = ntoh(bss_p->allStreamSize);
00190 
00191         m_headerToWrite = true;
00192     }
00193     else if (m_curStreamType == df_ST_ALTDATA) {
00194         UInt32_t nameSize = ntoh(bss_p->streamName.size);
00195         df_AttrHeader_t ah(at_ADS, 0, nameSize);
00196         m_splitInfo.attrStream.Write((char*)&ah, sizeof(ah));
00197         m_splitInfo.attrStream.Write(a_recCmn_p->GetVarDataNet(bss_p->streamName),
00198                                      nameSize);
00199         // ADS are not packed in FRI
00200         m_curStreamLeft = 0;
00201     }
00202 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcRecEmbData ( const df_RecCmn_t a_recCmn_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 206 of file df_splitinfounpacker.cpp.

References df_SplitInfo::attrStream, df_RecEmbeddedData_t::data, df_ST_META, ExtractCollocationIds(), GetAttrType(), df_RecCmn_t::GetVarDataNet(), df_RecReader::m_curStreamName, df_RecReader::m_curStreamType, m_headerToWrite, m_lastStreamName, m_readStreamSize, m_splitInfo, m_streamOfs, m_streamSizeToRead, m_unpackMetaData, m_unpackNSCfields, ntoh(), ivd_VarData_t::size, size, stn_WIN_EA, and df_Stream::Write().

00206                                                                        {
00207     if (  !m_unpackNSCfields
00208        || !m_unpackMetaData) {
00209         return;
00210     }
00211 
00212     if ( m_headerToWrite && m_curStreamType == df_ST_META) {
00213 
00214         // Header for the stream wasn't written yet.
00215         df_AttrHeader_t ah(GetAttrType(m_lastStreamName),
00216                             m_streamOfs,
00217                             m_streamOfs + m_streamSizeToRead);
00218 
00219         m_splitInfo.attrStream.Write((char*)&ah, sizeof(ah));
00220     }
00221 
00222     m_headerToWrite = false;
00223 
00224     const df_RecEmbeddedData_t *embData_p = df_GetSpecificRec<df_RecEmbeddedData_t>(a_recCmn_p);
00225     UInt32_t size = ntoh(embData_p->data.size);
00226     m_readStreamSize += size;
00227     m_splitInfo.attrStream.Write((const char*)a_recCmn_p->GetVarDataNet(embData_p->data),
00228                                  size);
00229     if (m_curStreamName == stn_WIN_EA) {
00230         ExtractCollocationIds(a_recCmn_p->GetVarDataNet(embData_p->data), size);
00231     }
00232 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcRecRawData ( const UInt8_t a_block_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 236 of file df_splitinfounpacker.cpp.

References df_SplitInfo::attrStream, df_RecReader::GetBlkSize(), log_ERR_m, log_FUNC_m, m_readStreamSize, m_splitInfo, m_unpackMetaData, m_unpackNSCfields, and df_Stream::Write().

00236                                                                   {
00237     log_FUNC_m(ProcRecRawData);
00238 
00239     log_ERR_m("Raw data blocks not supported for streams from FRI." << (*this) );
00240 
00241     if (  !m_unpackNSCfields
00242        || !m_unpackMetaData) {
00243         return;
00244     }
00245     m_readStreamSize += GetBlkSize();
00246     m_splitInfo.attrStream.Write((const char*)a_block_p, GetBlkSize());
00247 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcRecBSEnd ( const df_RecCmn_t a_recCmn_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 251 of file df_splitinfounpacker.cpp.

References df_SplitInfo::attrStream, df_Stream::Cut(), dbg_DETAIL, dbg_LOW, df_SS_COMPLETE, df_ST_META, evt_ERROR, df_SplitInfo::failedDataType, df_SplitInfo::fileID, ie_DATA_CORRUPTION, log_DBG_m, log_FUNC_m, log_WriteEvent(), df_RecReader::m_curStreamName, df_RecReader::m_curStreamType, df_RecReader::m_ignoreCorruptedMetaData, m_lastStreamName, m_readStreamSize, m_splitInfo, m_streamSizeToRead, m_unpackMetaData, m_unpackNSCfields, ntoh(), df_RecByteStreamEnd_t::status, and df_Stream::WriteZeroes().

00251                                                                      {
00252     log_FUNC_m(ProcRecBSEnd);
00253 
00254     if (  !m_unpackNSCfields
00255        || !m_unpackMetaData) {
00256         return;
00257     }
00258     const df_RecByteStreamEnd_t *bse_p = df_GetSpecificRec<df_RecByteStreamEnd_t>(a_recCmn_p);
00259     if (m_lastStreamName != m_curStreamName) {
00260         throw ivd_InternalError(ie_DATA_CORRUPTION,
00261                 "BSEnd stream name doesn't match BSS name. Start name = '" + m_lastStreamName
00262                 + "', end name = '" + m_curStreamName + string("'"));
00263     }
00264     // check if all stream is read
00265     if (m_streamSizeToRead != m_readStreamSize) {
00266         if (m_readStreamSize == 0) {
00267             log_DBG_m(dbg_LOW,
00268                 "Detected empty split \'" << m_curStreamName << "\'");
00269         }
00270         else {
00271             log_DBG_m(dbg_LOW,
00272                 "Incomplete re-located stream \'" << m_curStreamName <<
00273                 "\'. Filling remainder with zeroes.");
00274             // fill zeroes up to the end of the stream
00275 
00276             m_splitInfo.attrStream.WriteZeroes(m_streamSizeToRead - m_readStreamSize);
00277         }
00278     }
00279 
00280     if (ntoh(bse_p->status) != df_SS_COMPLETE) {
00281         // failedDataType member could be used in future for better error handling.
00282         // see bug
00283         m_splitInfo.failedDataType |= m_curStreamType;
00284         if (m_ignoreCorruptedMetaData && (m_curStreamType == df_ST_META)) {
00285             ostringstream sstr;
00286             sstr << "Incomplete meta data stream ignored. "
00287                  << " FileID = " << m_splitInfo.fileID;
00288             log_WriteEvent(evt_ERROR, sstr.str());
00289             m_splitInfo.attrStream.Cut(sizeof(df_StandardAttr_t));
00290         }
00291         else {
00292             log_DBG_m(dbg_DETAIL,
00293                 "Stream is not complete. FileID = " << m_splitInfo.fileID
00294                 << " failed byte stream type = " << m_curStreamType
00295                 << " Only header is stored in attrStream.");
00296             m_splitInfo.attrStream.Cut(sizeof(df_StandardAttr_t));
00297         }
00298     }
00299 
00300     // prepare for next stream
00301     m_lastStreamName.erase();
00302     m_unpackMetaData = false;
00303 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcRecFRIEnd ( const df_RecCmn_t a_recCmn_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 306 of file df_splitinfounpacker.cpp.

References at_FIRSTSPLIT, at_SPLIT, df_SplitInfo::attrStream, df_SplitInfo::continueSplit, dbg_LOW, df_RecFRIEnd_t::endPos, log_DBG_m, log_FUNC_m, df_RecReader::m_curStreamName, m_lastDataPosInFRI, m_readStreamSize, m_splitInfo, m_streamSizeToRead, m_unpackMetaData, df_SplitInfo::mediaKey, ntoh(), ProcSplitInfo(), df_SplitInfo::splitOffset, df_SplitInfo::splitSize, df_Stream::Write(), and df_Stream::WriteZeroes().

00306                                                                       {
00307     log_FUNC_m(ProcRecFRIEnd);
00308 
00309     const df_RecFRIEnd_t *frie_p = df_GetSpecificRec<df_RecFRIEnd_t>(a_recCmn_p);
00310     m_lastDataPosInFRI = ntoh(frie_p->endPos);
00311 
00312     // at end of tape no file End record exist. lastSplit stay false
00313     if (m_splitInfo.mediaKey != 0) {
00314 
00315         if (m_unpackMetaData) {
00316             // check if all stream is read
00317             if (m_streamSizeToRead != m_readStreamSize) {
00318                 if (m_readStreamSize == 0) {
00319                     log_DBG_m(dbg_LOW,
00320                         "Detected empty split \'" << m_curStreamName << "\'");
00321                 }
00322                 else {
00323                     log_DBG_m(dbg_LOW,
00324                         "Incomplete re-located stream \'" << m_curStreamName <<
00325                         "\'. Filling remainder with zeroes.");
00326                         // fill zeroes up to the end of the stream
00327 
00328                     m_splitInfo.attrStream.WriteZeroes(m_streamSizeToRead - m_readStreamSize);
00329                 }
00330             }
00331 
00332             m_unpackMetaData = false;
00333         }
00334         // not all stream data read, write spliPos Info.
00335         df_AttrType_e splitPosition = (m_splitInfo.continueSplit)
00336                                     ? at_SPLIT
00337                                     : at_FIRSTSPLIT;
00338         df_AttrHeader_t at(splitPosition, m_splitInfo.splitOffset, m_splitInfo.splitSize);
00339         m_splitInfo.attrStream.Write((char*)&at, sizeof(at));
00340 
00341         ProcSplitInfo(&m_splitInfo);
00342         m_splitInfo.mediaKey = 0;
00343     }
00344 
00345 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcRecFRISpInfo ( const df_RecCmn_t a_recCmn_p  )  [protected, virtual]

Reimplemented from df_RecReader.

Definition at line 349 of file df_splitinfounpacker.cpp.

References df_RecFRISpInfo_t::allStreamOffset, df_RecFRISpInfo_t::allStreamSize, df_SplitInfo::blockOffset, df_SplitInfo::dataType, dbg_DETAIL, log_DBG_m, log_FUNC_m, m_splitInfo, df_RecFRISpInfo_t::mediaBlockAddr, ntoh(), df_SplitInfo::splitOffset, df_SplitInfo::splitSize, and df_RecFRISpInfo_t::streamType.

00349                                                                         {
00350     log_FUNC_m(ProcRecFRISpInfo);
00351 
00352     const df_RecFRISpInfo_t *friSI_p = df_GetSpecificRec<df_RecFRISpInfo_t>(a_recCmn_p);
00353 
00354     m_splitInfo.splitOffset = ntoh(friSI_p->allStreamOffset);
00355     m_splitInfo.splitSize   = ntoh(friSI_p->allStreamSize);
00356     m_splitInfo.dataType    = static_cast<ivd_DataType_t>(  // only lower 16-bit
00357                                                     ntoh(friSI_p->streamType));
00358     m_splitInfo.blockOffset = ntoh(friSI_p->mediaBlockAddr);
00359     log_DBG_m(dbg_DETAIL, "df_RecFRISpInfo_t: "
00360         << "\nallStreamOffset " << m_splitInfo.splitOffset
00361         << "\nallStreamSize " << m_splitInfo.splitSize
00362         << "\nstreamType " << m_splitInfo.dataType
00363         << "\nmediaBlockAddr " << m_splitInfo.blockOffset
00364         << endl);
00365 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ProcEndOfInput (  )  [protected, virtual]

method ProcEndOfInput() must be called at the end of input when block per block parsing is used (migration, FRI check before wirtten to media.

).

Reimplemented from df_RecReader.

Definition at line 368 of file df_splitinfounpacker.cpp.

References dbg_DETAIL, df_RecReader::GetLastKnownGoodBlockID(), ie_DF_INVSEQ, ie_DF_INVSTATE, cmn_UUID_t::IsNull(), log_DBG_m, log_FUNC_m, df_RecReader::m_currVolID, m_lastDataPosInFRI, and m_lastDataVolBlkOfs.

00368                                           {
00369     log_FUNC_m(ProcEndOfInput);
00370 
00371     log_DBG_m(dbg_DETAIL,  "m_currVolID " << m_currVolID
00372                        <<  ", m_lastDataVolBlkOfs " << m_lastDataVolBlkOfs);
00373 
00374     if (!m_currVolID.IsNull()) {
00375         ostringstream sstr;
00376         sstr << *this;
00377         throw ivd_DFError(
00378             ie_DF_INVSEQ,
00379             GetLastKnownGoodBlockID(),
00380             "No more FRI data, but FRIEnd missing.", sstr.str(), true);
00381     }
00382 
00383     if ( m_lastDataVolBlkOfs == 0) {
00384         return;
00385     }
00386 
00387     if (m_lastDataPosInFRI < m_lastDataVolBlkOfs) {
00388         ostringstream sstr;
00389         sstr
00390             << " FRI end position : " << m_lastDataPosInFRI
00391             << " lastBlkOfs : " << m_lastDataVolBlkOfs << endl
00392             << *this;
00393         throw ivd_DFError(
00394             ie_DF_INVSTATE,
00395             GetLastKnownGoodBlockID(),
00396             "Read less FRI data then expected.", sstr.str(), true);
00397     }
00398 }

Here is the call graph for this function:

void df_SplitInfoUnpacker::ExtractCollocationIds ( const char *  a_block_p,
UInt32_t  a_size 
) [protected]

Definition at line 400 of file df_splitinfounpacker.cpp.

References dbg_DETAIL, _ivdfs_Collocation_EA_tag::EaName, ivdfs_COLLOCATION_EANAME_SZ_d, log_DBG_m, log_FUNC_m, m_collocationDataValid, m_lastMinorColId, m_majorColId, m_minorColIds, _ivdfs_Collocation_EA_tag::major, _ivdfs_Collocation_EA_tag::minor, and _ivdfs_Collocation_EA_tag::NextEntryOffset.

Referenced by ProcRecEmbData().

00400                                                                                        {
00401     log_FUNC_m(ExtractCollocationIds);
00402 
00403 #if TGT_OS_windows
00404     char* buffer_p = const_cast<char*>(a_block_p);
00405     ivdfs_Collocation_EA_t *ea;
00406     do { // go through all EAs
00407         ea = reinterpret_cast<ivdfs_Collocation_EA_t*>(buffer_p);
00408 
00409         if (memcmp(ea->EaName, ivdfs_COLLOCATION_EANAME_SZ_d, sizeof(ivdfs_COLLOCATION_EANAME_SZ_d)) == 0) {
00410             log_DBG_m(dbg_DETAIL, "Collocation EA found."
00411                 << " Major: 0x" << hex << ea->major
00412                 << " Minor: 0x" << hex << ea->minor);
00413 
00414             if ((ea->major == 0) || (ea->minor == 0)) {
00415                 log_DBG_m(dbg_DETAIL, "Skipped");
00416                 return;
00417             }
00418             if (!m_collocationDataValid) {
00419                 m_majorColId = ea->major;
00420                 m_collocationDataValid = true;
00421             }
00422             else if (m_majorColId != ea->major) {
00423                 // TODO: Log error?
00424                 log_DBG_m(dbg_DETAIL, "BUG: Unexpected major collocation ID"
00425                     << " 0x" << hex << ea->major
00426                     << " (expected 0x" << hex << m_majorColId << ").");
00427 
00428                 m_collocationDataValid = false;
00429                 m_minorColIds.clear();
00430                 return;
00431             }
00432 
00433             if (m_lastMinorColId != ea->minor) {
00434                 bool alreadyInserted(false);
00435                 for (UInt32_t i(0); i < m_minorColIds.size(); i++) {
00436                     if (m_minorColIds[i] == ea->minor) {
00437                         alreadyInserted = true;
00438                         break;
00439                     }
00440                 }
00441 
00442                 if (!alreadyInserted) {
00443                     m_minorColIds.push_back(ea->minor);
00444                     m_lastMinorColId = ea->minor;
00445                     log_DBG_m(dbg_DETAIL, "Minor ID " << ea->minor << " inserted.");
00446                 }
00447             }
00448             // No need to check other EAs
00449             break;
00450         }
00451 
00452         // move to next EA
00453         buffer_p += ea->NextEntryOffset;
00454         if ((a_block_p + a_size) > buffer_p) {
00455             // Out of buffer
00456             break;
00457         }
00458     } while (ea->NextEntryOffset != 0);
00459 #else
00460     log_DBG_m(dbg_DETAIL, "No implementation for Linux.");
00461 #endif
00462 }

Here is the caller graph for this function:

ivd_MedVolNum_t df_SplitInfoUnpacker::GetMedVolNum (  )  [inline]

Definition at line 1730 of file df.h.

Referenced by i_FSC_i::InsertSplitFromFRIBlock(), and fsc_VolumeCheck::RestDataHandle().

01730 { return m_medVolNum; };

Here is the caller graph for this function:

ivd_MediaKey_t df_SplitInfoUnpacker::GetMediumKey (  )  [inline]

Definition at line 1731 of file df.h.

Referenced by i_FSC_i::InsertSplitFromFRIBlock(), and fsc_VolumeCheck::RestDataHandle().

01731 { return m_mediaKey; };

Here is the caller graph for this function:

vector<UInt64_t> df_SplitInfoUnpacker::GetMinorCollocationIds (  )  [inline]

Definition at line 1732 of file df.h.

Referenced by i_FSC_i::InsertSplitFromFRIBlock().

01732 { return m_minorColIds; }

Here is the caller graph for this function:

virtual void df_SplitInfoUnpacker::ProcSplitInfo ( df_SplitInfo a_splitInfo  )  [inline, private, virtual]

when one split info is parsed then call ProcSplitInfo()

Reimplemented in fsc_FRIunpacker, and fsc_VolumeCheck.

Definition at line 1738 of file df.h.

Referenced by ProcRecFileEnd(), and ProcRecFRIEnd().

01738 {};

Here is the caller graph for this function:


Friends And Related Function Documentation

IVD_DF_DECL_d ostream& operator<< ( ostream &  a_os,
const df_SplitInfoUnpacker a_obj 
) [friend]

Definition at line 465 of file df_splitinfounpacker.cpp.

00465                                                                      {
00466     a_os << "m_mediumKey : " << a_o.m_mediaKey << endl
00467          << "m_medVolNum : " << a_o.m_medVolNum << endl
00468          << "m_unpackNSCfields : " << boolalpha  << a_o.m_unpackNSCfields << endl
00469          << "m_unpackMetaData : " << boolalpha << a_o.m_unpackMetaData << endl
00470          << "m_lastDataVolBlkOfs : " << a_o.m_lastDataVolBlkOfs << endl
00471          << endl
00472          << *static_cast<const df_RecReader*>(&a_o);
00473 
00474     return a_os;
00475 }


Member Data Documentation

Macro to add class name member s_className.

Reimplemented from df_RecReader.

Reimplemented in fsc_FRIblockUnpacker, fsc_FRIunpacker, and fsc_VolumeCheck.

Definition at line 1677 of file df.h.

Definition at line 1683 of file df.h.

Referenced by operator<<(), ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), and ProcRecRawData().

Definition at line 1685 of file df.h.

Referenced by ProcRecBSEnd(), ProcRecBSStart(), and ProcRecEmbData().

Definition at line 1686 of file df.h.

Referenced by operator<<(), and ProcRecFileHdr().

Definition at line 1687 of file df.h.

Referenced by operator<<(), and ProcRecFileHdr().

TODO reuse following members from inherited class df_RecordReader m_curStreamOffset, m_curStreamLeft, m_curStreamType, m_curStreamName.clear().

start point of stream data

Definition at line 1697 of file df.h.

Referenced by ProcRecBSStart(), and ProcRecEmbData().

size of stream that need to be read streamsize - streamOfs

Definition at line 1699 of file df.h.

Referenced by ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), and ProcRecFRIEnd().

how much atream is realy read

Definition at line 1701 of file df.h.

Referenced by ProcRecBSEnd(), ProcRecBSStart(), ProcRecEmbData(), ProcRecFRIEnd(), and ProcRecRawData().

point in data format where stream is written

Definition at line 1703 of file df.h.

Referenced by ProcRecBSStart().

Does the header for this stream have to be written?

Definition at line 1706 of file df.h.

Referenced by ProcRecBSStart(), and ProcRecEmbData().

Definition at line 1709 of file df.h.

Referenced by operator<<(), and ProcEndOfInput().

Definition at line 1710 of file df.h.

Referenced by ProcEndOfInput(), and ProcRecFRIEnd().

Definition at line 1712 of file df.h.

Referenced by ExtractCollocationIds().

Definition at line 1713 of file df.h.

Referenced by ExtractCollocationIds().

Definition at line 1714 of file df.h.

Referenced by ExtractCollocationIds().

Definition at line 1715 of file df.h.

Referenced by ExtractCollocationIds().


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 19:13:30 2012 for OPENARCHIVE by  doxygen 1.5.6