StreamBuffer Class Reference

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

#include <GaudiKernel/StreamBuffer.h>

Collaboration diagram for StreamBuffer:

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

Public Types

enum  Mode {
  UNINITIALIZED, READING, WRITING, UNINITIALIZED,
  READING, WRITING
}
 Streamer mode. More...
 
enum  SwapAction {
  SINGLE_BYTE, SWAP, NOSWAP, SINGLE_BYTE,
  SWAP, NOSWAP
}
 Data Sawp actions. More...
 
enum  State { INVALID =-1, VALID, INVALID =-1, VALID }
 Link state defintions. More...
 
enum  Mode {
  UNINITIALIZED, READING, WRITING, UNINITIALIZED,
  READING, WRITING
}
 Streamer mode. More...
 
enum  SwapAction {
  SINGLE_BYTE, SWAP, NOSWAP, SINGLE_BYTE,
  SWAP, NOSWAP
}
 Data Sawp actions. More...
 
enum  State { INVALID =-1, VALID, INVALID =-1, VALID }
 Link state defintions. More...
 
typedef std::vector< ContainedLinkContainedLinks
 
typedef std::vector< IdentifiedLinkIdentifiedLinks
 Definition of the identifiable link set. More...
 
typedef void(* AnalyzeFunction) (const void *data, int siz, const std::type_info &type)
 Definition of the buffer analyzer. More...
 
typedef std::vector< ContainedLinkContainedLinks
 
typedef std::vector< IdentifiedLinkIdentifiedLinks
 Definition of the identifiable link set. More...
 
typedef void(* AnalyzeFunction) (const void *data, int siz, const std::type_info &type)
 Definition of the buffer analyzer. More...
 

Public Member Functions

 StreamBuffer (bool do_swap=true)
 Standard constructor. More...
 
virtual ~StreamBuffer ()
 Standard destructor. More...
 
const char * data () const
 Read access to data buffer. More...
 
char * data ()
 write access to data buffer More...
 
void erase ()
 Reset the buffer. More...
 
void reserve (long len)
 Reserve buffer space; Default: 16 k buffer size. More...
 
void extend (long len)
 Extend the buffer. More...
 
long size () const
 Total buffer size. More...
 
ContainedLinkscontainedLinks ()
 Access to contained links. More...
 
const ContainedLinkscontainedLinks () const
 CONST Access to contained links. More...
 
IdentifiedLinksidentifiedLinks ()
 Access to identified links. More...
 
const IdentifiedLinksidentifiedLinks () const
 CONST Access to identified links. More...
 
void setMode (Mode m)
 Set mode of the stream and allocate buffer. More...
 
bool isReading () const
 Get stream buffer state. More...
 
bool isWriting () const
 Get stream buffer state. More...
 
long buffPointer () const
 Retrieve current buffer pointer. More...
 
void setBuffPointer (long ptr)
 Retrieve current buffer pointer. More...
 
void setAnalyzer (AnalyzeFunction fun=nullptr)
 Enable user analysis function. More...
 
void swapToBuffer (const void *source, int siz)
 Swap buffers: int, long, short, float and double. More...
 
void swapFromBuffer (void *target, int siz)
 Swap buffers: int, long, short, float and double. More...
 
StreamBufferwriteBytes (const char *str, long len)
 Write string to output stream. More...
 
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)
 
StreamBufferoperator<< (longlong data)
 Output Streamer. More...
 
StreamBufferoperator>> (longlong &data)
 Input Streamer. More...
 
StreamBufferoperator<< (int data)
 Output Streamer. More...
 
StreamBufferoperator>> (int &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned int data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned int &data)
 Input Streamer. More...
 
StreamBufferoperator<< (long data)
 Output Streamer. More...
 
StreamBufferoperator>> (long &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned long data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned long &data)
 Input Streamer. More...
 
StreamBufferoperator<< (short data)
 Output Streamer. More...
 
StreamBufferoperator>> (short &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned short data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned short &data)
 Input Streamer. More...
 
StreamBufferoperator<< (char data)
 Output Streamer. More...
 
StreamBufferoperator>> (char &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned char data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned char &data)
 Input Streamer. More...
 
StreamBufferoperator<< (float data)
 Output Streamer. More...
 
StreamBufferoperator>> (float &data)
 Input Streamer. More...
 
StreamBufferoperator<< (double data)
 Output Streamer. More...
 
StreamBufferoperator>> (double &data)
 Input Streamer. More...
 
StreamBufferoperator>> (char *data)
 Streamer to read strings in (char*) format. More...
 
StreamBufferoperator<< (const char *data)
 Streamer to write strings in (char*) format. More...
 
StreamBufferoperator>> (std::string &data)
 Streamer to read strings in (std::string) format. More...
 
StreamBufferoperator<< (const std::string &data)
 Streamer to write strings in (std::string) format. More...
 
template<class TYPE >
StreamBufferoperator>> (TYPE *&refpObject)
 Streamer to read links to contained or identified objects. More...
 
StreamBufferoperator<< (const ContainedObject *pObject)
 Streamer to write links to contained objects. More...
 
StreamBufferoperator<< (const DataObject *pObject)
 Streamer to write links to identified objects. More...
 
void serialize (DataIO &ioObject)
 Serialize the buffer using an IO object. More...
 
 StreamBuffer (bool do_swap=true)
 Standard constructor. More...
 
virtual ~StreamBuffer ()
 Standard destructor. More...
 
const char * data () const
 Read access to data buffer. More...
 
char * data ()
 write access to data buffer More...
 
void erase ()
 Reset the buffer. More...
 
void reserve (long len)
 Reserve buffer space; Default: 16 k buffer size. More...
 
void extend (long len)
 Extend the buffer. More...
 
long size () const
 Total buffer size. More...
 
ContainedLinkscontainedLinks ()
 Access to contained links. More...
 
const ContainedLinkscontainedLinks () const
 CONST Access to contained links. More...
 
IdentifiedLinksidentifiedLinks ()
 Access to identified links. More...
 
const IdentifiedLinksidentifiedLinks () const
 CONST Access to identified links. More...
 
void setMode (Mode m)
 Set mode of the stream and allocate buffer. More...
 
bool isReading () const
 Get stream buffer state. More...
 
bool isWriting () const
 Get stream buffer state. More...
 
long buffPointer () const
 Retrieve current buffer pointer. More...
 
void setBuffPointer (long ptr)
 Retrieve current buffer pointer. More...
 
void setAnalyzer (AnalyzeFunction fun=nullptr)
 Enable user analysis function. More...
 
void swapToBuffer (const void *source, int siz)
 Swap buffers: int, long, short, float and double. More...
 
void swapFromBuffer (void *target, int siz)
 Swap buffers: int, long, short, float and double. More...
 
StreamBufferwriteBytes (const char *str, long len)
 Write string to output stream. More...
 
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)
 
StreamBufferoperator<< (longlong data)
 Output Streamer. More...
 
StreamBufferoperator>> (longlong &data)
 Input Streamer. More...
 
StreamBufferoperator<< (int data)
 Output Streamer. More...
 
StreamBufferoperator>> (int &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned int data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned int &data)
 Input Streamer. More...
 
StreamBufferoperator<< (long data)
 Output Streamer. More...
 
StreamBufferoperator>> (long &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned long data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned long &data)
 Input Streamer. More...
 
StreamBufferoperator<< (short data)
 Output Streamer. More...
 
StreamBufferoperator>> (short &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned short data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned short &data)
 Input Streamer. More...
 
StreamBufferoperator<< (char data)
 Output Streamer. More...
 
StreamBufferoperator>> (char &data)
 Input Streamer. More...
 
StreamBufferoperator<< (unsigned char data)
 Output Streamer. More...
 
StreamBufferoperator>> (unsigned char &data)
 Input Streamer. More...
 
StreamBufferoperator<< (float data)
 Output Streamer. More...
 
StreamBufferoperator>> (float &data)
 Input Streamer. More...
 
StreamBufferoperator<< (double data)
 Output Streamer. More...
 
StreamBufferoperator>> (double &data)
 Input Streamer. More...
 
StreamBufferoperator>> (char *data)
 Streamer to read strings in (char*) format. More...
 
StreamBufferoperator<< (const char *data)
 Streamer to write strings in (char*) format. More...
 
StreamBufferoperator>> (std::string &data)
 Streamer to read strings in (std::string) format. More...
 
StreamBufferoperator<< (const std::string &data)
 Streamer to write strings in (std::string) format. More...
 
template<class TYPE >
StreamBufferoperator>> (TYPE *&refpObject)
 Streamer to read links to contained or identified objects. More...
 
StreamBufferoperator<< (const ContainedObject *pObject)
 Streamer to write links to contained objects. More...
 
StreamBufferoperator<< (const DataObject *pObject)
 Streamer to write links to identified objects. More...
 
void serialize (DataIO &ioObject)
 Serialize the buffer using an IO object. More...
 

Protected Member Functions

SwapAction swapBuffer (int siz) const
 Check for byte swapping. More...
 
template<class TYPE >
StreamBuffergetObjectPointer (const DataObject *, TYPE *&refpObject)
 Helper to distinguish between identified pointers and contained pointers. More...
 
template<class TYPE >
StreamBuffergetObjectPointer (const ContainedObject *, TYPE *&refpObject)
 Helper to distinguish between identified pointers and contained pointers. More...
 
SwapAction swapBuffer (int siz) const
 Check for byte swapping. More...
 
template<class TYPE >
StreamBuffergetObjectPointer (const DataObject *, TYPE *&refpObject)
 Helper to distinguish between identified pointers and contained pointers. More...
 
template<class TYPE >
StreamBuffergetObjectPointer (const ContainedObject *, TYPE *&refpObject)
 Helper to distinguish between identified pointers and contained pointers. More...
 

Protected Attributes

Mode m_mode = UNINITIALIZED
 Boolean indicating wether the stream is in read or write mode. More...
 
long m_pointer = 0
 Current buffer pointer. More...
 
long m_length = 0
 Total buffer length. More...
 
char * m_buffer = nullptr
 Pointer to heap buffer. More...
 
bool m_swapEnabled = true
 Flag indicating swapping. More...
 
ContainedLinks m_containedLinks
 Container with links to contained objects. More...
 
IdentifiedLinks m_identifiedLinks
 Container with links to contained objects. More...
 
AnalyzeFunction m_analyzer = nullptr
 Hook function for analysis of data to the stream. More...
 

Friends

class DataObject
 DataObject is friend. 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 40 of file StreamBuffer.h.

Member Typedef Documentation

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

Definition of the buffer analyzer.

Definition at line 148 of file StreamBuffer.h.

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

Definition of the buffer analyzer.

Definition at line 148 of file StreamBuffer.h.

Definition at line 144 of file StreamBuffer.h.

Definition at line 144 of file StreamBuffer.h.

Definition of the identifiable link set.

Definition at line 146 of file StreamBuffer.h.

Definition of the identifiable link set.

Definition at line 146 of file StreamBuffer.h.

Member Enumeration Documentation

Streamer mode.

Enumerator
UNINITIALIZED 
READING 
WRITING 
UNINITIALIZED 
READING 
WRITING 

Definition at line 112 of file StreamBuffer.h.

Streamer mode.

Enumerator
UNINITIALIZED 
READING 
WRITING 
UNINITIALIZED 
READING 
WRITING 

Definition at line 112 of file StreamBuffer.h.

Link state defintions.

Enumerator
INVALID 
VALID 
INVALID 
VALID 

Definition at line 116 of file StreamBuffer.h.

Link state defintions.

Enumerator
INVALID 
VALID 
INVALID 
VALID 

Definition at line 116 of file StreamBuffer.h.

Data Sawp actions.

Enumerator
SINGLE_BYTE 
SWAP 
NOSWAP 
SINGLE_BYTE 
SWAP 
NOSWAP 

Definition at line 114 of file StreamBuffer.h.

Data Sawp actions.

Enumerator
SINGLE_BYTE 
SWAP 
NOSWAP 
SINGLE_BYTE 
SWAP 
NOSWAP 

Definition at line 114 of file StreamBuffer.h.

Constructor & Destructor Documentation

StreamBuffer::StreamBuffer ( bool  do_swap = true)
inline

Standard constructor.

Definition at line 202 of file StreamBuffer.h.

202  :
203  m_swapEnabled(do_swap) {
204  }
bool m_swapEnabled
Flag indicating swapping.
Definition: StreamBuffer.h:166
virtual StreamBuffer::~StreamBuffer ( )
inlinevirtual

Standard destructor.

Definition at line 206 of file StreamBuffer.h.

206  {
207  ::free( m_buffer );
208  }
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
StreamBuffer::StreamBuffer ( bool  do_swap = true)
inline

Standard constructor.

Definition at line 202 of file StreamBuffer.h.

202  :
203  m_swapEnabled(do_swap) {
204  }
bool m_swapEnabled
Flag indicating swapping.
Definition: StreamBuffer.h:166
virtual StreamBuffer::~StreamBuffer ( )
inlinevirtual

Standard destructor.

Definition at line 206 of file StreamBuffer.h.

206  {
207  ::free( m_buffer );
208  }
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163

Member Function Documentation

void StreamBuffer::addContainedLink ( const ContainedObject pObject,
long  hint,
long  link 
)
inline

Definition at line 321 of file StreamBuffer.h.

321  {
322  m_containedLinks.push_back( ContainedLink((ContainedObject*)pObject, hint, link) );
323  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
void StreamBuffer::addContainedLink ( const ContainedObject pObject,
long  hint,
long  link 
)
inline

Definition at line 321 of file StreamBuffer.h.

321  {
322  m_containedLinks.push_back( ContainedLink((ContainedObject*)pObject, hint, link) );
323  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
void StreamBuffer::addIdentifiedLink ( const DataObject pObject,
long  hint 
)
inline

Definition at line 310 of file StreamBuffer.h.

310  {
311  m_identifiedLinks.push_back( IdentifiedLink((DataObject*)pObject, hint) );
312  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
void StreamBuffer::addIdentifiedLink ( const DataObject pObject,
long  hint 
)
inline

Definition at line 310 of file StreamBuffer.h.

310  {
311  m_identifiedLinks.push_back( IdentifiedLink((DataObject*)pObject, hint) );
312  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
long StreamBuffer::buffPointer ( ) const
inline

Retrieve current buffer pointer.

Definition at line 278 of file StreamBuffer.h.

278  {
279  return m_pointer;
280  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
long StreamBuffer::buffPointer ( ) const
inline

Retrieve current buffer pointer.

Definition at line 278 of file StreamBuffer.h.

278  {
279  return m_pointer;
280  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
ContainedLinks& StreamBuffer::containedLinks ( )
inline

Access to contained links.

Definition at line 243 of file StreamBuffer.h.

243  {
244  return m_containedLinks;
245  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
ContainedLinks& StreamBuffer::containedLinks ( )
inline

Access to contained links.

Definition at line 243 of file StreamBuffer.h.

243  {
244  return m_containedLinks;
245  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
const ContainedLinks& StreamBuffer::containedLinks ( ) const
inline

CONST Access to contained links.

Definition at line 247 of file StreamBuffer.h.

247  {
248  return m_containedLinks;
249  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
const ContainedLinks& StreamBuffer::containedLinks ( ) const
inline

CONST Access to contained links.

Definition at line 247 of file StreamBuffer.h.

247  {
248  return m_containedLinks;
249  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
const char* StreamBuffer::data ( ) const
inline

Read access to data buffer.

Definition at line 210 of file StreamBuffer.h.

210  {
211  return m_buffer;
212  }
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
const char* StreamBuffer::data ( ) const
inline

Read access to data buffer.

Definition at line 210 of file StreamBuffer.h.

210  {
211  return m_buffer;
212  }
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
char* StreamBuffer::data ( )
inline

write access to data buffer

Definition at line 214 of file StreamBuffer.h.

214  {
215  return m_buffer;
216  }
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
char* StreamBuffer::data ( )
inline

write access to data buffer

Definition at line 214 of file StreamBuffer.h.

214  {
215  return m_buffer;
216  }
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
void StreamBuffer::erase ( )
inline

Reset the buffer.

Definition at line 218 of file StreamBuffer.h.

218  {
219  m_pointer = 0;
220  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
void StreamBuffer::erase ( )
inline

Reset the buffer.

Definition at line 218 of file StreamBuffer.h.

218  {
219  m_pointer = 0;
220  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
void StreamBuffer::extend ( long  len)
inline

Extend the buffer.

Definition at line 229 of file StreamBuffer.h.

229  {
230  if ( len + m_pointer > m_length ) {
231  // We have to be a bit generous here in order not to run too often
232  // into ::realloc().
233  long new_len = (m_length < 16384) ? 16384 : 2*m_length;
234  if ( m_length < len ) new_len += len;
235  reserve(new_len);
236  }
237  }
long m_length
Total buffer length.
Definition: StreamBuffer.h:160
void reserve(long len)
Reserve buffer space; Default: 16 k buffer size.
Definition: StreamBuffer.h:222
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
void StreamBuffer::extend ( long  len)
inline

Extend the buffer.

Definition at line 229 of file StreamBuffer.h.

229  {
230  if ( len + m_pointer > m_length ) {
231  // We have to be a bit generous here in order not to run too often
232  // into ::realloc().
233  long new_len = (m_length < 16384) ? 16384 : 2*m_length;
234  if ( m_length < len ) new_len += len;
235  reserve(new_len);
236  }
237  }
long m_length
Total buffer length.
Definition: StreamBuffer.h:160
void reserve(long len)
Reserve buffer space; Default: 16 k buffer size.
Definition: StreamBuffer.h:222
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
void StreamBuffer::getContainedLink ( ContainedObject *&  pObject,
long &  hint,
long &  link 
)
inline

Definition at line 314 of file StreamBuffer.h.

314  {
315  ContainedLink& l = m_containedLinks.back();
316  pObject = l.first;
317  hint = l.second;
318  link = l.third;
319  m_containedLinks.pop_back();
320  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
dictionary l
Definition: gaudirun.py:422
void StreamBuffer::getContainedLink ( ContainedObject *&  pObject,
long &  hint,
long &  link 
)
inline

Definition at line 314 of file StreamBuffer.h.

314  {
315  ContainedLink& l = m_containedLinks.back();
316  pObject = l.first;
317  hint = l.second;
318  link = l.third;
319  m_containedLinks.pop_back();
320  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
dictionary l
Definition: gaudirun.py:422
void StreamBuffer::getIdentifiedLink ( DataObject *&  pObject,
long &  hint 
)
inline

Definition at line 304 of file StreamBuffer.h.

304  {
305  IdentifiedLink& l = m_identifiedLinks.back();
306  pObject = l.first;
307  hint = l.second;
308  m_identifiedLinks.pop_back();
309  }
dictionary l
Definition: gaudirun.py:422
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
void StreamBuffer::getIdentifiedLink ( DataObject *&  pObject,
long &  hint 
)
inline

Definition at line 304 of file StreamBuffer.h.

304  {
305  IdentifiedLink& l = m_identifiedLinks.back();
306  pObject = l.first;
307  hint = l.second;
308  m_identifiedLinks.pop_back();
309  }
dictionary l
Definition: gaudirun.py:422
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
template<class TYPE >
StreamBuffer& StreamBuffer::getObjectPointer ( const DataObject ,
TYPE *&  refpObject 
)
inlineprotected

Helper to distinguish between identified pointers and contained pointers.

This entry resolves identified pointers (= Pointers to DataObject instances.)

Definition at line 183 of file StreamBuffer.h.

183  {
184  IdentifiedLink& link = m_identifiedLinks.back();
185  DataObject* pObj = link.first;
186  m_identifiedLinks.pop_back();
187  refpObject = dynamic_cast<TYPE*>(pObj);
188  return *this;
189  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
template<class TYPE >
StreamBuffer& StreamBuffer::getObjectPointer ( const DataObject ,
TYPE *&  refpObject 
)
inlineprotected

Helper to distinguish between identified pointers and contained pointers.

This entry resolves identified pointers (= Pointers to DataObject instances.)

Definition at line 183 of file StreamBuffer.h.

183  {
184  IdentifiedLink& link = m_identifiedLinks.back();
185  DataObject* pObj = link.first;
186  m_identifiedLinks.pop_back();
187  refpObject = dynamic_cast<TYPE*>(pObj);
188  return *this;
189  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
template<class TYPE >
StreamBuffer& StreamBuffer::getObjectPointer ( const ContainedObject ,
TYPE *&  refpObject 
)
inlineprotected

Helper to distinguish between identified pointers and contained pointers.

This entry resolves contained pointers (= Pointers to ContainedObject instances.)

Definition at line 193 of file StreamBuffer.h.

193  {
194  ContainedLink& link = m_containedLinks.back();
195  ContainedObject* pObj = link.first;
196  m_containedLinks.pop_back();
197  refpObject = dynamic_cast<TYPE*>(pObj);
198  return *this;
199  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
template<class TYPE >
StreamBuffer& StreamBuffer::getObjectPointer ( const ContainedObject ,
TYPE *&  refpObject 
)
inlineprotected

Helper to distinguish between identified pointers and contained pointers.

This entry resolves contained pointers (= Pointers to ContainedObject instances.)

Definition at line 193 of file StreamBuffer.h.

193  {
194  ContainedLink& link = m_containedLinks.back();
195  ContainedObject* pObj = link.first;
196  m_containedLinks.pop_back();
197  refpObject = dynamic_cast<TYPE*>(pObj);
198  return *this;
199  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
IdentifiedLinks& StreamBuffer::identifiedLinks ( )
inline

Access to identified links.

Definition at line 252 of file StreamBuffer.h.

252  {
253  return m_identifiedLinks;
254  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
IdentifiedLinks& StreamBuffer::identifiedLinks ( )
inline

Access to identified links.

Definition at line 252 of file StreamBuffer.h.

252  {
253  return m_identifiedLinks;
254  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
const IdentifiedLinks& StreamBuffer::identifiedLinks ( ) const
inline

CONST Access to identified links.

Definition at line 256 of file StreamBuffer.h.

256  {
257  return m_identifiedLinks;
258  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
const IdentifiedLinks& StreamBuffer::identifiedLinks ( ) const
inline

CONST Access to identified links.

Definition at line 256 of file StreamBuffer.h.

256  {
257  return m_identifiedLinks;
258  }
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
bool StreamBuffer::isReading ( ) const
inline

Get stream buffer state.

Definition at line 269 of file StreamBuffer.h.

269  {
270  return m_mode == READING;
271  }
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:154
bool StreamBuffer::isReading ( ) const
inline

Get stream buffer state.

Definition at line 269 of file StreamBuffer.h.

269  {
270  return m_mode == READING;
271  }
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:154
bool StreamBuffer::isWriting ( ) const
inline

Get stream buffer state.

Definition at line 274 of file StreamBuffer.h.

274  {
275  return m_mode == WRITING;
276  }
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:154
bool StreamBuffer::isWriting ( ) const
inline

Get stream buffer state.

Definition at line 274 of file StreamBuffer.h.

274  {
275  return m_mode == WRITING;
276  }
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:154
StreamBuffer& StreamBuffer::operator<< ( longlong  data)
inline

Output Streamer.

Definition at line 349 of file StreamBuffer.h.

349  {
350  swapToBuffer(&data, sizeof(data));
351  STREAM_ANALYSE(data, sizeof(data));
352  return *this;
353  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( longlong  data)
inline

Output Streamer.

Definition at line 349 of file StreamBuffer.h.

349  {
350  swapToBuffer(&data, sizeof(data));
351  STREAM_ANALYSE(data, sizeof(data));
352  return *this;
353  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( int  data)
inline

Output Streamer.

Definition at line 360 of file StreamBuffer.h.

360  {
361  swapToBuffer(&data, sizeof(data));
362  STREAM_ANALYSE(data, sizeof(data));
363  return *this;
364  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( int  data)
inline

Output Streamer.

Definition at line 360 of file StreamBuffer.h.

360  {
361  swapToBuffer(&data, sizeof(data));
362  STREAM_ANALYSE(data, sizeof(data));
363  return *this;
364  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned int  data)
inline

Output Streamer.

Definition at line 371 of file StreamBuffer.h.

371  {
372  swapToBuffer(&data, sizeof(data));
373  STREAM_ANALYSE(data, sizeof(data));
374  return *this;
375  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned int  data)
inline

Output Streamer.

Definition at line 371 of file StreamBuffer.h.

371  {
372  swapToBuffer(&data, sizeof(data));
373  STREAM_ANALYSE(data, sizeof(data));
374  return *this;
375  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( long  data)
inline

Output Streamer.

Definition at line 382 of file StreamBuffer.h.

382  {
383  swapToBuffer(&data, sizeof(data));
384  STREAM_ANALYSE(data, sizeof(data));
385  return *this;
386  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( long  data)
inline

Output Streamer.

Definition at line 382 of file StreamBuffer.h.

382  {
383  swapToBuffer(&data, sizeof(data));
384  STREAM_ANALYSE(data, sizeof(data));
385  return *this;
386  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned long  data)
inline

Output Streamer.

Definition at line 393 of file StreamBuffer.h.

393  {
394  swapToBuffer(&data, sizeof(data));
395  STREAM_ANALYSE(data, sizeof(data));
396  return *this;
397  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned long  data)
inline

Output Streamer.

Definition at line 393 of file StreamBuffer.h.

393  {
394  swapToBuffer(&data, sizeof(data));
395  STREAM_ANALYSE(data, sizeof(data));
396  return *this;
397  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( short  data)
inline

Output Streamer.

Definition at line 404 of file StreamBuffer.h.

404  {
405  swapToBuffer(&data, sizeof(data));
406  STREAM_ANALYSE(data, sizeof(data));
407  return *this;
408  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( short  data)
inline

Output Streamer.

Definition at line 404 of file StreamBuffer.h.

404  {
405  swapToBuffer(&data, sizeof(data));
406  STREAM_ANALYSE(data, sizeof(data));
407  return *this;
408  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned short  data)
inline

Output Streamer.

Definition at line 415 of file StreamBuffer.h.

415  {
416  swapToBuffer(&data, sizeof(data));
417  STREAM_ANALYSE(data, sizeof(data));
418  return *this;
419  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned short  data)
inline

Output Streamer.

Definition at line 415 of file StreamBuffer.h.

415  {
416  swapToBuffer(&data, sizeof(data));
417  STREAM_ANALYSE(data, sizeof(data));
418  return *this;
419  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( char  data)
inline

Output Streamer.

Definition at line 426 of file StreamBuffer.h.

426  {
427  swapToBuffer(&data, sizeof(data));
428  STREAM_ANALYSE(data, sizeof(data));
429  return *this;
430  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( char  data)
inline

Output Streamer.

Definition at line 426 of file StreamBuffer.h.

426  {
427  swapToBuffer(&data, sizeof(data));
428  STREAM_ANALYSE(data, sizeof(data));
429  return *this;
430  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned char  data)
inline

Output Streamer.

Definition at line 437 of file StreamBuffer.h.

437  {
438  swapToBuffer(&data, sizeof(data));
439  STREAM_ANALYSE(data, sizeof(data));
440  return *this;
441  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( unsigned char  data)
inline

Output Streamer.

Definition at line 437 of file StreamBuffer.h.

437  {
438  swapToBuffer(&data, sizeof(data));
439  STREAM_ANALYSE(data, sizeof(data));
440  return *this;
441  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( float  data)
inline

Output Streamer.

Definition at line 448 of file StreamBuffer.h.

448  {
449  swapToBuffer(&data, sizeof(data));
450  STREAM_ANALYSE(data, sizeof(data));
451  return *this;
452  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( float  data)
inline

Output Streamer.

Definition at line 448 of file StreamBuffer.h.

448  {
449  swapToBuffer(&data, sizeof(data));
450  STREAM_ANALYSE(data, sizeof(data));
451  return *this;
452  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( double  data)
inline

Output Streamer.

Definition at line 459 of file StreamBuffer.h.

459  {
460  swapToBuffer(&data, sizeof(data));
461  STREAM_ANALYSE(data, sizeof(data));
462  return *this;
463  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( double  data)
inline

Output Streamer.

Definition at line 459 of file StreamBuffer.h.

459  {
460  swapToBuffer(&data, sizeof(data));
461  STREAM_ANALYSE(data, sizeof(data));
462  return *this;
463  }
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator<< ( const char *  data)
inline

Streamer to write strings in (char*) format.

Definition at line 479 of file StreamBuffer.h.

479  {
480  const char* ptr = 0 == data ? "" : data;
481  int len = strlen(ptr)+1;
482  if ( 0 == m_analyzer )
483  writeBytes(ptr, len);
484  else {
485  STREAM_ANALYSE(data, len);
486  }
487  return *this;
488  }
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:175
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer & writeBytes(const char *str, long len)
Write string to output stream.
Definition: StreamBuffer.h:296
StreamBuffer& StreamBuffer::operator<< ( const char *  data)
inline

Streamer to write strings in (char*) format.

Definition at line 479 of file StreamBuffer.h.

479  {
480  const char* ptr = 0 == data ? "" : data;
481  int len = strlen(ptr)+1;
482  if ( 0 == m_analyzer )
483  writeBytes(ptr, len);
484  else {
485  STREAM_ANALYSE(data, len);
486  }
487  return *this;
488  }
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:175
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer & writeBytes(const char *str, long len)
Write string to output stream.
Definition: StreamBuffer.h:296
StreamBuffer& StreamBuffer::operator<< ( const std::string &  data)
inline

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

Definition at line 499 of file StreamBuffer.h.

499  {
500  if ( 0 == m_analyzer) {
501  const char* ptr = data.c_str();
502  long len = data.length();
503  writeBytes(ptr, len);
504  }
505  else {
506  STREAM_ANALYSE(data, sizeof(data));
507  }
508  return *this;
509  }
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:175
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer & writeBytes(const char *str, long len)
Write string to output stream.
Definition: StreamBuffer.h:296
StreamBuffer& StreamBuffer::operator<< ( const std::string &  data)
inline

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

Definition at line 499 of file StreamBuffer.h.

499  {
500  if ( 0 == m_analyzer) {
501  const char* ptr = data.c_str();
502  long len = data.length();
503  writeBytes(ptr, len);
504  }
505  else {
506  STREAM_ANALYSE(data, sizeof(data));
507  }
508  return *this;
509  }
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:175
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer & writeBytes(const char *str, long len)
Write string to output stream.
Definition: StreamBuffer.h:296
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
pObjectPointer to object to be loaded.
Returns
Reference to StreamBuffer object

Definition at line 526 of file StreamBuffer.h.

526  {
527  STREAM_ANALYSE(pObject, sizeof(pObject));
528  addContainedLink(pObject, INVALID, INVALID);
529  return *this;
530  }
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
void addContainedLink(const ContainedObject *pObject, long hint, long link)
Definition: StreamBuffer.h:321
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
pObjectPointer to object to be loaded.
Returns
Reference to StreamBuffer object

Definition at line 526 of file StreamBuffer.h.

526  {
527  STREAM_ANALYSE(pObject, sizeof(pObject));
528  addContainedLink(pObject, INVALID, INVALID);
529  return *this;
530  }
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
void addContainedLink(const ContainedObject *pObject, long hint, long link)
Definition: StreamBuffer.h:321
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
pObjectPointer to object to be loaded.
Returns
Reference to StreamBuffer object

Definition at line 538 of file StreamBuffer.h.

538  {
539  STREAM_ANALYSE(pObject, sizeof(pObject));
540  addIdentifiedLink(pObject, INVALID);
541  return *this;
542  }
void addIdentifiedLink(const DataObject *pObject, long hint)
Definition: StreamBuffer.h:310
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
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
pObjectPointer to object to be loaded.
Returns
Reference to StreamBuffer object

Definition at line 538 of file StreamBuffer.h.

538  {
539  STREAM_ANALYSE(pObject, sizeof(pObject));
540  addIdentifiedLink(pObject, INVALID);
541  return *this;
542  }
void addIdentifiedLink(const DataObject *pObject, long hint)
Definition: StreamBuffer.h:310
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
StreamBuffer& StreamBuffer::operator>> ( longlong data)
inline

Input Streamer.

Definition at line 355 of file StreamBuffer.h.

355  {
356  swapFromBuffer(&data, sizeof(data));
357  return *this;
358  }
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( longlong data)
inline

Input Streamer.

Definition at line 355 of file StreamBuffer.h.

355  {
356  swapFromBuffer(&data, sizeof(data));
357  return *this;
358  }
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( int &  data)
inline

Input Streamer.

Definition at line 366 of file StreamBuffer.h.

366  {
367  swapFromBuffer(&data, sizeof(data));
368  return *this;
369  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( int &  data)
inline

Input Streamer.

Definition at line 366 of file StreamBuffer.h.

366  {
367  swapFromBuffer(&data, sizeof(data));
368  return *this;
369  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned int &  data)
inline

Input Streamer.

Definition at line 377 of file StreamBuffer.h.

377  {
378  swapFromBuffer(&data, sizeof(data));
379  return *this;
380  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned int &  data)
inline

Input Streamer.

Definition at line 377 of file StreamBuffer.h.

377  {
378  swapFromBuffer(&data, sizeof(data));
379  return *this;
380  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( long &  data)
inline

Input Streamer.

Definition at line 388 of file StreamBuffer.h.

388  {
389  swapFromBuffer(&data, sizeof(data));
390  return *this;
391  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( long &  data)
inline

Input Streamer.

Definition at line 388 of file StreamBuffer.h.

388  {
389  swapFromBuffer(&data, sizeof(data));
390  return *this;
391  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned long &  data)
inline

Input Streamer.

Definition at line 399 of file StreamBuffer.h.

399  {
400  swapFromBuffer(&data, sizeof(data));
401  return *this;
402  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned long &  data)
inline

Input Streamer.

Definition at line 399 of file StreamBuffer.h.

399  {
400  swapFromBuffer(&data, sizeof(data));
401  return *this;
402  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( short &  data)
inline

Input Streamer.

Definition at line 410 of file StreamBuffer.h.

410  {
411  swapFromBuffer(&data, sizeof(data));
412  return *this;
413  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( short &  data)
inline

Input Streamer.

Definition at line 410 of file StreamBuffer.h.

410  {
411  swapFromBuffer(&data, sizeof(data));
412  return *this;
413  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned short &  data)
inline

Input Streamer.

Definition at line 421 of file StreamBuffer.h.

421  {
422  swapFromBuffer(&data, sizeof(data));
423  return *this;
424  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned short &  data)
inline

Input Streamer.

Definition at line 421 of file StreamBuffer.h.

421  {
422  swapFromBuffer(&data, sizeof(data));
423  return *this;
424  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( char &  data)
inline

Input Streamer.

Definition at line 432 of file StreamBuffer.h.

432  {
433  swapFromBuffer(&data, sizeof(data));
434  return *this;
435  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( char &  data)
inline

Input Streamer.

Definition at line 432 of file StreamBuffer.h.

432  {
433  swapFromBuffer(&data, sizeof(data));
434  return *this;
435  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned char &  data)
inline

Input Streamer.

Definition at line 443 of file StreamBuffer.h.

443  {
444  swapFromBuffer(&data, sizeof(data));
445  return *this;
446  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( unsigned char &  data)
inline

Input Streamer.

Definition at line 443 of file StreamBuffer.h.

443  {
444  swapFromBuffer(&data, sizeof(data));
445  return *this;
446  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( float &  data)
inline

Input Streamer.

Definition at line 454 of file StreamBuffer.h.

454  {
455  swapFromBuffer(&data, sizeof(data));
456  return *this;
457  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( float &  data)
inline

Input Streamer.

Definition at line 454 of file StreamBuffer.h.

454  {
455  swapFromBuffer(&data, sizeof(data));
456  return *this;
457  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( double &  data)
inline

Input Streamer.

Definition at line 465 of file StreamBuffer.h.

465  {
466  swapFromBuffer(&data, sizeof(data));
467  return *this;
468  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( double &  data)
inline

Input Streamer.

Definition at line 465 of file StreamBuffer.h.

465  {
466  swapFromBuffer(&data, sizeof(data));
467  return *this;
468  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611
StreamBuffer& StreamBuffer::operator>> ( char *  data)
inline

Streamer to read strings in (char*) format.

Definition at line 470 of file StreamBuffer.h.

470  {
471  long i, len;
472  *this >> len;
473  for ( i = 0, data[0]=0; i < len; i++ ) {
474  data[i] = m_buffer[m_pointer++];
475  }
476  return *this;
477  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
list i
Definition: ana.py:128
StreamBuffer& StreamBuffer::operator>> ( char *  data)
inline

Streamer to read strings in (char*) format.

Definition at line 470 of file StreamBuffer.h.

470  {
471  long i, len;
472  *this >> len;
473  for ( i = 0, data[0]=0; i < len; i++ ) {
474  data[i] = m_buffer[m_pointer++];
475  }
476  return *this;
477  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
list i
Definition: ana.py:128
StreamBuffer& StreamBuffer::operator>> ( std::string &  data)
inline

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

Definition at line 490 of file StreamBuffer.h.

490  {
491  long i, len;
492  *this >> len;
493  for ( i = 0, data = ""; i < len; i++ ) {
494  data.append( 1, m_buffer[m_pointer++] );
495  }
496  return *this;
497  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
list i
Definition: ana.py:128
StreamBuffer& StreamBuffer::operator>> ( std::string &  data)
inline

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

Definition at line 490 of file StreamBuffer.h.

490  {
491  long i, len;
492  *this >> len;
493  for ( i = 0, data = ""; i < len; i++ ) {
494  data.append( 1, m_buffer[m_pointer++] );
495  }
496  return *this;
497  }
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
list i
Definition: ana.py:128
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
refpObjectReference to pointer to object to be loaded.
Returns
Reference to StreamBuffer object

Definition at line 516 of file StreamBuffer.h.

516  {
517  return getObjectPointer(refpObject, refpObject);
518  }
StreamBuffer & getObjectPointer(const DataObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:183
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
refpObjectReference to pointer to object to be loaded.
Returns
Reference to StreamBuffer object

Definition at line 516 of file StreamBuffer.h.

516  {
517  return getObjectPointer(refpObject, refpObject);
518  }
StreamBuffer & getObjectPointer(const DataObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:183
void StreamBuffer::reserve ( long  len)
inline

Reserve buffer space; Default: 16 k buffer size.

Definition at line 222 of file StreamBuffer.h.

222  {
223  if ( len > m_length ) {
224  m_length = (len < 16384) ? 16384 : len;
225  m_buffer = (char*)::realloc (m_buffer,m_length);
226  }
227  }
long m_length
Total buffer length.
Definition: StreamBuffer.h:160
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
void StreamBuffer::reserve ( long  len)
inline

Reserve buffer space; Default: 16 k buffer size.

Definition at line 222 of file StreamBuffer.h.

222  {
223  if ( len > m_length ) {
224  m_length = (len < 16384) ? 16384 : len;
225  m_buffer = (char*)::realloc (m_buffer,m_length);
226  }
227  }
long m_length
Total buffer length.
Definition: StreamBuffer.h:160
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
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
ioObjectReference to data IO object.

Definition at line 550 of file StreamBuffer.h.

550  {
551  ioObject.serialize ( *this );
552  m_pointer = 0;
553  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
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
ioObjectReference to data IO object.

Definition at line 550 of file StreamBuffer.h.

550  {
551  ioObject.serialize ( *this );
552  m_pointer = 0;
553  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
void StreamBuffer::setAnalyzer ( AnalyzeFunction  fun = nullptr)
inline

Enable user analysis function.

Definition at line 286 of file StreamBuffer.h.

286  {
287  m_analyzer = fun;
288  }
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:175
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
void StreamBuffer::setAnalyzer ( AnalyzeFunction  fun = nullptr)
inline

Enable user analysis function.

Definition at line 286 of file StreamBuffer.h.

286  {
287  m_analyzer = fun;
288  }
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:175
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
void StreamBuffer::setBuffPointer ( long  ptr)
inline

Retrieve current buffer pointer.

Definition at line 282 of file StreamBuffer.h.

282  {
283  m_pointer = ptr;
284  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
void StreamBuffer::setBuffPointer ( long  ptr)
inline

Retrieve current buffer pointer.

Definition at line 282 of file StreamBuffer.h.

282  {
283  m_pointer = ptr;
284  }
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
void StreamBuffer::setMode ( Mode  m)
inline

Set mode of the stream and allocate buffer.

Definition at line 261 of file StreamBuffer.h.

261  {
262  m_mode = m;
263  m_pointer = 0;
264  m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end());
266  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:154
constexpr double m
Definition: SystemOfUnits.h:93
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
void StreamBuffer::setMode ( Mode  m)
inline

Set mode of the stream and allocate buffer.

Definition at line 261 of file StreamBuffer.h.

261  {
262  m_mode = m;
263  m_pointer = 0;
264  m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end());
266  }
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:154
constexpr double m
Definition: SystemOfUnits.h:93
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:172
long StreamBuffer::size ( ) const
inline

Total buffer size.

Definition at line 239 of file StreamBuffer.h.

239  {
240  return m_length;
241  }
long m_length
Total buffer length.
Definition: StreamBuffer.h:160
long StreamBuffer::size ( ) const
inline

Total buffer size.

Definition at line 239 of file StreamBuffer.h.

239  {
240  return m_length;
241  }
long m_length
Total buffer length.
Definition: StreamBuffer.h:160
SwapAction StreamBuffer::swapBuffer ( int  siz) const
protected

Check for byte swapping.

StreamBuffer::SwapAction StreamBuffer::swapBuffer ( int  siz) const
inlineprotected

Check for byte swapping.

Definition at line 559 of file StreamBuffer.h.

559  {
560  switch(siz) {
561  case 1:
562  return SINGLE_BYTE;
563  default:
564 #if defined(__alpha) && !defined(__VMS)
565 // return m_swapEnabled ? SWAP : NOSWAP;
566  return NOSWAP;
567 #elif defined(__sun) && defined(__SVR4) && defined(__i386)
568 // return m_swapEnabled ? SWAP : NOSWAP;
569  return NOSWAP;
570 #elif defined(__APPLE__)
571 // return m_swapEnabled ? SWAP : NOSWAP;
572  return SWAP;
573 #elif defined(__linux) && !defined(__powerpc)
574 // return m_swapEnabled ? SWAP : NOSWAP;
575  return NOSWAP;
576 #elif defined(BORLAND) || defined(_WIN32) || defined(WIN32)
577 // return m_swapEnabled ? SWAP : NOSWAP;
578  return NOSWAP;
579 #else
580  return m_swapEnabled ? SWAP : NOSWAP;
581 // return NOSWAP;
582 #endif
583  }
584 }
bool m_swapEnabled
Flag indicating swapping.
Definition: StreamBuffer.h:166
void StreamBuffer::swapFromBuffer ( void *  target,
int  siz 
)

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

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

611  {
612  char* tar = (char*)target;
613  char* src = (char*)m_buffer+m_pointer;
614  switch ( swapBuffer(siz) ) {
615  case SINGLE_BYTE:
616  *tar = *src;
617  break;
618  case SWAP:
619 #ifdef __APPLE__
620  for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i];
621 #else
622  ::_swab (src, tar, siz);
623 #endif
624  break;
625  case NOSWAP:
626  std::copy_n(src,siz,tar);
627  break;
628  }
629  m_pointer += siz;
630 }
#define _swab(source, target, radix)
Definition: swab.h:7
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
list i
Definition: ana.py:128
SwapAction swapBuffer(int siz) const
Check for byte swapping.
Definition: StreamBuffer.h:559
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 587 of file StreamBuffer.h.

587  {
588  char buff[8], *tar, *src = (char*)source;
589  extend (m_pointer+siz);
590  tar = (char*)m_buffer+m_pointer;
591  switch ( swapBuffer(siz) ) {
592  case SINGLE_BYTE:
593  *tar = *src;
594  break;
595  case SWAP:
596 #ifdef __APPLE__
597  for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i];
598 #else
599  ::_swab (src, buff, siz);
600 #endif
601  src = buff;
602  /* no break */
603  case NOSWAP:
604  std::copy_n(src,siz,tar);
605  break;
606  }
607  m_pointer += siz;
608 }
#define _swab(source, target, radix)
Definition: swab.h:7
void extend(long len)
Extend the buffer.
Definition: StreamBuffer.h:229
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
list i
Definition: ana.py:128
SwapAction swapBuffer(int siz) const
Check for byte swapping.
Definition: StreamBuffer.h:559
void StreamBuffer::swapToBuffer ( const void *  source,
int  siz 
)

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

StreamBuffer& StreamBuffer::writeBytes ( const char *  str,
long  len 
)
inline

Write string to output stream.

Definition at line 296 of file StreamBuffer.h.

296  {
297  extend( m_pointer+len+4 );
298  *this << len;
299  std::copy_n(str,len, data()+buffPointer());
300  m_pointer += len;
301  return *this;
302  }
long buffPointer() const
Retrieve current buffer pointer.
Definition: StreamBuffer.h:278
void extend(long len)
Extend the buffer.
Definition: StreamBuffer.h:229
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
StreamBuffer& StreamBuffer::writeBytes ( const char *  str,
long  len 
)
inline

Write string to output stream.

Definition at line 296 of file StreamBuffer.h.

296  {
297  extend( m_pointer+len+4 );
298  *this << len;
299  std::copy_n(str,len, data()+buffPointer());
300  m_pointer += len;
301  return *this;
302  }
long buffPointer() const
Retrieve current buffer pointer.
Definition: StreamBuffer.h:278
void extend(long len)
Extend the buffer.
Definition: StreamBuffer.h:229
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157

Friends And Related Function Documentation

DataObject
friend

DataObject is friend.

Definition at line 150 of file StreamBuffer.h.

Member Data Documentation

AnalyzeFunction StreamBuffer::m_analyzer = nullptr
protected

Hook function for analysis of data to the stream.

Definition at line 175 of file StreamBuffer.h.

char * StreamBuffer::m_buffer = nullptr
protected

Pointer to heap buffer.

Definition at line 163 of file StreamBuffer.h.

ContainedLinks StreamBuffer::m_containedLinks
protected

Container with links to contained objects.

Definition at line 169 of file StreamBuffer.h.

IdentifiedLinks StreamBuffer::m_identifiedLinks
protected

Container with links to contained objects.

Definition at line 172 of file StreamBuffer.h.

long StreamBuffer::m_length = 0
protected

Total buffer length.

Definition at line 160 of file StreamBuffer.h.

Mode StreamBuffer::m_mode = UNINITIALIZED
protected

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

Definition at line 154 of file StreamBuffer.h.

long StreamBuffer::m_pointer = 0
protected

Current buffer pointer.

Definition at line 157 of file StreamBuffer.h.

bool StreamBuffer::m_swapEnabled = true
protected

Flag indicating swapping.

Definition at line 166 of file StreamBuffer.h.


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