#include <WOscBundle.h>
Public Member Functions | |
| void | ResetStateMachine () |
| void | Clone (char **buffer, unsigned int *bufferLen) const |
| void | Parse (const char *data, unsigned int len) |
| WOscTimeTag | GetTimeTag () const |
| unsigned int | GetItemCount () const |
| bool | GetNextItem (const char **buffer, unsigned int *length) |
Classes | |
| class | WOscBundleRaw |
WOscBundleRaw* bundle = reinterpret_cast<WOscBundleRaw*>(data);
Definition at line 72 of file WOscBundle.h.
|
|
Return the number of items in the bundle.
Definition at line 162 of file WOscBundle.h. 00162 { return m_nItems; }
|
|
||||||||||||
|
Get the next item in the bundle.
Definition at line 171 of file WOscBundle.h. 00172 {
00173 unsigned int dataLen = m_bundleLen - WOSC_BUNDLE_HEADER_SIZE;
00174 if ( m_nextItem >= m_nItems || m_offset >= dataLen )
00175 return false;
00176
00177 *length = WOscUtil::BufferTo<int32_t>(m_bundle->m_bundleData + m_offset);
00178 *buffer = m_bundle->m_bundleData + m_offset + sizeof(uint32_t);
00179 m_offset += *length + sizeof(uint32_t);
00180 m_nextItem++;
00181
00182 return true;
00183 }
|
|
|
Get the time tag. Bundle must have been parsed successfully before.
Definition at line 155 of file WOscBundle.h. References WOscTimeTag::GetImmediateTime(). 00156 {
00157 if ( m_bundle == NULL )
00158 return WOscTimeTag::GetImmediateTime();
00159 return WOscTimeTag(reinterpret_cast<const char*>(&m_bundle->m_timeTag));
00160 }
|
|
||||||||||||
|
Check if bundle layout correct and extract information required to iterate through all bundle items.
Definition at line 125 of file WOscBundle.h. References WOSC_BUNDLE_TAG. 00126 {
00127 // reset all members to zero (0)
00128 memset(this, 0, sizeof(WOscBundleParser));
00129
00130 const WOscBundleRaw* bundle = reinterpret_cast<const WOscBundleRaw*>(data);
00131
00132 unsigned int dataLen = len - WOSC_BUNDLE_HEADER_SIZE;
00133 if ( dataLen > len ) // if wrapped
00134 throw WOscException(ERR_TOO_SHORT, __FILE__, __LINE__);
00135 if ( dataLen == 0 )
00136 throw WOscException(ERR_EMPTY_BUNDLE, __FILE__, __LINE__);
00137 if ( strncmp(bundle->m_tag, WOSC_BUNDLE_TAG, sizeof(bundle->m_tag)) != 0 )
00138 throw WOscException(ERR_INVALID_TAG, __FILE__, __LINE__);
00139
00140 // check if layout valid by stepping through bundle
00141 unsigned int offset = 0;
00142 for ( ; offset + sizeof(int32_t) < dataLen; m_nItems++ ) {
00143 int itemLen = WOscUtil::BufferTo<int32_t>(bundle->m_bundleData+offset);
00144 offset += itemLen + sizeof(uint32_t);
00145 }
00146 if ( offset != dataLen ) {
00147 throw WOscException(ERR_CURRUPT_BUNDLE_LAYOUT, __FILE__, __LINE__);
00148 }
00149 if ( m_nItems == 0 )
00150 throw WOscException(ERR_NO_ITEMS_IN_BUNDLE, __FILE__, __LINE__);
00151 m_bundle = bundle;
00152 m_bundleLen = len;
00153 }
|
1.4.1