StreamBuffer.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_STREAMBUFFER_H
2 #define GAUDIKERNEL_STREAMBUFFER_H 1
3 
4 // STL include files
5 #include <list>
6 #include <vector>
7 #include <algorithm>
8 #include <string>
9 #include <iostream>
10 #include <cstring>
11 #include <cstdlib>
12 #include <typeinfo>
13 
14 #include "GaudiKernel/Kernel.h"
15 #include "GaudiKernel/swab.h"
16 
17 // forward declarations
18 class StreamBuffer;
19 class DataObject;
20 class ContainedObject;
21 
40 class StreamBuffer /* : public std::string */ {
41 public:
43  class DataIO {
44  public:
46  DataIO() = default;
48  virtual ~DataIO() = default;
50  void badStreamMode() {
51  throw("Not acceptable stream mode!");
52  }
54  virtual void serialize(StreamBuffer& stream) {
55  if (stream.isReading())
56  load(stream);
57  else if (stream.isWriting())
58  dump(stream);
59  else
60  badStreamMode();
61  }
63  virtual void load(StreamBuffer&) {
64  badStreamMode();
65  }
67  virtual void dump(StreamBuffer&) {
68  badStreamMode();
69  }
70  };
71 
73  class Istream : public DataIO {
75  std::istream* m_stream;
76  public:
78  Istream(std::istream& str) : m_stream(&str) {
79  }
81  virtual ~Istream() = default;
82 
84  virtual void load(StreamBuffer& stream) {
85  // Generic implementation for istreams:
86  int len;
87  (*m_stream) >> len;
88  stream.erase();
89  stream.reserve(len);
90  m_stream->read(stream.data(),len);
91  }
92  };
94  class Ostream : public DataIO {
95  std::ostream* m_stream;
96  public:
98  Ostream(std::ostream& str) : m_stream(&str) {
99  }
101  virtual ~Ostream() = default;
102 
104  virtual void dump(StreamBuffer& stream) {
105  // Generic implementation for ostreams:
106  (*m_stream) << stream.buffPointer();
107  m_stream->write(stream.data(), stream.buffPointer());
108  }
109  };
110 public:
116  enum State {INVALID=-1, VALID };
119  public:
121  long second;
122  long third;
123  ContainedLink() : first(0), second(INVALID), third(INVALID) {
124  }
126  : first(copy.first), second(copy.second), third(copy.third) {
127  }
128  ContainedLink(ContainedObject* pObj, long hint, long link)
129  : first(pObj), second(hint), third(link) {
130  }
131  };
134  public:
135  DataObject* first = nullptr;
136  long second = INVALID;
137  IdentifiedLink() = default;
138  IdentifiedLink(const IdentifiedLink& copy) = default;
139  IdentifiedLink(DataObject* pObj, long hint)
140  : first(pObj), second(hint) {
141  }
142  };
143 
144  typedef std::vector<ContainedLink> ContainedLinks;
146  typedef std::vector<IdentifiedLink> IdentifiedLinks;
148  typedef void (*AnalyzeFunction)(const void* data, int siz, const std::type_info& type);
150  friend class DataObject;
151 
152 protected:
155 
157  long m_pointer = 0;
158 
160  long m_length = 0;
161 
163  char* m_buffer = nullptr;
164 
166  bool m_swapEnabled = true;
167 
169  ContainedLinks m_containedLinks;
170 
172  IdentifiedLinks m_identifiedLinks;
173 
176 
178  SwapAction swapBuffer(int siz) const;
179 
183  template <class TYPE> StreamBuffer& getObjectPointer(const DataObject* /*pObject*/, TYPE*& refpObject) {
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  }
193  template <class TYPE> StreamBuffer& getObjectPointer(const ContainedObject* /*pObject*/, TYPE*& refpObject) {
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  }
200 public:
202  StreamBuffer(bool do_swap=true) :
203  m_swapEnabled(do_swap) {
204  }
206  virtual ~StreamBuffer() {
207  ::free( m_buffer );
208  }
210  const char* data() const {
211  return m_buffer;
212  }
214  char* data() {
215  return m_buffer;
216  }
218  void erase() {
219  m_pointer = 0;
220  }
222  void reserve(long len) {
223  if ( len > m_length ) {
224  m_length = (len < 16384) ? 16384 : len;
225  m_buffer = (char*)::realloc (m_buffer,m_length);
226  }
227  }
229  void extend(long len) {
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  }
239  long size () const {
240  return m_length;
241  }
243  ContainedLinks& containedLinks() {
244  return m_containedLinks;
245  }
247  const ContainedLinks& containedLinks() const {
248  return m_containedLinks;
249  }
250 
252  IdentifiedLinks& identifiedLinks() {
253  return m_identifiedLinks;
254  }
256  const IdentifiedLinks& identifiedLinks() const {
257  return m_identifiedLinks;
258  }
259 
261  void setMode(Mode m) {
262  m_mode = m;
263  m_pointer = 0;
264  m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end());
265  m_identifiedLinks.erase(m_identifiedLinks.begin(),m_identifiedLinks.end());
266  }
267 
269  bool isReading() const {
270  return m_mode == READING;
271  }
272 
274  bool isWriting() const {
275  return m_mode == WRITING;
276  }
278  long buffPointer() const {
279  return m_pointer;
280  }
282  void setBuffPointer(long ptr) {
283  m_pointer = ptr;
284  }
287  m_analyzer = fun;
288  }
290  void swapToBuffer(const void* source, int siz);
291 
293  void swapFromBuffer(void* target, int siz);
294 
296  StreamBuffer& writeBytes (const char* str, long len) {
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  }
303 
304  void getIdentifiedLink (DataObject*& pObject, long& hint) {
305  IdentifiedLink& l = m_identifiedLinks.back();
306  pObject = l.first;
307  hint = l.second;
308  m_identifiedLinks.pop_back();
309  }
310  void addIdentifiedLink (const DataObject* pObject, long hint) {
311  m_identifiedLinks.push_back( IdentifiedLink((DataObject*)pObject, hint) );
312  }
313 
314  void getContainedLink (ContainedObject*& pObject, long& hint, long& link) {
315  ContainedLink& l = m_containedLinks.back();
316  pObject = l.first;
317  hint = l.second;
318  link = l.third;
319  m_containedLinks.pop_back();
320  }
321  void addContainedLink (const ContainedObject* pObject, long hint, long link) {
322  m_containedLinks.push_back( ContainedLink((ContainedObject*)pObject, hint, link) );
323  }
324 
325 #ifdef USE_STREAM_ANALYSER
326  #define STREAM_ANALYSE(data, len) if ( 0 != m_analyzer ) m_analyzer(&data, len, typeid(data))
327 #else
328  #define STREAM_ANALYSE(data, len)
329 #endif
330 
331  // Implement streamer macros for primivive data types.
332 #define IMPLEMENT_STREAMER(TYPE) \
333  /* Output Streamer */ \
334  StreamBuffer& operator<<(TYPE data) { \
335  swapToBuffer(&data, sizeof(data)); \
336  STREAM_ANALYSE(data, sizeof(data)); \
337  return *this; \
338  } \
339  /* Input Streamer */ \
340  StreamBuffer& operator>>(TYPE & data) { \
341  swapFromBuffer(&data, sizeof(data)); \
342  return *this; \
343  }
344 // RootCint does not understand this macro....
345 // But we can easily live without it!
346 #undef IMPLEMENT_STREAMER
347 
350  swapToBuffer(&data, sizeof(data));
351  STREAM_ANALYSE(data, sizeof(data));
352  return *this;
353  }
356  swapFromBuffer(&data, sizeof(data));
357  return *this;
358  }
361  swapToBuffer(&data, sizeof(data));
362  STREAM_ANALYSE(data, sizeof(data));
363  return *this;
364  }
366  StreamBuffer& operator>>(int & data) {
367  swapFromBuffer(&data, sizeof(data));
368  return *this;
369  }
371  StreamBuffer& operator<<(unsigned int data) {
372  swapToBuffer(&data, sizeof(data));
373  STREAM_ANALYSE(data, sizeof(data));
374  return *this;
375  }
377  StreamBuffer& operator>>(unsigned int & data) {
378  swapFromBuffer(&data, sizeof(data));
379  return *this;
380  }
382  StreamBuffer& operator<<(long data) {
383  swapToBuffer(&data, sizeof(data));
384  STREAM_ANALYSE(data, sizeof(data));
385  return *this;
386  }
388  StreamBuffer& operator>>(long & data) {
389  swapFromBuffer(&data, sizeof(data));
390  return *this;
391  }
393  StreamBuffer& operator<<(unsigned long data) {
394  swapToBuffer(&data, sizeof(data));
395  STREAM_ANALYSE(data, sizeof(data));
396  return *this;
397  }
399  StreamBuffer& operator>>(unsigned long & data) {
400  swapFromBuffer(&data, sizeof(data));
401  return *this;
402  }
404  StreamBuffer& operator<<(short data) {
405  swapToBuffer(&data, sizeof(data));
406  STREAM_ANALYSE(data, sizeof(data));
407  return *this;
408  }
410  StreamBuffer& operator>>(short & data) {
411  swapFromBuffer(&data, sizeof(data));
412  return *this;
413  }
415  StreamBuffer& operator<<(unsigned short data) {
416  swapToBuffer(&data, sizeof(data));
417  STREAM_ANALYSE(data, sizeof(data));
418  return *this;
419  }
421  StreamBuffer& operator>>(unsigned short & data) {
422  swapFromBuffer(&data, sizeof(data));
423  return *this;
424  }
426  StreamBuffer& operator<<(char data) {
427  swapToBuffer(&data, sizeof(data));
428  STREAM_ANALYSE(data, sizeof(data));
429  return *this;
430  }
432  StreamBuffer& operator>>(char & data) {
433  swapFromBuffer(&data, sizeof(data));
434  return *this;
435  }
437  StreamBuffer& operator<<(unsigned char data) {
438  swapToBuffer(&data, sizeof(data));
439  STREAM_ANALYSE(data, sizeof(data));
440  return *this;
441  }
443  StreamBuffer& operator>>(unsigned char & data) {
444  swapFromBuffer(&data, sizeof(data));
445  return *this;
446  }
448  StreamBuffer& operator<<(float data) {
449  swapToBuffer(&data, sizeof(data));
450  STREAM_ANALYSE(data, sizeof(data));
451  return *this;
452  }
454  StreamBuffer& operator>>(float & data) {
455  swapFromBuffer(&data, sizeof(data));
456  return *this;
457  }
459  StreamBuffer& operator<<(double data) {
460  swapToBuffer(&data, sizeof(data));
461  STREAM_ANALYSE(data, sizeof(data));
462  return *this;
463  }
465  StreamBuffer& operator>>(double & data) {
466  swapFromBuffer(&data, sizeof(data));
467  return *this;
468  }
470  StreamBuffer& operator>>(char* data) {
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  }
479  StreamBuffer& operator<<(const char *data) {
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  }
490  StreamBuffer& operator>>(std::string& data) {
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  }
499  StreamBuffer& operator<<(const std::string& data) {
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  }
516  template<class TYPE> StreamBuffer& operator>>(TYPE*& refpObject) {
517  return getObjectPointer(refpObject, refpObject);
518  }
519 
527  STREAM_ANALYSE(pObject, sizeof(pObject));
528  addContainedLink(pObject, INVALID, INVALID);
529  return *this;
530  }
531 
538  StreamBuffer& operator<<(const DataObject* pObject) {
539  STREAM_ANALYSE(pObject, sizeof(pObject));
540  addIdentifiedLink(pObject, INVALID);
541  return *this;
542  }
543 
550  void serialize(DataIO& ioObject) {
551  ioObject.serialize ( *this );
552  m_pointer = 0;
553  }
554 };
555 
556 #undef STREAM_ANALYSE
557 
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 }
585 
587 inline void StreamBuffer::swapToBuffer(const void* source, int siz) {
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 }
609 
611 inline void StreamBuffer::swapFromBuffer(void* target, int siz) {
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 }
631 
632 // Output serialize a vector of items
633 template <class T> inline
634 StreamBuffer& operator << (StreamBuffer& s, const std::vector<T>& v) {
635  s << v.size();
636  for ( const auto& i : v ) s << i;
637  return s;
638 }
639 
640 // Input serialize a vector of items
641 template <class T> inline
642 StreamBuffer& operator >> (StreamBuffer& s, std::vector<T>& v) {
643  long i, len;
644  s >> len;
645  v.clear();
646  for ( i = 0; i < len; i++ ) {
647  T temp;
648  s >> temp;
649  v.push_back(temp);
650  }
651  return s;
652 }
653 
654 // Output serialize a list of items
655 template <class T> inline
656 StreamBuffer& operator << (StreamBuffer& s, const std::list<T>& l) {
657  s << l.size();
658  for ( const auto& i : l ) s << i ;
659  return s;
660 }
661 
662 // Input serialize a list of items
663 template <class T> inline
665  long len;
666  s >> len;
667  l.clear();
668  for ( long i = 0; i < len; i++ ) {
669  T temp;
670  s >> temp;
671  l.push_back(temp);
672  }
673  return s;
674 }
675 #endif // GAUDIKERNEL_STREAMBUFFER_H
virtual void load(StreamBuffer &)
Template function to load stream data.
Definition: StreamBuffer.h:63
Writer for standard output streams.
Definition: StreamBuffer.h:94
StreamBuffer(bool do_swap=true)
Standard constructor.
Definition: StreamBuffer.h:202
Mode
Streamer mode.
Definition: StreamBuffer.h:112
virtual void serialize(StreamBuffer &stream)
Serialization method: loads/dumps streambuffer content.
Definition: StreamBuffer.h:54
#define _swab(source, target, radix)
Definition: swab.h:7
StreamBuffer & operator<<(const char *data)
Streamer to write strings in (char*) format.
Definition: StreamBuffer.h:479
std::istream * m_stream
Reference to input stream.
Definition: StreamBuffer.h:75
long buffPointer() const
Retrieve current buffer pointer.
Definition: StreamBuffer.h:278
StreamBuffer & operator>>(long &data)
Input Streamer.
Definition: StreamBuffer.h:388
StreamBuffer & operator>>(unsigned short &data)
Input Streamer.
Definition: StreamBuffer.h:421
Ostream(std::ostream &str)
Standard constructor: pass reference to stream object.
Definition: StreamBuffer.h:98
StreamBuffer & operator<<(double data)
Output Streamer.
Definition: StreamBuffer.h:459
DataIO()=default
Standard constructor.
StreamBuffer & operator<<(float data)
Output Streamer.
Definition: StreamBuffer.h:448
StreamBuffer & operator<<(const DataObject *pObject)
Streamer to write links to identified objects.
Definition: StreamBuffer.h:538
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:40
StreamBuffer & operator>>(float &data)
Input Streamer.
Definition: StreamBuffer.h:454
SwapAction
Data Sawp actions.
Definition: StreamBuffer.h:114
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:169
Istream(std::istream &str)
Constructor.
Definition: StreamBuffer.h:78
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:175
virtual void dump(StreamBuffer &)
Template function to save stream data.
Definition: StreamBuffer.h:67
long m_length
Total buffer length.
Definition: StreamBuffer.h:160
IdentifiedLinks & identifiedLinks()
Access to identified links.
Definition: StreamBuffer.h:252
virtual ~Ostream()=default
Standard Destructor.
void extend(long len)
Extend the buffer.
Definition: StreamBuffer.h:229
StreamBuffer & operator<<(const ContainedObject *pObject)
Streamer to write links to contained objects.
Definition: StreamBuffer.h:526
StreamBuffer & operator>>(char *data)
Streamer to read strings in (char*) format.
Definition: StreamBuffer.h:470
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:587
bool isReading() const
Get stream buffer state.
Definition: StreamBuffer.h:269
std::vector< ContainedLink > ContainedLinks
Definition: StreamBuffer.h:144
virtual void load(StreamBuffer &stream)
Data load method.
Definition: StreamBuffer.h:84
StreamBuffer & operator<<(unsigned long data)
Output Streamer.
Definition: StreamBuffer.h:393
StreamBuffer & operator<<(unsigned short data)
Output Streamer.
Definition: StreamBuffer.h:415
Reader for standard input streams.
Definition: StreamBuffer.h:73
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:210
void setAnalyzer(AnalyzeFunction fun=nullptr)
Enable user analysis function.
Definition: StreamBuffer.h:286
char * data()
write access to data buffer
Definition: StreamBuffer.h:214
virtual ~Istream()=default
Destructor.
void setBuffPointer(long ptr)
Retrieve current buffer pointer.
Definition: StreamBuffer.h:282
StreamBuffer & operator>>(unsigned char &data)
Input Streamer.
Definition: StreamBuffer.h:443
StreamBuffer & operator<<(int data)
Output Streamer.
Definition: StreamBuffer.h:360
StreamBuffer & operator>>(longlong &data)
Input Streamer.
Definition: StreamBuffer.h:355
void reserve(long len)
Reserve buffer space; Default: 16 k buffer size.
Definition: StreamBuffer.h:222
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:154
const IdentifiedLinks & identifiedLinks() const
CONST Access to identified links.
Definition: StreamBuffer.h:256
ContainedLinks & containedLinks()
Access to contained links.
Definition: StreamBuffer.h:243
StreamBuffer & operator<<(long data)
Output Streamer.
Definition: StreamBuffer.h:382
constexpr double m
Definition: SystemOfUnits.h:93
StreamBuffer & operator<<(unsigned char data)
Output Streamer.
Definition: StreamBuffer.h:437
StreamBuffer & operator<<(longlong data)
Output Streamer.
Definition: StreamBuffer.h:349
StreamBuffer & operator<<(short data)
Output Streamer.
Definition: StreamBuffer.h:404
StreamBuffer & getObjectPointer(const ContainedObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:193
StreamBuffer & operator<<(const std::string &data)
Streamer to write strings in (std::string) format.
Definition: StreamBuffer.h:499
void badStreamMode()
Throw Exception.
Definition: StreamBuffer.h:50
StreamBuffer & operator>>(char &data)
Input Streamer.
Definition: StreamBuffer.h:432
StreamBuffer & operator>>(unsigned long &data)
Input Streamer.
Definition: StreamBuffer.h:399
void addIdentifiedLink(const DataObject *pObject, long hint)
Definition: StreamBuffer.h:310
dictionary l
Definition: gaudirun.py:422
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
virtual ~DataIO()=default
Standard destructor.
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:163
bool isWriting() const
Get stream buffer state.
Definition: StreamBuffer.h:274
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:157
A small base class to handle generic data streaming.
Definition: StreamBuffer.h:43
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:328
string s
Definition: gaudirun.py:246
State
Link state defintions.
Definition: StreamBuffer.h:116
std::ostream * m_stream
Definition: StreamBuffer.h:95
StreamBuffer & writeBytes(const char *str, long len)
Write string to output stream.
Definition: StreamBuffer.h:296
virtual ~StreamBuffer()
Standard destructor.
Definition: StreamBuffer.h:206
virtual void dump(StreamBuffer &stream)
Output dumper.
Definition: StreamBuffer.h:104
void erase()
Reset the buffer.
Definition: StreamBuffer.h:218
StreamBuffer & operator<<(unsigned int data)
Output Streamer.
Definition: StreamBuffer.h:371
void(* AnalyzeFunction)(const void *data, int siz, const std::type_info &type)
Definition of the buffer analyzer.
Definition: StreamBuffer.h:148
StreamBuffer & operator>>(std::string &data)
Streamer to read strings in (std::string) format.
Definition: StreamBuffer.h:490
StreamBuffer & operator>>(StreamBuffer &s, std::vector< T > &v)
Definition: StreamBuffer.h:642
StreamBuffer & operator<<(char data)
Output Streamer.
Definition: StreamBuffer.h:426
void setMode(Mode m)
Set mode of the stream and allocate buffer.
Definition: StreamBuffer.h:261
StreamBuffer & getObjectPointer(const DataObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:183
StreamBuffer & operator>>(unsigned int &data)
Input Streamer.
Definition: StreamBuffer.h:377
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
list i
Definition: ana.py:128
SwapAction swapBuffer(int siz) const
Check for byte swapping.
Definition: StreamBuffer.h:559
StreamBuffer & operator>>(double &data)
Input Streamer.
Definition: StreamBuffer.h:465
void addContainedLink(const ContainedObject *pObject, long hint, long link)
Definition: StreamBuffer.h:321
void getContainedLink(ContainedObject *&pObject, long &hint, long &link)
Definition: StreamBuffer.h:314
long size() const
Total buffer size.
Definition: StreamBuffer.h:239
StreamBuffer & operator>>(int &data)
Input Streamer.
Definition: StreamBuffer.h:366
std::vector< IdentifiedLink > IdentifiedLinks
Definition of the identifiable link set.
Definition: StreamBuffer.h:146
void serialize(DataIO &ioObject)
Serialize the buffer using an IO object.
Definition: StreamBuffer.h:550
const ContainedLinks & containedLinks() const
CONST Access to contained links.
Definition: StreamBuffer.h:247
string type
Definition: gaudirun.py:151
bool m_swapEnabled
Flag indicating swapping.
Definition: StreamBuffer.h:166
StreamBuffer & operator>>(short &data)
Input Streamer.
Definition: StreamBuffer.h:410
void getIdentifiedLink(DataObject *&pObject, long &hint)
Definition: StreamBuffer.h:304
StreamBuffer & operator>>(TYPE *&refpObject)
Streamer to read links to contained or identified objects.
Definition: StreamBuffer.h:516
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:611