![]() |
|
|
Generated: 18 Jul 2008 |
#include <GaudiKernel/StreamBuffer.h>
Collaboration diagram for StreamBuffer:

The basic idea behind the StreamBuffer is generic object conversion. The StreamBuffer acts as a byte stream (hence inheriting from a std::string) and stores any information streamed to the buffer. Since the information must be represented in a generic way on the fly byte swapping is performed. However, not only primitive data can be stored in the buffer, but also pointers to DataObjects (symbolic links) and pointers to contained objects. Automatically during serialization the persistent references to the corresponding objects and containers must be stored. These objects are accessible from the StreamBuffer object.
"On the fly" data conversion to non persistent
Definition at line 36 of file StreamBuffer.h.
Public Types | |
| enum | Mode { UNINITIALIZED, READING, WRITING } |
| Streamer mode. More... | |
| enum | SwapAction { SINGLE_BYTE, SWAP, NOSWAP } |
| Data Sawp actions. More... | |
| enum | State { INVALID = -1, VALID } |
| Link state defintions. More... | |
| typedef std::vector< ContainedLink > | ContainedLinks |
| typedef std::vector< IdentifiedLink > | IdentifiedLinks |
| Definition of the identifiable link set. | |
| typedef void(*) | AnalyzeFunction (const void *data, int siz, const std::type_info &type) |
| Definition of the buffer analyzer. | |
Public Member Functions | |
| StreamBuffer (bool do_swap=true) | |
| Standard constructor. | |
| virtual | ~StreamBuffer () |
| Standard destructor. | |
| const char * | data () const |
| Read access to data buffer. | |
| char * | data () |
| write access to data buffer | |
| void | erase () |
| Reset the buffer. | |
| void | reserve (long len) |
| Reserve buffer space; Default: 16 k buffer size. | |
| void | extend (long len) |
| Extend the buffer. | |
| long | size () const |
| Total buffer size. | |
| ContainedLinks & | containedLinks () |
| Access to contained links. | |
| const ContainedLinks & | containedLinks () const |
| CONST Access to contained links. | |
| IdentifiedLinks & | identifiedLinks () |
| Access to identified links. | |
| const IdentifiedLinks & | identifiedLinks () const |
| CONST Access to identified links. | |
| void | setMode (Mode m) |
| Set mode of the stream and allocate buffer. | |
| bool | isReading () const |
| Get stream buffer state. | |
| bool | isWriting () const |
| Get stream buffer state. | |
| long | buffPointer () const |
| Retrieve current buffer pointer. | |
| void | setBuffPointer (long ptr) |
| Retrieve current buffer pointer. | |
| void | setAnalyzer (AnalyzeFunction fun=0) |
| Enable user analysis function. | |
| void | swapToBuffer (const void *source, int siz) |
| Swap buffers: int, long, short, float and double. | |
| void | swapFromBuffer (void *target, int siz) |
| Swap buffers: int, long, short, float and double. | |
| StreamBuffer & | writeBytes (const char *str, long len) |
| Write string to output stream. | |
| void | getIdentifiedLink (DataObject *&pObject, long &hint) |
| void | addIdentifiedLink (const DataObject *pObject, long hint) |
| void | getContainedLink (ContainedObject *&pObject, long &hint, long &link) |
| void | addContainedLink (const ContainedObject *pObject, long hint, long link) |
| StreamBuffer & | operator<< (longlong data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (longlong &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (int data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (int &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned int data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned int &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (long data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (long &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned long data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned long &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (short data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (short &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned short data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned short &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (char data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (char &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (unsigned char data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (unsigned char &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (float data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (float &data) |
| Input Streamer. | |
| StreamBuffer & | operator<< (double data) |
| Output Streamer. | |
| StreamBuffer & | operator>> (double &data) |
| Input Streamer. | |
| StreamBuffer & | operator>> (char *data) |
| Streamer to read strings in (char*) format. | |
| StreamBuffer & | operator<< (const char *data) |
| Streamer to write strings in (char*) format. | |
| StreamBuffer & | operator>> (std::string &data) |
| Streamer to read strings in (std::string) format. | |
| StreamBuffer & | operator<< (const std::string &data) |
| Streamer to write strings in (std::string) format. | |
| template<class TYPE> | |
| StreamBuffer & | operator>> (TYPE *&refpObject) |
| Streamer to read links to contained or identified objects. | |
| StreamBuffer & | operator<< (const ContainedObject *pObject) |
| Streamer to write links to contained objects. | |
| StreamBuffer & | operator<< (const DataObject *pObject) |
| Streamer to write links to identified objects. | |
| void | serialize (DataIO &ioObject) |
| Serialize the buffer using an IO object. | |
Protected Member Functions | |
| SwapAction | swapBuffer (int siz) const |
| Check for byte swapping. | |
| template<class TYPE> | |
| StreamBuffer & | getObjectPointer (const DataObject *pObject, TYPE *&refpObject) |
| Helper to distinguis between identified pointers and contained pointers. | |
| template<class TYPE> | |
| StreamBuffer & | getObjectPointer (const ContainedObject *pObject, TYPE *&refpObject) |
| Helper to distinguis between identified pointers and contained pointers. | |
Protected Attributes | |
| Mode | m_mode |
| Boolean indicating wether the stream is in read or write mode. | |
| long | m_pointer |
| Current buffer pointer. | |
| long | m_length |
| Total buffer length. | |
| char * | m_buffer |
| Pointer to heap buffer. | |
| bool | m_swapEnabled |
| Flag indicating swapping. | |
| ContainedLinks | m_containedLinks |
| Container with links to contained objects. | |
| IdentifiedLinks | m_identifiedLinks |
| Container with links to contained objects. | |
| AnalyzeFunction | m_analyzer |
| Hook function for analysis of data to the stream. | |
Friends | |
| class | DataObject |
| DataObject is friend. | |
Classes | |
| class | ContainedLink |
| Definition of the contained link set. More... | |
| class | DataIO |
| A small base class to handle generic data streaming. More... | |
| class | IdentifiedLink |
| Definition of the contained link set. More... | |
| class | Istream |
| Reader for standard input streams. More... | |
| class | Ostream |
| Writer for standard output streams. More... | |
Definition at line 145 of file StreamBuffer.h.
| typedef void(*) StreamBuffer::AnalyzeFunction(const void *data, int siz, const std::type_info &type) |
| enum StreamBuffer::Mode |
Streamer mode.
Definition at line 110 of file StreamBuffer.h.
00110 {UNINITIALIZED, READING, WRITING};
| enum StreamBuffer::State |
| StreamBuffer::StreamBuffer | ( | bool | do_swap = true |
) | [inline] |
Standard constructor.
Definition at line 203 of file StreamBuffer.h.
References m_analyzer.
00203 : 00204 m_mode(UNINITIALIZED), 00205 m_pointer(0), 00206 m_length(0), 00207 m_buffer(0), 00208 m_swapEnabled(do_swap) 00209 { 00210 m_analyzer = 0; 00211 }
| virtual StreamBuffer::~StreamBuffer | ( | ) | [inline, virtual] |
Standard destructor.
Definition at line 213 of file StreamBuffer.h.
References m_buffer.
00213 { 00214 ::free( m_buffer ); 00215 }
| StreamBuffer::SwapAction StreamBuffer::swapBuffer | ( | int | siz | ) | const [inline, protected] |
Check for byte swapping.
Definition at line 566 of file StreamBuffer.h.
References m_swapEnabled, NOSWAP, SINGLE_BYTE, and SWAP.
Referenced by swapFromBuffer(), and swapToBuffer().
00566 { 00567 switch(siz) { 00568 case 1: 00569 return SINGLE_BYTE; 00570 default: 00571 #if defined(__alpha) && !defined(__VMS) 00572 // return m_swapEnabled ? SWAP : NOSWAP; 00573 return NOSWAP; 00574 #elif defined(__sun) && defined(__SVR4) && defined(__i386) 00575 // return m_swapEnabled ? SWAP : NOSWAP; 00576 return NOSWAP; 00577 #elif defined(__APPLE__) 00578 // return m_swapEnabled ? SWAP : NOSWAP; 00579 return SWAP; 00580 #elif defined(__linux) && !defined(__powerpc) 00581 // return m_swapEnabled ? SWAP : NOSWAP; 00582 return NOSWAP; 00583 #elif defined(BORLAND) || defined(_WIN32) || defined(WIN32) 00584 // return m_swapEnabled ? SWAP : NOSWAP; 00585 return NOSWAP; 00586 #else 00587 return m_swapEnabled ? SWAP : NOSWAP; 00588 // return NOSWAP; 00589 #endif 00590 } 00591 }
| StreamBuffer& StreamBuffer::getObjectPointer | ( | const DataObject * | pObject, | |
| TYPE *& | refpObject | |||
| ) | [inline, protected] |
Helper to distinguis between identified pointers and contained pointers.
This entry resolves identified pointers (= Pointers to DataObject instances.)
Definition at line 184 of file StreamBuffer.h.
References std::vector< _Tp, _Alloc >::back(), StreamBuffer::IdentifiedLink::first, m_identifiedLinks, and std::vector< _Tp, _Alloc >::pop_back().
Referenced by operator>>().
00184 { 00185 IdentifiedLink& link = m_identifiedLinks.back(); 00186 DataObject* pObj = link.first; 00187 m_identifiedLinks.pop_back(); 00188 refpObject = dynamic_cast<TYPE*>(pObj); 00189 return *this; 00190 }
| StreamBuffer& StreamBuffer::getObjectPointer | ( | const ContainedObject * | pObject, | |
| TYPE *& | refpObject | |||
| ) | [inline, protected] |
Helper to distinguis between identified pointers and contained pointers.
This entry resolves contained pointers (= Pointers to ContainedObject instances.)
Definition at line 194 of file StreamBuffer.h.
References std::vector< _Tp, _Alloc >::back(), StreamBuffer::ContainedLink::first, m_containedLinks, and std::vector< _Tp, _Alloc >::pop_back().
00194 { 00195 ContainedLink& link = m_containedLinks.back(); 00196 ContainedObject* pObj = link.first; 00197 m_containedLinks.pop_back(); 00198 refpObject = dynamic_cast<TYPE*>(pObj); 00199 return *this; 00200 }
| const char* StreamBuffer::data | ( | ) | const [inline] |
Read access to data buffer.
Definition at line 217 of file StreamBuffer.h.
References m_buffer.
Referenced by StreamBuffer::Ostream::dump(), StreamBuffer::Istream::load(), operator<<(), operator>>(), and writeBytes().
00217 { 00218 return m_buffer; 00219 }
| char* StreamBuffer::data | ( | ) | [inline] |
write access to data buffer
Definition at line 221 of file StreamBuffer.h.
References m_buffer.
00221 { 00222 return m_buffer; 00223 }
| void StreamBuffer::erase | ( | ) | [inline] |
Reset the buffer.
Definition at line 225 of file StreamBuffer.h.
References m_pointer.
Referenced by StreamBuffer::Istream::load().
00225 { 00226 m_pointer = 0; 00227 }
| void StreamBuffer::reserve | ( | long | len | ) | [inline] |
Reserve buffer space; Default: 16 k buffer size.
Definition at line 229 of file StreamBuffer.h.
References m_buffer, and m_length.
Referenced by extend(), and StreamBuffer::Istream::load().
00229 { 00230 if ( len > m_length ) { 00231 m_length = (len < 16384) ? 16384 : len; 00232 m_buffer = (char*)::realloc (m_buffer,m_length); 00233 } 00234 }
| void StreamBuffer::extend | ( | long | len | ) | [inline] |
Extend the buffer.
Definition at line 236 of file StreamBuffer.h.
References m_length, m_pointer, and reserve().
Referenced by swapToBuffer(), and writeBytes().
00236 { 00237 if ( len + m_pointer > m_length ) { 00238 // We have to be a bit generous here in order not to run too often 00239 // into ::realloc(). 00240 long new_len = (m_length < 16384) ? 16384 : 2*m_length; 00241 if ( m_length < len ) new_len += len; 00242 reserve(new_len); 00243 } 00244 }
| long StreamBuffer::size | ( | ) | const [inline] |
Total buffer size.
Definition at line 246 of file StreamBuffer.h.
References m_length.
00246 { 00247 return m_length; 00248 }
| ContainedLinks& StreamBuffer::containedLinks | ( | ) | [inline] |
Access to contained links.
Definition at line 250 of file StreamBuffer.h.
References m_containedLinks.
00250 { 00251 return m_containedLinks; 00252 }
| const ContainedLinks& StreamBuffer::containedLinks | ( | ) | const [inline] |
CONST Access to contained links.
Definition at line 254 of file StreamBuffer.h.
References m_containedLinks.
00254 { 00255 return m_containedLinks; 00256 }
| IdentifiedLinks& StreamBuffer::identifiedLinks | ( | ) | [inline] |
Access to identified links.
Definition at line 259 of file StreamBuffer.h.
References m_identifiedLinks.
00259 { 00260 return m_identifiedLinks; 00261 }
| const IdentifiedLinks& StreamBuffer::identifiedLinks | ( | ) | const [inline] |
CONST Access to identified links.
Definition at line 263 of file StreamBuffer.h.
References m_identifiedLinks.
00263 { 00264 return m_identifiedLinks; 00265 }
| void StreamBuffer::setMode | ( | Mode | m | ) | [inline] |
Set mode of the stream and allocate buffer.
Definition at line 268 of file StreamBuffer.h.
References std::vector< _Tp, _Alloc >::begin(), std::vector< _Tp, _Alloc >::end(), std::vector< _Tp, _Alloc >::erase(), m_containedLinks, m_identifiedLinks, m_mode, and m_pointer.
00268 { 00269 m_mode = m; 00270 m_pointer = 0; 00271 m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end()); 00272 m_identifiedLinks.erase(m_identifiedLinks.begin(),m_identifiedLinks.end()); 00273 }
| bool StreamBuffer::isReading | ( | ) | const [inline] |
Get stream buffer state.
Definition at line 276 of file StreamBuffer.h.
References m_mode, and READING.
Referenced by StreamBuffer::DataIO::serialize().
| bool StreamBuffer::isWriting | ( | ) | const [inline] |
Get stream buffer state.
Definition at line 281 of file StreamBuffer.h.
References m_mode, and WRITING.
Referenced by StreamBuffer::DataIO::serialize().
| long StreamBuffer::buffPointer | ( | ) | const [inline] |
Retrieve current buffer pointer.
Definition at line 285 of file StreamBuffer.h.
References m_pointer.
Referenced by StreamBuffer::Ostream::dump(), and writeBytes().
00285 { 00286 return m_pointer; 00287 }
| void StreamBuffer::setBuffPointer | ( | long | ptr | ) | [inline] |
Retrieve current buffer pointer.
Definition at line 289 of file StreamBuffer.h.
References m_pointer.
00289 { 00290 m_pointer = ptr; 00291 }
| void StreamBuffer::setAnalyzer | ( | AnalyzeFunction | fun = 0 |
) | [inline] |
Enable user analysis function.
Definition at line 293 of file StreamBuffer.h.
References m_analyzer.
00293 { 00294 m_analyzer = fun; 00295 }
| void StreamBuffer::swapToBuffer | ( | const void * | source, | |
| int | siz | |||
| ) | [inline] |
Swap buffers: int, long, short, float and double.
Definition at line 594 of file StreamBuffer.h.
References _swab, extend(), m_buffer, m_pointer, NOSWAP, SINGLE_BYTE, SWAP, and swapBuffer().
Referenced by operator<<().
00594 { 00595 char buff[8], *tar, *src = (char*)source; 00596 extend (m_pointer+siz); 00597 tar = (char*)m_buffer+m_pointer; 00598 switch ( swapBuffer(siz) ) { 00599 case SINGLE_BYTE: 00600 *tar = *src; 00601 break; 00602 case SWAP: 00603 #ifdef __APPLE__ 00604 for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i]; 00605 #else 00606 ::_swab (src, buff, siz); 00607 #endif 00608 src = buff; 00609 case NOSWAP: 00610 memcpy(tar, src, siz); 00611 break; 00612 } 00613 m_pointer += siz; 00614 }
| void StreamBuffer::swapFromBuffer | ( | void * | target, | |
| int | siz | |||
| ) | [inline] |
Swap buffers: int, long, short, float and double.
Definition at line 617 of file StreamBuffer.h.
References _swab, m_buffer, m_pointer, NOSWAP, SINGLE_BYTE, SWAP, and swapBuffer().
Referenced by operator>>().
00617 { 00618 char* tar = (char*)target; 00619 char* src = (char*)m_buffer+m_pointer; 00620 switch ( swapBuffer(siz) ) { 00621 case SINGLE_BYTE: 00622 *tar = *src; 00623 break; 00624 case SWAP: 00625 #ifdef __APPLE__ 00626 for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i]; 00627 #else 00628 ::_swab (src, tar, siz); 00629 #endif 00630 break; 00631 case NOSWAP: 00632 ::memcpy(tar, src, siz); 00633 break; 00634 } 00635 m_pointer += siz; 00636 }
| StreamBuffer& StreamBuffer::writeBytes | ( | const char * | str, | |
| long | len | |||
| ) | [inline] |
Write string to output stream.
Definition at line 303 of file StreamBuffer.h.
References buffPointer(), data(), extend(), and m_pointer.
Referenced by operator<<().
00303 { 00304 extend( m_pointer+len+4 ); 00305 *this << len; 00306 memcpy(data()+buffPointer(), str, len); 00307 m_pointer += len; 00308 return *this; 00309 }
| void StreamBuffer::getIdentifiedLink | ( | DataObject *& | pObject, | |
| long & | hint | |||
| ) | [inline] |
Definition at line 311 of file StreamBuffer.h.
References std::vector< _Tp, _Alloc >::back(), StreamBuffer::IdentifiedLink::first, m_identifiedLinks, std::vector< _Tp, _Alloc >::pop_back(), and StreamBuffer::IdentifiedLink::second.
00311 { 00312 IdentifiedLink& l = m_identifiedLinks.back(); 00313 pObject = l.first; 00314 hint = l.second; 00315 m_identifiedLinks.pop_back(); 00316 }
| void StreamBuffer::addIdentifiedLink | ( | const DataObject * | pObject, | |
| long | hint | |||
| ) | [inline] |
Definition at line 317 of file StreamBuffer.h.
References m_identifiedLinks, and std::vector< _Tp, _Alloc >::push_back().
Referenced by operator<<().
00317 { 00318 m_identifiedLinks.push_back( IdentifiedLink((DataObject*)pObject, hint) ); 00319 }
| void StreamBuffer::getContainedLink | ( | ContainedObject *& | pObject, | |
| long & | hint, | |||
| long & | link | |||
| ) | [inline] |
Definition at line 321 of file StreamBuffer.h.
References std::vector< _Tp, _Alloc >::back(), StreamBuffer::ContainedLink::first, m_containedLinks, std::vector< _Tp, _Alloc >::pop_back(), StreamBuffer::ContainedLink::second, and StreamBuffer::ContainedLink::third.
00321 { 00322 ContainedLink& l = m_containedLinks.back(); 00323 pObject = l.first; 00324 hint = l.second; 00325 link = l.third; 00326 m_containedLinks.pop_back(); 00327 }
| void StreamBuffer::addContainedLink | ( | const ContainedObject * | pObject, | |
| long | hint, | |||
| long | link | |||
| ) | [inline] |
Definition at line 328 of file StreamBuffer.h.
References m_containedLinks, and std::vector< _Tp, _Alloc >::push_back().
Referenced by operator<<().
00328 { 00329 m_containedLinks.push_back( ContainedLink((ContainedObject*)pObject, hint, link) ); 00330 }
| StreamBuffer& StreamBuffer::operator<< | ( | longlong | data | ) | [inline] |
Output Streamer.
Definition at line 356 of file StreamBuffer.h.
References data(), STREAM_ANALYSE, and swapToBuffer().
00356 { 00357 swapToBuffer(&data, sizeof(data)); 00358 STREAM_ANALYSE(data, sizeof(data)); 00359 return *this; 00360 }
| StreamBuffer& StreamBuffer::operator>> | ( | longlong & | data | ) | [inline] |
Input Streamer.
Definition at line 362 of file StreamBuffer.h.
References data(), and swapFromBuffer().
00362 { 00363 swapFromBuffer(&data, sizeof(data)); 00364 return *this; 00365 }
| StreamBuffer& StreamBuffer::operator<< | ( | int | data | ) | [inline] |
Output Streamer.
Definition at line 367 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00367 { 00368 swapToBuffer(&data, sizeof(data)); 00369 STREAM_ANALYSE(data, sizeof(data)); 00370 return *this; 00371 }
| StreamBuffer& StreamBuffer::operator>> | ( | int & | data | ) | [inline] |
Input Streamer.
Definition at line 373 of file StreamBuffer.h.
References swapFromBuffer().
00373 { 00374 swapFromBuffer(&data, sizeof(data)); 00375 return *this; 00376 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned int | data | ) | [inline] |
Output Streamer.
Definition at line 378 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00378 { 00379 swapToBuffer(&data, sizeof(data)); 00380 STREAM_ANALYSE(data, sizeof(data)); 00381 return *this; 00382 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned int & | data | ) | [inline] |
Input Streamer.
Definition at line 384 of file StreamBuffer.h.
References swapFromBuffer().
00384 { 00385 swapFromBuffer(&data, sizeof(data)); 00386 return *this; 00387 }
| StreamBuffer& StreamBuffer::operator<< | ( | long | data | ) | [inline] |
Output Streamer.
Definition at line 389 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00389 { 00390 swapToBuffer(&data, sizeof(data)); 00391 STREAM_ANALYSE(data, sizeof(data)); 00392 return *this; 00393 }
| StreamBuffer& StreamBuffer::operator>> | ( | long & | data | ) | [inline] |
Input Streamer.
Definition at line 395 of file StreamBuffer.h.
References swapFromBuffer().
00395 { 00396 swapFromBuffer(&data, sizeof(data)); 00397 return *this; 00398 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned long | data | ) | [inline] |
Output Streamer.
Definition at line 400 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00400 { 00401 swapToBuffer(&data, sizeof(data)); 00402 STREAM_ANALYSE(data, sizeof(data)); 00403 return *this; 00404 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned long & | data | ) | [inline] |
Input Streamer.
Definition at line 406 of file StreamBuffer.h.
References swapFromBuffer().
00406 { 00407 swapFromBuffer(&data, sizeof(data)); 00408 return *this; 00409 }
| StreamBuffer& StreamBuffer::operator<< | ( | short | data | ) | [inline] |
Output Streamer.
Definition at line 411 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00411 { 00412 swapToBuffer(&data, sizeof(data)); 00413 STREAM_ANALYSE(data, sizeof(data)); 00414 return *this; 00415 }
| StreamBuffer& StreamBuffer::operator>> | ( | short & | data | ) | [inline] |
Input Streamer.
Definition at line 417 of file StreamBuffer.h.
References swapFromBuffer().
00417 { 00418 swapFromBuffer(&data, sizeof(data)); 00419 return *this; 00420 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned short | data | ) | [inline] |
Output Streamer.
Definition at line 422 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00422 { 00423 swapToBuffer(&data, sizeof(data)); 00424 STREAM_ANALYSE(data, sizeof(data)); 00425 return *this; 00426 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned short & | data | ) | [inline] |
Input Streamer.
Definition at line 428 of file StreamBuffer.h.
References swapFromBuffer().
00428 { 00429 swapFromBuffer(&data, sizeof(data)); 00430 return *this; 00431 }
| StreamBuffer& StreamBuffer::operator<< | ( | char | data | ) | [inline] |
Output Streamer.
Definition at line 433 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00433 { 00434 swapToBuffer(&data, sizeof(data)); 00435 STREAM_ANALYSE(data, sizeof(data)); 00436 return *this; 00437 }
| StreamBuffer& StreamBuffer::operator>> | ( | char & | data | ) | [inline] |
Input Streamer.
Definition at line 439 of file StreamBuffer.h.
References swapFromBuffer().
00439 { 00440 swapFromBuffer(&data, sizeof(data)); 00441 return *this; 00442 }
| StreamBuffer& StreamBuffer::operator<< | ( | unsigned char | data | ) | [inline] |
Output Streamer.
Definition at line 444 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00444 { 00445 swapToBuffer(&data, sizeof(data)); 00446 STREAM_ANALYSE(data, sizeof(data)); 00447 return *this; 00448 }
| StreamBuffer& StreamBuffer::operator>> | ( | unsigned char & | data | ) | [inline] |
Input Streamer.
Definition at line 450 of file StreamBuffer.h.
References swapFromBuffer().
00450 { 00451 swapFromBuffer(&data, sizeof(data)); 00452 return *this; 00453 }
| StreamBuffer& StreamBuffer::operator<< | ( | float | data | ) | [inline] |
Output Streamer.
Definition at line 455 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00455 { 00456 swapToBuffer(&data, sizeof(data)); 00457 STREAM_ANALYSE(data, sizeof(data)); 00458 return *this; 00459 }
| StreamBuffer& StreamBuffer::operator>> | ( | float & | data | ) | [inline] |
Input Streamer.
Definition at line 461 of file StreamBuffer.h.
References swapFromBuffer().
00461 { 00462 swapFromBuffer(&data, sizeof(data)); 00463 return *this; 00464 }
| StreamBuffer& StreamBuffer::operator<< | ( | double | data | ) | [inline] |
Output Streamer.
Definition at line 466 of file StreamBuffer.h.
References STREAM_ANALYSE, and swapToBuffer().
00466 { 00467 swapToBuffer(&data, sizeof(data)); 00468 STREAM_ANALYSE(data, sizeof(data)); 00469 return *this; 00470 }
| StreamBuffer& StreamBuffer::operator>> | ( | double & | data | ) | [inline] |
Input Streamer.
Definition at line 472 of file StreamBuffer.h.
References swapFromBuffer().
00472 { 00473 swapFromBuffer(&data, sizeof(data)); 00474 return *this; 00475 }
| StreamBuffer& StreamBuffer::operator>> | ( | char * | data | ) | [inline] |
| StreamBuffer& StreamBuffer::operator<< | ( | const char * | data | ) | [inline] |
Streamer to write strings in (char*) format.
Definition at line 486 of file StreamBuffer.h.
References m_analyzer, STREAM_ANALYSE, and writeBytes().
00486 { 00487 const char* ptr = 0 == data ? "" : data; 00488 int len = strlen(ptr)+1; 00489 if ( 0 == m_analyzer ) 00490 writeBytes(ptr, len); 00491 else { 00492 STREAM_ANALYSE(data, len); 00493 } 00494 return *this; 00495 }
| StreamBuffer& StreamBuffer::operator>> | ( | std::string & | data | ) | [inline] |
Streamer to read strings in (std::string) format.
Definition at line 497 of file StreamBuffer.h.
References data(), m_buffer, and m_pointer.
00497 { 00498 long i, len; 00499 *this >> len; 00500 for ( i = 0, data = ""; i < len; i++ ) { 00501 data.append( 1, m_buffer[m_pointer++] ); 00502 } 00503 return *this; 00504 }
| StreamBuffer& StreamBuffer::operator<< | ( | const std::string & | data | ) | [inline] |
Streamer to write strings in (std::string) format.
Definition at line 506 of file StreamBuffer.h.
References data(), m_analyzer, STREAM_ANALYSE, and writeBytes().
00506 { 00507 if ( 0 == m_analyzer) { 00508 const char* ptr = data.c_str(); 00509 long len = data.length(); 00510 writeBytes(ptr, len); 00511 } 00512 else { 00513 STREAM_ANALYSE(data, sizeof(data)); 00514 } 00515 return *this; 00516 }
| StreamBuffer& StreamBuffer::operator>> | ( | TYPE *& | refpObject | ) | [inline] |
Streamer to read links to contained or identified objects.
The specified internal function call distinguishes between contained and identified objects.
| refpObject | Reference to pointer to object to be loaded. |
Definition at line 523 of file StreamBuffer.h.
References getObjectPointer().
00523 { 00524 return getObjectPointer(refpObject, refpObject); 00525 }
| StreamBuffer& StreamBuffer::operator<< | ( | const ContainedObject * | pObject | ) | [inline] |
Streamer to write links to contained objects.
Links to contained objects are not stored immediately, but collected instead and analyzed later.
| pObject | Pointer to object to be loaded. |
Definition at line 533 of file StreamBuffer.h.
References addContainedLink(), INVALID, and STREAM_ANALYSE.
00533 { 00534 STREAM_ANALYSE(pObject, sizeof(pObject)); 00535 addContainedLink(pObject, INVALID, INVALID); 00536 return *this; 00537 }
| StreamBuffer& StreamBuffer::operator<< | ( | const DataObject * | pObject | ) | [inline] |
Streamer to write links to identified objects.
Links to identified objects are not stored immediately, but collected instead and analyzed later.
| pObject | Pointer to object to be loaded. |
Definition at line 545 of file StreamBuffer.h.
References addIdentifiedLink(), INVALID, and STREAM_ANALYSE.
00545 { 00546 STREAM_ANALYSE(pObject, sizeof(pObject)); 00547 addIdentifiedLink(pObject, INVALID); 00548 return *this; 00549 }
| void StreamBuffer::serialize | ( | DataIO & | ioObject | ) | [inline] |
Serialize the buffer using an IO object.
The streambuffer object will make use of a DataIO object, which can be specialized for streaming to any representation like e.g. disk files, Root files, Objectivity etc.
| ioObject | Reference to data IO object. |
Definition at line 557 of file StreamBuffer.h.
References m_pointer, and StreamBuffer::DataIO::serialize().
00557 { 00558 ioObject.serialize ( *this ); 00559 m_pointer = 0; 00560 }
friend class DataObject [friend] |
Mode StreamBuffer::m_mode [protected] |
Boolean indicating wether the stream is in read or write mode.
Definition at line 155 of file StreamBuffer.h.
Referenced by isReading(), isWriting(), and setMode().
long StreamBuffer::m_pointer [protected] |
Current buffer pointer.
Definition at line 158 of file StreamBuffer.h.
Referenced by buffPointer(), erase(), extend(), operator>>(), serialize(), setBuffPointer(), setMode(), swapFromBuffer(), swapToBuffer(), and writeBytes().
long StreamBuffer::m_length [protected] |
char* StreamBuffer::m_buffer [protected] |
Pointer to heap buffer.
Definition at line 164 of file StreamBuffer.h.
Referenced by data(), operator>>(), reserve(), swapFromBuffer(), swapToBuffer(), and ~StreamBuffer().
bool StreamBuffer::m_swapEnabled [protected] |
Flag indicating swapping.
Definition at line 167 of file StreamBuffer.h.
Referenced by swapBuffer().
ContainedLinks StreamBuffer::m_containedLinks [protected] |
Container with links to contained objects.
Definition at line 170 of file StreamBuffer.h.
Referenced by addContainedLink(), containedLinks(), getContainedLink(), getObjectPointer(), and setMode().
IdentifiedLinks StreamBuffer::m_identifiedLinks [protected] |
Container with links to contained objects.
Definition at line 173 of file StreamBuffer.h.
Referenced by addIdentifiedLink(), getIdentifiedLink(), getObjectPointer(), identifiedLinks(), and setMode().
AnalyzeFunction StreamBuffer::m_analyzer [protected] |
Hook function for analysis of data to the stream.
Definition at line 176 of file StreamBuffer.h.
Referenced by operator<<(), setAnalyzer(), and StreamBuffer().