| # Gaudi Framework, version v21r7p1 |

Home |  | Generated: 15 Feb 2010

# StreamBuffer Class Reference

The stream buffer is a small object collecting object data. More...

`#include <GaudiKernel/StreamBuffer.h>`

List of all members.

## 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...

## Detailed Description

The stream buffer is a small object collecting object data.

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

Author:
  M.Frank

Definition at line 39 of file StreamBuffer.h.

## Member Typedef Documentation

typedef std::vector<ContainedLink> StreamBuffer::ContainedLinks

Definition at line 148 of file StreamBuffer.h.

typedef std::vector<IdentifiedLink> StreamBuffer::IdentifiedLinks

Definition of the identifiable link set.

Definition at line 150 of file StreamBuffer.h.

typedef void(* StreamBuffer::AnalyzeFunction)(const void *data, int siz, const std::type_info &type)

Definition of the buffer analyzer.

## Member Enumeration Documentation

enum StreamBuffer::Mode

Streamer mode.

Enumerator:

  UNINITIALIZED |
  READING |
  WRITING |

Definition at line 113 of file StreamBuffer.h.

    00113 {UNINITIALIZED, READING, WRITING};

enum StreamBuffer::SwapAction

Data Sawp actions.

Enumerator:

  SINGLE_BYTE |
  SWAP |
  NOSWAP |

Definition at line 115 of file StreamBuffer.h.

    00115 {SINGLE_BYTE, SWAP, NOSWAP};

enum StreamBuffer::State

Link state defintions.

Enumerator:

  INVALID |
  VALID |

Definition at line 117 of file StreamBuffer.h.

    00117 {INVALID=-1, VALID };

## Constructor & Destructor Documentation

StreamBuffer::StreamBuffer | ( | bool | do_swap = `true` | ) | `[inline]`

Standard constructor.

Definition at line 206 of file StreamBuffer.h.

    00206                                   :
    00207     m_mode(UNINITIALIZED),
    00208     m_pointer(0),
    00209     m_length(0),
    00210     m_buffer(0),
    00211     m_swapEnabled(do_swap)
    00212   {
    00213     m_analyzer = 0;
    00214   }

virtual StreamBuffer::~StreamBuffer | ( |  | ) | `[inline, virtual]`

Standard destructor.

Definition at line 216 of file StreamBuffer.h.

    00216                             {
    00217     ::free( m_buffer );
    00218   }

## Member Function Documentation

StreamBuffer::SwapAction StreamBuffer::swapBuffer | ( | int | siz | ) | const`[inline, protected]`

Check for byte swapping.

Definition at line 569 of file StreamBuffer.h.

    00569                                                                         {
    00570   switch(siz)   {
    00571   case 1:
    00572     return SINGLE_BYTE;
    00573   default:
    00574 #if defined(__alpha) && !defined(__VMS)
    00575 //    return m_swapEnabled ? SWAP : NOSWAP;
    00576     return NOSWAP;
    00577 #elif defined(__sun) && defined(__SVR4) && defined(__i386)
    00578 //    return m_swapEnabled ? SWAP : NOSWAP;
    00579     return NOSWAP;
    00580 #elif defined(__APPLE__)
    00581 //    return m_swapEnabled ? SWAP : NOSWAP;
    00582     return SWAP;
    00583 #elif defined(__linux) && !defined(__powerpc)
    00584 //    return m_swapEnabled ? SWAP : NOSWAP;
    00585     return NOSWAP;
    00586 #elif defined(BORLAND) || defined(_WIN32) || defined(WIN32)
    00587 //    return m_swapEnabled ? SWAP : NOSWAP;
    00588     return NOSWAP;
    00589 #else
    00590     return m_swapEnabled ? SWAP : NOSWAP;
    00591 //    return NOSWAP;
    00592 #endif
    00593   }
    00594 }

template<class TYPE>

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 187 of file StreamBuffer.h.

    00187                                                                                                      {
    00188     IdentifiedLink& link = m_identifiedLinks.back();
    00189     DataObject* pObj = link.first;
    00190     m_identifiedLinks.pop_back();
    00191     refpObject = dynamic_cast<TYPE*>(pObj);
    00192     return *this;
    00193   }

template<class TYPE>

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 197 of file StreamBuffer.h.

    00197                                                                                                           {
    00198     ContainedLink& link = m_containedLinks.back();
    00199     ContainedObject* pObj = link.first;
    00200     m_containedLinks.pop_back();
    00201     refpObject = dynamic_cast<TYPE*>(pObj);
    00202     return *this;
    00203   }

const char* StreamBuffer::data | ( |  | ) | const`[inline]`

Read access to data buffer.

Definition at line 220 of file StreamBuffer.h.

    00220                                 {
    00221     return m_buffer;
    00222   }

char* StreamBuffer::data | ( |  | ) | `[inline]`

write access to data buffer

Definition at line 224 of file StreamBuffer.h.

    00224                  {
    00225     return m_buffer;
    00226   }

void StreamBuffer::erase | ( |  | ) | `[inline]`

Reset the buffer.

Definition at line 228 of file StreamBuffer.h.

    00228                   {
    00229     m_pointer = 0;
    00230   }

void StreamBuffer::reserve | ( | long | len | ) | `[inline]`

Reserve buffer space; Default: 16 k buffer size.

Definition at line 232 of file StreamBuffer.h.

    00232                            {
    00233     if ( len > m_length )   {
    00234       m_length = (len < 16384) ? 16384 : len;
    00235       m_buffer = (char*)::realloc (m_buffer,m_length);
    00236     }
    00237   }

void StreamBuffer::extend | ( | long | len | ) | `[inline]`

Extend the buffer.

Definition at line 239 of file StreamBuffer.h.

    00239                            {
    00240     if ( len + m_pointer > m_length )    {
    00241       // We have to be a bit generous here in order not to run too often
    00242       // into ::realloc().
    00243         long new_len = (m_length < 16384) ? 16384 : 2*m_length;
    00244       if ( m_length < len ) new_len += len;
    00245       reserve(new_len);
    00246     }
    00247   }

long StreamBuffer::size | ( | void |  | ) | const`[inline]`

Total buffer size.

Definition at line 249 of file StreamBuffer.h.

    00249                         {
    00250     return m_length;
    00251   }

ContainedLinks& StreamBuffer::containedLinks | ( |  | ) | `[inline]`

Access to contained links.

Definition at line 253 of file StreamBuffer.h.

    00253                                      {
    00254     return m_containedLinks;
    00255   }

const ContainedLinks& StreamBuffer::containedLinks | ( |  | ) | const`[inline]`

CONST Access to contained links.

Definition at line 257 of file StreamBuffer.h.

    00257                                                  {
    00258     return m_containedLinks;
    00259   }

IdentifiedLinks& StreamBuffer::identifiedLinks | ( |  | ) | `[inline]`

Access to identified links.

Definition at line 262 of file StreamBuffer.h.

    00262                                        {
    00263     return m_identifiedLinks;
    00264   }

const IdentifiedLinks& StreamBuffer::identifiedLinks | ( |  | ) | const`[inline]`

CONST Access to identified links.

Definition at line 266 of file StreamBuffer.h.

    00266                                                    {
    00267     return m_identifiedLinks;
    00268   }

void StreamBuffer::setMode | ( | Mode | m | ) | `[inline]`

Set mode of the stream and allocate buffer.

Definition at line 271 of file StreamBuffer.h.

    00271                         {
    00272     m_mode = m;
    00273     m_pointer = 0;
    00274     m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end());
    00275     m_identifiedLinks.erase(m_identifiedLinks.begin(),m_identifiedLinks.end());
    00276   }

bool StreamBuffer::isReading | ( |  | ) | const`[inline]`

Get stream buffer state.

Definition at line 279 of file StreamBuffer.h.

    00279                                 {
    00280     return m_mode == READING;
    00281   }

bool StreamBuffer::isWriting | ( |  | ) | const`[inline]`

Get stream buffer state.

Definition at line 284 of file StreamBuffer.h.

    00284                                 {
    00285     return m_mode == WRITING;
    00286   }

long StreamBuffer::buffPointer | ( |  | ) | const`[inline]`

Retrieve current buffer pointer.

Definition at line 288 of file StreamBuffer.h.

    00288                                 {
    00289     return m_pointer;
    00290   }

void StreamBuffer::setBuffPointer | ( | long | ptr | ) | `[inline]`

Retrieve current buffer pointer.

Definition at line 292 of file StreamBuffer.h.

    00292                                   {
    00293     m_pointer = ptr;
    00294   }

void StreamBuffer::setAnalyzer | ( | AnalyzeFunction | fun = `0` | ) | `[inline]`

Enable user analysis function.

Definition at line 296 of file StreamBuffer.h.

    00296                                            {
    00297     m_analyzer = fun;
    00298   }

void StreamBuffer::swapToBuffer | ( | const void * | source,
|  | int | siz |
| ) |  |  | `[inline]`

Swap buffers: int, long, short, float and double.

Swap bytes from a source buffer to the stream buffer with arbitray size.

Definition at line 597 of file StreamBuffer.h.

    00597                                                                     {
    00598   char buff[8], *tar, *src = (char*)source;
    00599   extend (m_pointer+siz);
    00600   tar = (char*)m_buffer+m_pointer;
    00601   switch ( swapBuffer(siz) )   {
    00602   case SINGLE_BYTE:
    00603     *tar = *src;
    00604     break;
    00605   case SWAP:
    00606 #ifdef __APPLE__
    00607     for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i];
    00608 #else
    00609     ::_swab (src, buff, siz);
    00610 #endif
    00611     src = buff;
    00612   case NOSWAP:
    00613     memcpy(tar, src, siz);
    00614     break;
    00615   }
    00616   m_pointer += siz;
    00617 }

void StreamBuffer::swapFromBuffer | ( | void * | target,
|  | int | siz |
| ) |  |  | `[inline]`

Swap buffers: int, long, short, float and double.

Swap bytes from the stream buffer to target buffer with arbitray size.

Definition at line 620 of file StreamBuffer.h.

    00620                                                                 {
    00621   char* tar = (char*)target;
    00622   char* src = (char*)m_buffer+m_pointer;
    00623   switch ( swapBuffer(siz) )   {
    00624   case SINGLE_BYTE:
    00625     *tar = *src;
    00626     break;
    00627   case SWAP:
    00628 #ifdef __APPLE__
    00629     for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i];
    00630 #else
    00631     ::_swab (src, tar, siz);
    00632 #endif
    00633     break;
    00634   case NOSWAP:
    00635     ::memcpy(tar, src, siz);
    00636     break;
    00637   }
    00638   m_pointer += siz;
    00639 }

StreamBuffer& StreamBuffer::writeBytes | ( | const char * | str,
|  | long | len |
| ) |  |  | `[inline]`

Write string to output stream.

Definition at line 306 of file StreamBuffer.h.

    00306                                                            {
    00307     extend( m_pointer+len+4 );
    00308     *this << len;
    00309     memcpy(data()+buffPointer(), str, len);
    00310     m_pointer += len;
    00311     return *this;
    00312   }

void StreamBuffer::getIdentifiedLink | ( | DataObject *& | pObject,
|  | long & | hint |
| ) |  |  | `[inline]`

Definition at line 314 of file StreamBuffer.h.

    00314                                                               {
    00315     IdentifiedLink& l = m_identifiedLinks.back();
    00316     pObject = l.first;
    00317     hint    = l.second;
    00318     m_identifiedLinks.pop_back();
    00319   }

void StreamBuffer::addIdentifiedLink | ( | const DataObject * | pObject,
|  | long | hint |
| ) |  |  | `[inline]`

Definition at line 320 of file StreamBuffer.h.

    00320                                                                   {
    00321     m_identifiedLinks.push_back( IdentifiedLink((DataObject*)pObject, hint) );
    00322   }

void StreamBuffer::getContainedLink | ( | ContainedObject *& | pObject,
|  | long & | hint,
|  | long & | link |
| ) |  |  | `[inline]`

Definition at line 324 of file StreamBuffer.h.

    00324                                                                               {
    00325     ContainedLink& l = m_containedLinks.back();
    00326     pObject = l.first;
    00327     hint    = l.second;
    00328     link    = l.third;
    00329     m_containedLinks.pop_back();
    00330   }

void StreamBuffer::addContainedLink | ( | const ContainedObject * | pObject,
|  | long | hint,
|  | long | link |
| ) |  |  | `[inline]`

Definition at line 331 of file StreamBuffer.h.

    00331                                                                                  {
    00332     m_containedLinks.push_back( ContainedLink((ContainedObject*)pObject, hint, link) );
    00333   }

StreamBuffer& StreamBuffer::operator<< | ( | longlong | data | ) | `[inline]`

Output Streamer.

Definition at line 359 of file StreamBuffer.h.

    00359                                                 {
    00360     swapToBuffer(&data, sizeof(data));
    00361     STREAM_ANALYSE(data, sizeof(data));
    00362     return *this;
    00363   }

StreamBuffer& StreamBuffer::operator>> | ( | longlong & | data | ) | `[inline]`

Input Streamer.

Definition at line 365 of file StreamBuffer.h.

    00365                                                 {
    00366     swapFromBuffer(&data, sizeof(data));
    00367     return *this;
    00368   }

StreamBuffer& StreamBuffer::operator<< | ( | int | data | ) | `[inline]`

Output Streamer.

Definition at line 370 of file StreamBuffer.h.

    00370                                            {
    00371     swapToBuffer(&data, sizeof(data));
    00372     STREAM_ANALYSE(data, sizeof(data));
    00373     return *this;
    00374   }

StreamBuffer& StreamBuffer::operator>> | ( | int & | data | ) | `[inline]`

Input Streamer.

Definition at line 376 of file StreamBuffer.h.

    00376                                            {
    00377     swapFromBuffer(&data, sizeof(data));
    00378     return *this;
    00379   }

StreamBuffer& StreamBuffer::operator<< | ( | unsigned int | data | ) | `[inline]`

Output Streamer.

Definition at line 381 of file StreamBuffer.h.

    00381                                                     {
    00382     swapToBuffer(&data, sizeof(data));
    00383     STREAM_ANALYSE(data, sizeof(data));
    00384     return *this;
    00385   }

StreamBuffer& StreamBuffer::operator>> | ( | unsigned int & | data | ) | `[inline]`

Input Streamer.

Definition at line 387 of file StreamBuffer.h.

    00387                                                     {
    00388     swapFromBuffer(&data, sizeof(data));
    00389     return *this;
    00390   }

StreamBuffer& StreamBuffer::operator<< | ( | long | data | ) | `[inline]`

Output Streamer.

Definition at line 392 of file StreamBuffer.h.

    00392                                             {
    00393     swapToBuffer(&data, sizeof(data));
    00394     STREAM_ANALYSE(data, sizeof(data));
    00395     return *this;
    00396   }

StreamBuffer& StreamBuffer::operator>> | ( | long & | data | ) | `[inline]`

Input Streamer.

Definition at line 398 of file StreamBuffer.h.

    00398                                             {
    00399     swapFromBuffer(&data, sizeof(data));
    00400     return *this;
    00401   }

StreamBuffer& StreamBuffer::operator<< | ( | unsigned long | data | ) | `[inline]`

Output Streamer.

Definition at line 403 of file StreamBuffer.h.

    00403                                                      {
    00404     swapToBuffer(&data, sizeof(data));
    00405     STREAM_ANALYSE(data, sizeof(data));
    00406     return *this;
    00407   }

StreamBuffer& StreamBuffer::operator>> | ( | unsigned long & | data | ) | `[inline]`

Input Streamer.

Definition at line 409 of file StreamBuffer.h.

    00409                                                      {
    00410     swapFromBuffer(&data, sizeof(data));
    00411     return *this;
    00412   }

StreamBuffer& StreamBuffer::operator<< | ( | short | data | ) | `[inline]`

Output Streamer.

Definition at line 414 of file StreamBuffer.h.

    00414                                              {
    00415     swapToBuffer(&data, sizeof(data));
    00416     STREAM_ANALYSE(data, sizeof(data));
    00417     return *this;
    00418   }

StreamBuffer& StreamBuffer::operator>> | ( | short & | data | ) | `[inline]`

Input Streamer.

Definition at line 420 of file StreamBuffer.h.

    00420                                              {
    00421     swapFromBuffer(&data, sizeof(data));
    00422     return *this;
    00423   }

StreamBuffer& StreamBuffer::operator<< | ( | unsigned short | data | ) | `[inline]`

Output Streamer.

Definition at line 425 of file StreamBuffer.h.

    00425                                                       {
    00426     swapToBuffer(&data, sizeof(data));
    00427     STREAM_ANALYSE(data, sizeof(data));
    00428     return *this;
    00429   }

StreamBuffer& StreamBuffer::operator>> | ( | unsigned short & | data | ) | `[inline]`

Input Streamer.

Definition at line 431 of file StreamBuffer.h.

    00431                                                       {
    00432     swapFromBuffer(&data, sizeof(data));
    00433     return *this;
    00434   }

StreamBuffer& StreamBuffer::operator<< | ( | char | data | ) | `[inline]`

Output Streamer.

Definition at line 436 of file StreamBuffer.h.

    00436                                             {
    00437     swapToBuffer(&data, sizeof(data));
    00438     STREAM_ANALYSE(data, sizeof(data));
    00439     return *this;
    00440   }

StreamBuffer& StreamBuffer::operator>> | ( | char & | data | ) | `[inline]`

Input Streamer.

Definition at line 442 of file StreamBuffer.h.

    00442                                             {
    00443     swapFromBuffer(&data, sizeof(data));
    00444     return *this;
    00445   }

StreamBuffer& StreamBuffer::operator<< | ( | unsigned char | data | ) | `[inline]`

Output Streamer.

Definition at line 447 of file StreamBuffer.h.

    00447                                                      {
    00448     swapToBuffer(&data, sizeof(data));
    00449     STREAM_ANALYSE(data, sizeof(data));
    00450     return *this;
    00451   }

StreamBuffer& StreamBuffer::operator>> | ( | unsigned char & | data | ) | `[inline]`

Input Streamer.

Definition at line 453 of file StreamBuffer.h.

    00453                                                      {
    00454     swapFromBuffer(&data, sizeof(data));
    00455     return *this;
    00456   }

StreamBuffer& StreamBuffer::operator<< | ( | float | data | ) | `[inline]`

Output Streamer.

Definition at line 458 of file StreamBuffer.h.

    00458                                              {
    00459     swapToBuffer(&data, sizeof(data));
    00460     STREAM_ANALYSE(data, sizeof(data));
    00461     return *this;
    00462   }

StreamBuffer& StreamBuffer::operator>> | ( | float & | data | ) | `[inline]`

Input Streamer.

Definition at line 464 of file StreamBuffer.h.

    00464                                              {
    00465     swapFromBuffer(&data, sizeof(data));
    00466     return *this;
    00467   }

StreamBuffer& StreamBuffer::operator<< | ( | double | data | ) | `[inline]`

Output Streamer.

Definition at line 469 of file StreamBuffer.h.

    00469                                               {
    00470     swapToBuffer(&data, sizeof(data));
    00471     STREAM_ANALYSE(data, sizeof(data));
    00472     return *this;
    00473   }

StreamBuffer& StreamBuffer::operator>> | ( | double & | data | ) | `[inline]`

Input Streamer.

Definition at line 475 of file StreamBuffer.h.

    00475                                               {
    00476     swapFromBuffer(&data, sizeof(data));
    00477     return *this;
    00478   }

StreamBuffer& StreamBuffer::operator>> | ( | char * | data | ) | `[inline]`

Streamer to read strings in (char*) format.

Definition at line 480 of file StreamBuffer.h.

    00480                                           {
    00481     long i, len;
    00482     *this >> len;
    00483     for ( i = 0, data[0]=0; i < len; i++ )    {
    00484       data[i] = m_buffer[m_pointer++];
    00485     }
    00486     return *this;
    00487   }

StreamBuffer& StreamBuffer::operator<< | ( | const char * | data | ) | `[inline]`

Streamer to write strings in (char*) format.

Definition at line 489 of file StreamBuffer.h.

    00489                                                  {
    00490     const char* ptr = 0 == data ? "" : data;
    00491     int len = strlen(ptr)+1;
    00492     if ( 0 == m_analyzer )
    00493       writeBytes(ptr, len);
    00494     else  {
    00495       STREAM_ANALYSE(data, len);
    00496     }
    00497     return *this;
    00498   }

StreamBuffer& StreamBuffer::operator>> | ( | std::string & | data | ) | `[inline]`

Streamer to read strings in (std::string) format.

Definition at line 500 of file StreamBuffer.h.

    00500                                               {
    00501     long i, len;
    00502     *this >> len;
    00503     for ( i = 0, data = ""; i < len; i++ )    {
    00504       data.append( 1, m_buffer[m_pointer++] );
    00505     }
    00506     return *this;
    00507   }

StreamBuffer& StreamBuffer::operator<< | ( | const std::string & | data | ) | `[inline]`

Streamer to write strings in (std::string) format.

Definition at line 509 of file StreamBuffer.h.

    00509                                                     {
    00510     if ( 0 == m_analyzer)   {
    00511       const char* ptr = data.c_str();
    00512       long len = data.length();
    00513       writeBytes(ptr, len);
    00514     }
    00515     else    {
    00516       STREAM_ANALYSE(data, sizeof(data));
    00517     }
    00518     return *this;
    00519   }

template<class TYPE>

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.

Parameters:

  | refpObject | Reference to pointer to object to be loaded.

Returns:
  Reference to StreamBuffer object

Definition at line 526 of file StreamBuffer.h.

    00526                                                                           {
    00527     return getObjectPointer(refpObject, refpObject);
    00528   }

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.

Parameters:

  | pObject | Pointer to object to be loaded.

Returns:
  Reference to StreamBuffer object

Definition at line 536 of file StreamBuffer.h.

    00536                                                              {
    00537     STREAM_ANALYSE(pObject, sizeof(pObject));
    00538     addContainedLink(pObject, INVALID, INVALID);
    00539     return *this;
    00540   }

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.

Parameters:

  | pObject | Pointer to object to be loaded.

Returns:
  Reference to StreamBuffer object

Definition at line 548 of file StreamBuffer.h.

    00548                                                         {
    00549     STREAM_ANALYSE(pObject, sizeof(pObject));
    00550     addIdentifiedLink(pObject, INVALID);
    00551     return *this;
    00552   }

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.

Parameters:

  | ioObject | Reference to data IO object.

Definition at line 560 of file StreamBuffer.h.

    00560                                      {
    00561     ioObject.serialize ( *this );
    00562     m_pointer = 0;
    00563   }

## Friends And Related Function Documentation

friend class DataObject`[friend]`

DataObject is friend.

Definition at line 154 of file StreamBuffer.h.

## Member Data Documentation

Mode StreamBuffer::m_mode`[protected]`

Boolean indicating wether the stream is in read or write mode.

Definition at line 158 of file StreamBuffer.h.

long StreamBuffer::m_pointer`[protected]`

Current buffer pointer.

Definition at line 161 of file StreamBuffer.h.

long StreamBuffer::m_length`[protected]`

Total buffer length.

Definition at line 164 of file StreamBuffer.h.

char* StreamBuffer::m_buffer`[protected]`

Pointer to heap buffer.

Definition at line 167 of file StreamBuffer.h.

bool StreamBuffer::m_swapEnabled`[protected]`

Flag indicating swapping.

Definition at line 170 of file StreamBuffer.h.

ContainedLinks StreamBuffer::m_containedLinks`[protected]`

Container with links to contained objects.

Definition at line 173 of file StreamBuffer.h.

IdentifiedLinks StreamBuffer::m_identifiedLinks`[protected]`

Container with links to contained objects.

Definition at line 176 of file StreamBuffer.h.

AnalyzeFunction StreamBuffer::m_analyzer`[protected]`

Hook function for analysis of data to the stream.

Definition at line 179 of file StreamBuffer.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r7p1/GaudiKernel/GaudiKernel/StreamBuffer.h