All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
StreamBuffer.h
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/StreamBuffer.h,v 1.9 2008/10/27 16:41:33 marcocle Exp $
2 #ifndef GAUDIKERNEL_STREAMBUFFER_H
3 #define GAUDIKERNEL_STREAMBUFFER_H 1
4 
5 // STL include files
6 #include <list>
7 #include <vector>
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() {
47  }
49  virtual ~DataIO() {
50  }
52  void badStreamMode() {
53  throw("Not acceptable stream mode!");
54  }
56  virtual void serialize(StreamBuffer& stream) {
57  if (stream.isReading())
58  load(stream);
59  else if (stream.isWriting())
60  dump(stream);
61  else
62  badStreamMode();
63  }
65  virtual void load(StreamBuffer&) {
66  badStreamMode();
67  }
69  virtual void dump(StreamBuffer&) {
70  badStreamMode();
71  }
72  };
73 
75  class Istream : public DataIO {
77  std::istream* m_stream;
78  public:
80  Istream(std::istream& str) : m_stream(&str) {
81  }
83  virtual ~Istream() {
84  }
86  virtual void load(StreamBuffer& stream) {
87  // Generic implementation for istreams:
88  int len;
89  (*m_stream) >> len;
90  stream.erase();
91  stream.reserve(len);
92  m_stream->read(stream.data(),len);
93  }
94  };
96  class Ostream : public DataIO {
97  std::ostream* m_stream;
98  public:
100  Ostream(std::ostream& str) : m_stream(&str) {
101  }
103  virtual ~Ostream() {
104  }
106  virtual void dump(StreamBuffer& stream) {
107  // Generic implementation for ostreams:
108  (*m_stream) << stream.buffPointer();
109  m_stream->write(stream.data(), stream.buffPointer());
110  }
111  };
112 public:
118  enum State {INVALID=-1, VALID };
121  public:
123  long second;
124  long third;
126  }
128  : first(copy.first), second(copy.second), third(copy.third) {
129  }
130  ContainedLink(ContainedObject* pObj, long hint, long link)
131  : first(pObj), second(hint), third(link) {
132  }
133  };
136  public:
138  long second;
140  }
142  : first(copy.first), second(copy.second) {
143  }
144  IdentifiedLink(DataObject* pObj, long hint)
145  : first(pObj), second(hint) {
146  }
147  };
148 
149  typedef std::vector<ContainedLink> ContainedLinks;
151  typedef std::vector<IdentifiedLink> IdentifiedLinks;
153  typedef void (*AnalyzeFunction)(const void* data, int siz, const std::type_info& type);
155  friend class DataObject;
156 
157 protected:
160 
162  long m_pointer;
163 
165  long m_length;
166 
168  char* m_buffer;
169 
172 
175 
178 
181 
183  SwapAction swapBuffer(int siz) const;
184 
188  template <class TYPE> StreamBuffer& getObjectPointer(const DataObject* /*pObject*/, TYPE*& refpObject) {
189  IdentifiedLink& link = m_identifiedLinks.back();
190  DataObject* pObj = link.first;
191  m_identifiedLinks.pop_back();
192  refpObject = dynamic_cast<TYPE*>(pObj);
193  return *this;
194  }
198  template <class TYPE> StreamBuffer& getObjectPointer(const ContainedObject* /*pObject*/, TYPE*& refpObject) {
199  ContainedLink& link = m_containedLinks.back();
200  ContainedObject* pObj = link.first;
201  m_containedLinks.pop_back();
202  refpObject = dynamic_cast<TYPE*>(pObj);
203  return *this;
204  }
205 public:
207  StreamBuffer(bool do_swap=true) :
209  m_pointer(0),
210  m_length(0),
211  m_buffer(0),
212  m_swapEnabled(do_swap)
213  {
214  m_analyzer = 0;
215  }
217  virtual ~StreamBuffer() {
218  ::free( m_buffer );
219  }
221  const char* data() const {
222  return m_buffer;
223  }
225  char* data() {
226  return m_buffer;
227  }
229  void erase() {
230  m_pointer = 0;
231  }
233  void reserve(long len) {
234  if ( len > m_length ) {
235  m_length = (len < 16384) ? 16384 : len;
236  m_buffer = (char*)::realloc (m_buffer,m_length);
237  }
238  }
240  void extend(long len) {
241  if ( len + m_pointer > m_length ) {
242  // We have to be a bit generous here in order not to run too often
243  // into ::realloc().
244  long new_len = (m_length < 16384) ? 16384 : 2*m_length;
245  if ( m_length < len ) new_len += len;
246  reserve(new_len);
247  }
248  }
250  long size () const {
251  return m_length;
252  }
255  return m_containedLinks;
256  }
259  return m_containedLinks;
260  }
261 
264  return m_identifiedLinks;
265  }
268  return m_identifiedLinks;
269  }
270 
272  void setMode(Mode m) {
273  m_mode = m;
274  m_pointer = 0;
275  m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end());
277  }
278 
280  bool isReading() const {
281  return m_mode == READING;
282  }
283 
285  bool isWriting() const {
286  return m_mode == WRITING;
287  }
289  long buffPointer() const {
290  return m_pointer;
291  }
293  void setBuffPointer(long ptr) {
294  m_pointer = ptr;
295  }
298  m_analyzer = fun;
299  }
301  void swapToBuffer(const void* source, int siz);
302 
304  void swapFromBuffer(void* target, int siz);
305 
307  StreamBuffer& writeBytes (const char* str, long len) {
308  extend( m_pointer+len+4 );
309  *this << len;
310  memcpy(data()+buffPointer(), str, len);
311  m_pointer += len;
312  return *this;
313  }
314 
315  void getIdentifiedLink (DataObject*& pObject, long& hint) {
317  pObject = l.first;
318  hint = l.second;
319  m_identifiedLinks.pop_back();
320  }
321  void addIdentifiedLink (const DataObject* pObject, long hint) {
322  m_identifiedLinks.push_back( IdentifiedLink((DataObject*)pObject, hint) );
323  }
324 
325  void getContainedLink (ContainedObject*& pObject, long& hint, long& link) {
326  ContainedLink& l = m_containedLinks.back();
327  pObject = l.first;
328  hint = l.second;
329  link = l.third;
330  m_containedLinks.pop_back();
331  }
332  void addContainedLink (const ContainedObject* pObject, long hint, long link) {
333  m_containedLinks.push_back( ContainedLink((ContainedObject*)pObject, hint, link) );
334  }
335 
336 #ifdef USE_STREAM_ANALYSER
337  #define STREAM_ANALYSE(data, len) if ( 0 != m_analyzer ) m_analyzer(&data, len, typeid(data))
338 #else
339  #define STREAM_ANALYSE(data, len)
340 #endif
341 
342  // Implement streamer macros for primivive data types.
343 #define IMPLEMENT_STREAMER(TYPE) \
344  /* Output Streamer */ \
345  StreamBuffer& operator<<(TYPE data) { \
346  swapToBuffer(&data, sizeof(data)); \
347  STREAM_ANALYSE(data, sizeof(data)); \
348  return *this; \
349  } \
350  /* Input Streamer */ \
351  StreamBuffer& operator>>(TYPE & data) { \
352  swapFromBuffer(&data, sizeof(data)); \
353  return *this; \
354  }
355 // RootCint does not understand this macro....
356 // But we can easily live without it!
357 #undef IMPLEMENT_STREAMER
358 
361  swapToBuffer(&data, sizeof(data));
362  STREAM_ANALYSE(data, sizeof(data));
363  return *this;
364  }
367  swapFromBuffer(&data, sizeof(data));
368  return *this;
369  }
372  swapToBuffer(&data, sizeof(data));
373  STREAM_ANALYSE(data, sizeof(data));
374  return *this;
375  }
378  swapFromBuffer(&data, sizeof(data));
379  return *this;
380  }
382  StreamBuffer& operator<<(unsigned int data) {
383  swapToBuffer(&data, sizeof(data));
384  STREAM_ANALYSE(data, sizeof(data));
385  return *this;
386  }
388  StreamBuffer& operator>>(unsigned int & data) {
389  swapFromBuffer(&data, sizeof(data));
390  return *this;
391  }
394  swapToBuffer(&data, sizeof(data));
395  STREAM_ANALYSE(data, sizeof(data));
396  return *this;
397  }
400  swapFromBuffer(&data, sizeof(data));
401  return *this;
402  }
404  StreamBuffer& operator<<(unsigned long data) {
405  swapToBuffer(&data, sizeof(data));
406  STREAM_ANALYSE(data, sizeof(data));
407  return *this;
408  }
410  StreamBuffer& operator>>(unsigned long & data) {
411  swapFromBuffer(&data, sizeof(data));
412  return *this;
413  }
416  swapToBuffer(&data, sizeof(data));
417  STREAM_ANALYSE(data, sizeof(data));
418  return *this;
419  }
422  swapFromBuffer(&data, sizeof(data));
423  return *this;
424  }
426  StreamBuffer& operator<<(unsigned short data) {
427  swapToBuffer(&data, sizeof(data));
428  STREAM_ANALYSE(data, sizeof(data));
429  return *this;
430  }
432  StreamBuffer& operator>>(unsigned short & data) {
433  swapFromBuffer(&data, sizeof(data));
434  return *this;
435  }
438  swapToBuffer(&data, sizeof(data));
439  STREAM_ANALYSE(data, sizeof(data));
440  return *this;
441  }
444  swapFromBuffer(&data, sizeof(data));
445  return *this;
446  }
448  StreamBuffer& operator<<(unsigned char data) {
449  swapToBuffer(&data, sizeof(data));
450  STREAM_ANALYSE(data, sizeof(data));
451  return *this;
452  }
454  StreamBuffer& operator>>(unsigned char & data) {
455  swapFromBuffer(&data, sizeof(data));
456  return *this;
457  }
460  swapToBuffer(&data, sizeof(data));
461  STREAM_ANALYSE(data, sizeof(data));
462  return *this;
463  }
466  swapFromBuffer(&data, sizeof(data));
467  return *this;
468  }
471  swapToBuffer(&data, sizeof(data));
472  STREAM_ANALYSE(data, sizeof(data));
473  return *this;
474  }
477  swapFromBuffer(&data, sizeof(data));
478  return *this;
479  }
482  long i, len;
483  *this >> len;
484  for ( i = 0, data[0]=0; i < len; i++ ) {
485  data[i] = m_buffer[m_pointer++];
486  }
487  return *this;
488  }
490  StreamBuffer& operator<<(const char *data) {
491  const char* ptr = 0 == data ? "" : data;
492  int len = strlen(ptr)+1;
493  if ( 0 == m_analyzer )
494  writeBytes(ptr, len);
495  else {
496  STREAM_ANALYSE(data, len);
497  }
498  return *this;
499  }
501  StreamBuffer& operator>>(std::string& data) {
502  long i, len;
503  *this >> len;
504  for ( i = 0, data = ""; i < len; i++ ) {
505  data.append( 1, m_buffer[m_pointer++] );
506  }
507  return *this;
508  }
510  StreamBuffer& operator<<(const std::string& data) {
511  if ( 0 == m_analyzer) {
512  const char* ptr = data.c_str();
513  long len = data.length();
514  writeBytes(ptr, len);
515  }
516  else {
517  STREAM_ANALYSE(data, sizeof(data));
518  }
519  return *this;
520  }
527  template<class TYPE> StreamBuffer& operator>>(TYPE*& refpObject) {
528  return getObjectPointer(refpObject, refpObject);
529  }
530 
538  STREAM_ANALYSE(pObject, sizeof(pObject));
539  addContainedLink(pObject, INVALID, INVALID);
540  return *this;
541  }
542 
549  StreamBuffer& operator<<(const DataObject* pObject) {
550  STREAM_ANALYSE(pObject, sizeof(pObject));
551  addIdentifiedLink(pObject, INVALID);
552  return *this;
553  }
554 
561  void serialize(DataIO& ioObject) {
562  ioObject.serialize ( *this );
563  m_pointer = 0;
564  }
565 };
566 
567 #undef STREAM_ANALYSE
568 
571  switch(siz) {
572  case 1:
573  return SINGLE_BYTE;
574  default:
575 #if defined(__alpha) && !defined(__VMS)
576 // return m_swapEnabled ? SWAP : NOSWAP;
577  return NOSWAP;
578 #elif defined(__sun) && defined(__SVR4) && defined(__i386)
579 // return m_swapEnabled ? SWAP : NOSWAP;
580  return NOSWAP;
581 #elif defined(__APPLE__)
582 // return m_swapEnabled ? SWAP : NOSWAP;
583  return SWAP;
584 #elif defined(__linux) && !defined(__powerpc)
585 // return m_swapEnabled ? SWAP : NOSWAP;
586  return NOSWAP;
587 #elif defined(BORLAND) || defined(_WIN32) || defined(WIN32)
588 // return m_swapEnabled ? SWAP : NOSWAP;
589  return NOSWAP;
590 #else
591  return m_swapEnabled ? SWAP : NOSWAP;
592 // return NOSWAP;
593 #endif
594  }
595 }
596 
598 inline void StreamBuffer::swapToBuffer(const void* source, int siz) {
599  char buff[8], *tar, *src = (char*)source;
600  extend (m_pointer+siz);
601  tar = (char*)m_buffer+m_pointer;
602  switch ( swapBuffer(siz) ) {
603  case SINGLE_BYTE:
604  *tar = *src;
605  break;
606  case SWAP:
607 #ifdef __APPLE__
608  for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i];
609 #else
610  ::_swab (src, buff, siz);
611 #endif
612  src = buff;
613  /* no break */
614  case NOSWAP:
615  memcpy(tar, src, siz);
616  break;
617  }
618  m_pointer += siz;
619 }
620 
622 inline void StreamBuffer::swapFromBuffer(void* target, int siz) {
623  char* tar = (char*)target;
624  char* src = (char*)m_buffer+m_pointer;
625  switch ( swapBuffer(siz) ) {
626  case SINGLE_BYTE:
627  *tar = *src;
628  break;
629  case SWAP:
630 #ifdef __APPLE__
631  for(int i = 0,j = siz-1;i<siz;i++,j--) tar[j] = src[i];
632 #else
633  ::_swab (src, tar, siz);
634 #endif
635  break;
636  case NOSWAP:
637  ::memcpy(tar, src, siz);
638  break;
639  }
640  m_pointer += siz;
641 }
642 
643 // Output serialize a vector of items
644 template <class T> inline
645 StreamBuffer& operator << (StreamBuffer& s, const std::vector<T>& v) {
646  s << v.size();
647  for ( typename std::vector<T>::const_iterator i = v.begin(); i != v.end(); i++ ) {
648  s << (*i);
649  }
650  return s;
651 }
652 
653 // Input serialize a vector of items
654 template <class T> inline
655 StreamBuffer& operator >> (StreamBuffer& s, std::vector<T>& v) {
656  long i, len;
657  s >> len;
658  v.clear();
659  for ( i = 0; i < len; i++ ) {
660  T temp;
661  s >> temp;
662  v.push_back(temp);
663  }
664  return s;
665 }
666 
667 // Output serialize a list of items
668 template <class T> inline
669 StreamBuffer& operator << (StreamBuffer& s, const std::list<T>& l) {
670  s << l.size();
671  for ( typename std::list<T>::const_iterator i = l.begin(); i != l.end(); i++ ) {
672  s << (*i);
673  }
674  return s;
675 }
676 
677 // Input serialize a list of items
678 template <class T> inline
680  long i, len;
681  s >> len;
682  l.clear();
683  for ( i = 0; i < len; i++ ) {
684  T temp;
685  s >> temp;
686  l.push_back(temp);
687  }
688  return s;
689 }
690 #endif // GAUDIKERNEL_STREAMBUFFER_H
virtual void load(StreamBuffer &)
Template function to load stream data.
Definition: StreamBuffer.h:65
Writer for standard output streams.
Definition: StreamBuffer.h:96
StreamBuffer(bool do_swap=true)
Standard constructor.
Definition: StreamBuffer.h:207
virtual ~DataIO()
Standard destructor.
Definition: StreamBuffer.h:49
std::ostream * m_stream
Definition: StreamBuffer.h:97
Mode
Streamer mode.
Definition: StreamBuffer.h:114
virtual void serialize(StreamBuffer &stream)
Serialization method: loads/dumps streambuffer content.
Definition: StreamBuffer.h:56
StreamBuffer & operator<<(const char *data)
Streamer to write strings in (char*) format.
Definition: StreamBuffer.h:490
long buffPointer() const
Retrieve current buffer pointer.
Definition: StreamBuffer.h:289
StreamBuffer & operator>>(long &data)
Input Streamer.
Definition: StreamBuffer.h:399
StreamBuffer & operator>>(unsigned short &data)
Input Streamer.
Definition: StreamBuffer.h:432
Ostream(std::ostream &str)
Standard constructor: pass reference to stream object.
Definition: StreamBuffer.h:100
StreamBuffer & operator<<(double data)
Output Streamer.
Definition: StreamBuffer.h:470
std::istream * m_stream
Reference to input stream.
Definition: StreamBuffer.h:77
StreamBuffer & operator<<(float data)
Output Streamer.
Definition: StreamBuffer.h:459
StreamBuffer & operator<<(const DataObject *pObject)
Streamer to write links to identified objects.
Definition: StreamBuffer.h:549
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:40
StreamBuffer & operator>>(float &data)
Input Streamer.
Definition: StreamBuffer.h:465
SwapAction
Data Sawp actions.
Definition: StreamBuffer.h:116
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:174
virtual ~Istream()
Destructor.
Definition: StreamBuffer.h:83
Istream(std::istream &str)
Constructor.
Definition: StreamBuffer.h:80
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:180
virtual void dump(StreamBuffer &)
Template function to save stream data.
Definition: StreamBuffer.h:69
long m_length
Total buffer length.
Definition: StreamBuffer.h:165
IdentifiedLinks & identifiedLinks()
Access to identified links.
Definition: StreamBuffer.h:263
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:168
void extend(long len)
Extend the buffer.
Definition: StreamBuffer.h:240
StreamBuffer & operator<<(const ContainedObject *pObject)
Streamer to write links to contained objects.
Definition: StreamBuffer.h:537
StreamBuffer & operator>>(char *data)
Streamer to read strings in (char*) format.
Definition: StreamBuffer.h:481
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:598
bool isReading() const
Get stream buffer state.
Definition: StreamBuffer.h:280
std::vector< ContainedLink > ContainedLinks
Definition: StreamBuffer.h:149
virtual void load(StreamBuffer &stream)
Data load method.
Definition: StreamBuffer.h:86
StreamBuffer & operator<<(unsigned long data)
Output Streamer.
Definition: StreamBuffer.h:404
StreamBuffer & operator<<(unsigned short data)
Output Streamer.
Definition: StreamBuffer.h:426
Reader for standard input streams.
Definition: StreamBuffer.h:75
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:221
void(* AnalyzeFunction)(const void *data, int siz, const std::type_info &type)
Definition of the buffer analyzer.
Definition: StreamBuffer.h:153
char * data()
write access to data buffer
Definition: StreamBuffer.h:225
void setBuffPointer(long ptr)
Retrieve current buffer pointer.
Definition: StreamBuffer.h:293
StreamBuffer & operator>>(unsigned char &data)
Input Streamer.
Definition: StreamBuffer.h:454
virtual ~Ostream()
Standard Destructor.
Definition: StreamBuffer.h:103
StreamBuffer & operator<<(int data)
Output Streamer.
Definition: StreamBuffer.h:371
StreamBuffer & operator>>(longlong &data)
Input Streamer.
Definition: StreamBuffer.h:366
void reserve(long len)
Reserve buffer space; Default: 16 k buffer size.
Definition: StreamBuffer.h:233
StreamBuffer & operator>>(StreamBuffer &s, std::vector< T > &v)
Definition: StreamBuffer.h:655
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:159
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:339
const IdentifiedLinks & identifiedLinks() const
CONST Access to identified links.
Definition: StreamBuffer.h:267
string type
Definition: gaudirun.py:126
ContainedLinks & containedLinks()
Access to contained links.
Definition: StreamBuffer.h:254
StreamBuffer & operator<<(long data)
Output Streamer.
Definition: StreamBuffer.h:393
StreamBuffer & operator<<(unsigned char data)
Output Streamer.
Definition: StreamBuffer.h:448
StreamBuffer & operator<<(longlong data)
Output Streamer.
Definition: StreamBuffer.h:360
StreamBuffer & operator<<(short data)
Output Streamer.
Definition: StreamBuffer.h:415
StreamBuffer & getObjectPointer(const ContainedObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:198
StreamBuffer & operator<<(const std::string &data)
Streamer to write strings in (std::string) format.
Definition: StreamBuffer.h:510
void badStreamMode()
Throw Exception.
Definition: StreamBuffer.h:52
void setAnalyzer(AnalyzeFunction fun=0)
Enable user analysis function.
Definition: StreamBuffer.h:297
StreamBuffer & operator>>(char &data)
Input Streamer.
Definition: StreamBuffer.h:443
StreamBuffer & operator>>(unsigned long &data)
Input Streamer.
Definition: StreamBuffer.h:410
#define _swab(source, target, radix)
Definition: swab.h:7
void addIdentifiedLink(const DataObject *pObject, long hint)
Definition: StreamBuffer.h:321
dictionary l
Definition: gaudirun.py:365
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
bool isWriting() const
Get stream buffer state.
Definition: StreamBuffer.h:285
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:162
A small base class to handle generic data streaming.
Definition: StreamBuffer.h:43
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:27
string s
Definition: gaudirun.py:210
State
Link state defintions.
Definition: StreamBuffer.h:118
DataIO()
Standard constructor.
Definition: StreamBuffer.h:46
StreamBuffer & writeBytes(const char *str, long len)
Write string to output stream.
Definition: StreamBuffer.h:307
virtual ~StreamBuffer()
Standard destructor.
Definition: StreamBuffer.h:217
virtual void dump(StreamBuffer &stream)
Output dumper.
Definition: StreamBuffer.h:106
void erase()
Reset the buffer.
Definition: StreamBuffer.h:229
StreamBuffer & operator<<(unsigned int data)
Output Streamer.
Definition: StreamBuffer.h:382
StreamBuffer & operator>>(std::string &data)
Streamer to read strings in (std::string) format.
Definition: StreamBuffer.h:501
StreamBuffer & operator<<(char data)
Output Streamer.
Definition: StreamBuffer.h:437
void setMode(Mode m)
Set mode of the stream and allocate buffer.
Definition: StreamBuffer.h:272
StreamBuffer & getObjectPointer(const DataObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:188
StreamBuffer & operator>>(unsigned int &data)
Input Streamer.
Definition: StreamBuffer.h:388
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:177
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
list i
Definition: ana.py:128
SwapAction swapBuffer(int siz) const
Check for byte swapping.
Definition: StreamBuffer.h:570
StreamBuffer & operator>>(double &data)
Input Streamer.
Definition: StreamBuffer.h:476
void addContainedLink(const ContainedObject *pObject, long hint, long link)
Definition: StreamBuffer.h:332
void getContainedLink(ContainedObject *&pObject, long &hint, long &link)
Definition: StreamBuffer.h:325
long size() const
Total buffer size.
Definition: StreamBuffer.h:250
StreamBuffer & operator>>(int &data)
Input Streamer.
Definition: StreamBuffer.h:377
std::vector< IdentifiedLink > IdentifiedLinks
Definition of the identifiable link set.
Definition: StreamBuffer.h:151
void serialize(DataIO &ioObject)
Serialize the buffer using an IO object.
Definition: StreamBuffer.h:561
const ContainedLinks & containedLinks() const
CONST Access to contained links.
Definition: StreamBuffer.h:258
bool m_swapEnabled
Flag indicating swapping.
Definition: StreamBuffer.h:171
StreamBuffer & operator>>(short &data)
Input Streamer.
Definition: StreamBuffer.h:421
void getIdentifiedLink(DataObject *&pObject, long &hint)
Definition: StreamBuffer.h:315
StreamBuffer & operator>>(TYPE *&refpObject)
Streamer to read links to contained or identified objects.
Definition: StreamBuffer.h:527
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:622