fsc_SplitStream_t Struct Reference
[G_new_group]

#include <fsc_nsAttrStream.h>

Collaboration diagram for fsc_SplitStream_t:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 38 of file fsc_nsAttrStream.h.


Public Member Functions

 fsc_SplitStream_t ()
 fsc_SplitStream_t (const fsc_SplitStream_t &a_ss)
bool operator< (const fsc_SplitStream_t &a_ss)
void Dump (ostream &os)
void Pack (df_Packer &a_packer)

Public Attributes

df_AttrHeader_t splitInfo
string splitData
 log_CLASSID_m

Constructor & Destructor Documentation

fsc_SplitStream_t::fsc_SplitStream_t (  )  [inline]

Definition at line 39 of file fsc_nsAttrStream.h.

00039 {};

fsc_SplitStream_t::fsc_SplitStream_t ( const fsc_SplitStream_t a_ss  )  [inline]

Definition at line 41 of file fsc_nsAttrStream.h.

References splitData, and splitInfo.

00041                                                      {
00042         splitInfo = a_ss.splitInfo;
00043         splitData = a_ss.splitData;
00044     };


Member Function Documentation

bool fsc_SplitStream_t::operator< ( const fsc_SplitStream_t a_ss  )  [inline]

Definition at line 47 of file fsc_nsAttrStream.h.

References df_AttrHeader_t::attrOfs, and splitInfo.

00047                                                     {
00048         return splitInfo.attrOfs < a_ss.splitInfo.attrOfs;
00049     };

void fsc_SplitStream_t::Dump ( ostream &  os  ) 

Definition at line 40 of file fsc_nsAttrStream.cpp.

References at_ADS, at_ENDOFDATA, at_LASTSPLIT, at_META_MASK, df_AttrHeader_t::attrOfs, df_AttrHeader_t::attrSize, df_AttrHeader_t::attrType, cmn_HexDump(), cmn_Num2Str(), GetAttrName(), ie_DF_INVSEQ, splitData, and splitInfo.

00040                                        {
00041     if (splitInfo.attrType == at_ENDOFDATA) {
00042         os << "  Complete attributes." << endl;
00043     }
00044     else {
00045         os << " Split Info : ofs = " << splitInfo.attrOfs  
00046         << "  size = " << splitInfo.attrSize 
00047         << "  lastSplit = " <<  boolalpha << (splitInfo.attrType == at_LASTSPLIT) << endl;
00048     }
00049 
00050     df_AttrHeader_t ah;
00051     const char *ip = splitData.data();
00052     const char *ep = ip + splitData.size();
00053 
00054     while (true) {
00055         if (ip + sizeof(df_AttrHeader_t) > ep) {
00056             break;
00057         }
00058         memcpy(&ah, ip, sizeof(df_AttrHeader_t));
00059 
00060         ip += sizeof(df_AttrHeader_t);
00061 
00062         if (ah.attrType & at_META_MASK) {
00063                 os  << " Attribute header: type = META, stream name = " 
00064                     << GetAttrName((df_AttrType_e)(ah.attrType))
00065                     << "  ofs " << ah.attrOfs  
00066                     << "  size " << ah.attrSize << endl;
00067                 os  << cmn_HexDump(ip, ah.attrSize, 16, true);
00068         }
00069         else if (ah.attrType == at_ADS) {
00070                 os  << " Attribute header: type = ADS name "
00071                     << "  ofs " << ah.attrOfs  
00072                     << "  size " << ah.attrSize << endl;
00073                 os  << "  name = " << string(ip, ah.attrSize) << endl;
00074         }
00075         else {
00076                 throw ivd_InternalError(ie_DF_INVSEQ, 
00077                         string("Unknown record type in split stream. type =") 
00078                         + cmn_Num2Str(int(ah.attrType)));
00079         }
00080         ip += ah.attrSize;
00081     }
00082 }

Here is the call graph for this function:

void fsc_SplitStream_t::Pack ( df_Packer a_packer  ) 

Definition at line 85 of file fsc_nsAttrStream.cpp.

References at_ADS, at_ENDOFDATA, at_LASTSPLIT, at_META_MASK, df_AttrHeader_t::attrOfs, df_AttrHeader_t::attrSize, df_AttrHeader_t::attrType, cmn_HexDump(), cmn_Num2Str(), dbg_DETAIL, dbg_LOW, df_SS_ABORTED, df_SS_COMPLETE, df_ST_ALTDATA, df_ST_META, GetAttrName(), df_Packer::GetBSData(), ivd_BaseException::GetError(), ivd_BaseException::GetFriendly(), ie_DF_INVSEQ, ie_DF_SSIZE, log_DBG_m, log_FUNC_m, splitData, splitInfo, df_Packer::WriteBSData(), df_Packer::WriteRecBSEnd(), and df_Packer::WriteRecBSStart().

00085                                                {
00086     log_FUNC_m(Pack);
00087     if (splitInfo.attrType != at_ENDOFDATA) { // not last stream
00088         return;
00089     }
00090     log_DBG_m(dbg_DETAIL, " Split Info : ofs = " << splitInfo.attrOfs  
00091     << "  size = " << splitInfo.attrSize 
00092     << "  lastSplit = " <<  boolalpha << (splitInfo.attrType == at_LASTSPLIT));
00093 
00094     df_AttrHeader_t ah;
00095     const char *ip = splitData.data();
00096     const char *ep = ip + splitData.size();
00097 
00098     while (true) {
00099         if (ip + sizeof(df_AttrHeader_t) > ep) {
00100             break;
00101         }
00102         memcpy(&ah, ip, sizeof(df_AttrHeader_t));
00103 
00104         ip += sizeof(df_AttrHeader_t);
00105 
00106         if (ah.attrType & at_META_MASK) {
00107             log_DBG_m(dbg_DETAIL, " Attribute header: type = META, stream name = " 
00108                 << GetAttrName((df_AttrType_e)(ah.attrType))
00109                 << "  ofs " << ah.attrOfs  
00110                 << "  size " << ah.attrSize);
00111             log_DBG_m(dbg_DETAIL, cmn_HexDump(ip, ah.attrSize, 16, true));
00112 
00113             a_packer.WriteRecBSStart(df_ST_META, 
00114                                      GetAttrName((df_AttrType_e)(ah.attrType)), 
00115                                      ah.attrSize);
00116 
00117             UInt32_t status = df_SS_COMPLETE;
00118             UInt64_t streamLeft = ah.attrSize;
00119 
00120             while (streamLeft > 0) {
00121 
00122                 UInt8_t *buf;
00123                 UInt32_t bufSize;
00124                 try {
00125                     a_packer.GetBSData(buf, bufSize);
00126                 }
00127                 catch (ivd_Exception &ie) {
00128                     if (ie.GetError() == ie_DF_SSIZE) {
00129                         log_DBG_m(dbg_LOW, "Cannot get buffer for stream: " << 
00130                                     ie.GetFriendly());
00131                         status = df_SS_ABORTED;
00132                         break;
00133                     }
00134                     else
00135                         throw;
00136                 }
00137 
00138                 memcpy(buf, ip, bufSize);
00139                 ip += bufSize;
00140 
00141                 // commit DF buffer
00142                 a_packer.WriteBSData();
00143 
00144                 streamLeft -= bufSize;
00145             } // while (streamLeft > 0)
00146 
00147             try {
00148                 a_packer.WriteRecBSEnd(status);
00149             }
00150             catch (ivd_Exception &ie) {
00151                 if (ie.GetError() == ie_DF_SSIZE) {
00152                     log_DBG_m(dbg_LOW, "BSEnd error: " << ie.GetFriendly());
00153                     // end byte stream, with different status -> should succeeed
00154                     a_packer.WriteRecBSEnd(df_SS_ABORTED);
00155                 }
00156                 else
00157                     throw;
00158             }
00159 
00160         }
00161         else if (ah.attrType == at_ADS) {
00162             string streamName(ip, ah.attrSize);
00163 
00164             log_DBG_m(dbg_DETAIL, " Attribute header: type = ADS name "
00165                 << "  ofs " << ah.attrOfs  
00166                 << "  size " << ah.attrSize 
00167                 << "  name = " << streamName);
00168 
00169             a_packer.WriteRecBSStart(df_ST_ALTDATA, 
00170                                      streamName, 
00171                                      0);
00172             a_packer.WriteRecBSEnd(df_SS_COMPLETE);
00173             ip += ah.attrSize;
00174         }
00175         else {
00176                 throw ivd_InternalError(ie_DF_INVSEQ, 
00177                         string("Unknown record type in split stream. type =") 
00178                         + cmn_Num2Str(int(ah.attrType)));
00179         }
00180     }
00181 }

Here is the call graph for this function:


Member Data Documentation

Definition at line 56 of file fsc_nsAttrStream.h.


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

Generated on Mon Feb 27 19:24:53 2012 for OPENARCHIVE by  doxygen 1.5.6