| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
41 class StreamBuffer /* : public std::string */ {
42 public:
44 class DataIO {
45 public:
47 DataIO() = default;
49 virtual ~DataIO() = default;
51 void badStreamMode() {
52 throw("Not acceptable stream mode!");
53 }
55 virtual void serialize(StreamBuffer& stream) {
56 if (stream.isReading())
57 load(stream);
58 else if (stream.isWriting())
59 dump(stream);
60 else
61 badStreamMode();
62 }
64 virtual void load(StreamBuffer&) {
65 badStreamMode();
66 }
68 virtual void dump(StreamBuffer&) {
69 badStreamMode();
70 }
71 };
72
74 class Istream : public DataIO {
76 std::istream* m_stream;
77 public:
79 Istream(std::istream& str) : m_stream(&str) {
80 }
82 ~Istream() override = default;
83
85 void load(StreamBuffer& stream) override {
86 // Generic implementation for istreams:
87 int len;
88 (*m_stream) >> len;
89 stream.erase();
90 stream.reserve(len);
91 m_stream->read(stream.data(),len);
92 }
93 };
95 class Ostream : public DataIO {
96 std::ostream* m_stream;
97 public:
99 Ostream(std::ostream& str) : m_stream(&str) {
100 }
102 virtual ~Ostream() = default;
103
105 void dump(StreamBuffer& stream) override {
106 // Generic implementation for ostreams:
107 (*m_stream) << stream.buffPointer();
108 m_stream->write(stream.data(), stream.buffPointer());
109 }
110 };
111 public:
113 enum Mode {UNINITIALIZED, READING, WRITING};
115 enum SwapAction {SINGLE_BYTE, SWAP, NOSWAP};
117 enum State {INVALID=-1, VALID };
119 class ContainedLink {
120 public:
121 ContainedObject* first;
122 long second;
123 long third;
124 ContainedLink() : first(0), second(INVALID), third(INVALID) {
125 }
126 ContainedLink(const ContainedLink& copy)
127 : first(copy.first), second(copy.second), third(copy.third) {
128 }
129 ContainedLink(ContainedObject* pObj, long hint, long link)
130 : first(pObj), second(hint), third(link) {
131 }
132 };
134 class IdentifiedLink {
135 public:
136 DataObject* first = nullptr;
137 long second = INVALID;
138 IdentifiedLink() = default;
139 IdentifiedLink(const IdentifiedLink& copy) = default;
140 IdentifiedLink(DataObject* pObj, long hint)
141 : first(pObj), second(hint) {
142 }
143 };
144
145 typedef std::vector<ContainedLink> ContainedLinks;
147 typedef std::vector<IdentifiedLink> IdentifiedLinks;
149 typedef void (*AnalyzeFunction)(const void* data, int siz, const std::type_info& type);
151 friend class DataObject;
152
153 protected:
155 Mode m_mode = UNINITIALIZED;
156
158 mutable long m_pointer = 0;
159
161 mutable long m_length = 0;
162
164 mutable char* m_buffer = nullptr;
165
167 bool m_swapEnabled = true;
168
170 mutable ContainedLinks m_containedLinks;
171
173 mutable IdentifiedLinks m_identifiedLinks;
174
176 AnalyzeFunction m_analyzer = nullptr;
177
179 SwapAction swapBuffer(int siz) const;
180
184 template <class TYPE> StreamBuffer& getObjectPointer(const DataObject* /*pObject*/, TYPE*& refpObject) {
185 IdentifiedLink& link = m_identifiedLinks.back();
186 DataObject* pObj = link.first;
187 m_identifiedLinks.pop_back();
188 refpObject = dynamic_cast<TYPE*>(pObj);
189 return *this;
190 }
194 template <class TYPE> StreamBuffer& getObjectPointer(const ContainedObject* /*pObject*/, TYPE*& refpObject) {
195 ContainedLink& link = m_containedLinks.back();
196 ContainedObject* pObj = link.first;
197 m_containedLinks.pop_back();
198 refpObject = dynamic_cast<TYPE*>(pObj);
199 return *this;
200 }
201 public:
203 StreamBuffer(bool do_swap=true) :
204 m_swapEnabled(do_swap) {
205 }
207 virtual ~StreamBuffer() {
208 ::free( m_buffer );
209 }
211 const char* data() const {
212 return m_buffer;
213 }
215 char* data() {
216 return m_buffer;
217 }
219 void erase() {
220 m_pointer = 0;
221 }
223 char* adopt() const {
224 char* ptr = m_buffer;
225 m_containedLinks.erase (m_containedLinks.begin(), m_containedLinks.end());
226 m_identifiedLinks.erase(m_identifiedLinks.begin(),m_identifiedLinks.end());
227 m_buffer = NULL; //char *
228 m_pointer = 0; // long
229 m_length = 0; // long
230 return ptr;
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 }
254 ContainedLinks& containedLinks() {
255 return m_containedLinks;
256 }
258 const ContainedLinks& containedLinks() const {
259 return m_containedLinks;
260 }
261
263 IdentifiedLinks& identifiedLinks() {
264 return m_identifiedLinks;
265 }
267 const IdentifiedLinks& identifiedLinks() const {
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());
276 m_identifiedLinks.erase(m_identifiedLinks.begin(),m_identifiedLinks.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 }
297 void setAnalyzer(AnalyzeFunction fun=nullptr) {
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 std::copy_n(str,len, data()+buffPointer());
311 m_pointer += len;
312 return *this;
313 }
314
315 void getIdentifiedLink (DataObject*& pObject, long& hint) {
316 IdentifiedLink& l = m_identifiedLinks.back();
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
360 StreamBuffer& operator<<(longlong data) {
361 swapToBuffer(&data, sizeof(data));
362 STREAM_ANALYSE(data, sizeof(data));
363 return *this;
364 }
366 StreamBuffer& operator>>(longlong & data) {
367 swapFromBuffer(&data, sizeof(data));
368 return *this;
369 }
371 StreamBuffer& operator<<(int data) {
372 swapToBuffer(&data, sizeof(data));
373 STREAM_ANALYSE(data, sizeof(data));
374 return *this;
375 }
377 StreamBuffer& operator>>(int & data) {
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 }
393 StreamBuffer& operator<<(long data) {
394 swapToBuffer(&data, sizeof(data));
395 STREAM_ANALYSE(data, sizeof(data));
396 return *this;
397 }
399 StreamBuffer& operator>>(long & data) {
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 }
415 StreamBuffer& operator<<(short data) {
416 swapToBuffer(&data, sizeof(data));
417 STREAM_ANALYSE(data, sizeof(data));
418 return *this;
419 }
421 StreamBuffer& operator>>(short & data) {
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 }
437 StreamBuffer& operator<<(char data) {
438 swapToBuffer(&data, sizeof(data));
439 STREAM_ANALYSE(data, sizeof(data));
440 return *this;
441 }
443 StreamBuffer& operator>>(char & data) {
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 }
459 StreamBuffer& operator<<(float data) {
460 swapToBuffer(&data, sizeof(data));
461 STREAM_ANALYSE(data, sizeof(data));
462 return *this;
463 }
465 StreamBuffer& operator>>(float & data) {
466 swapFromBuffer(&data, sizeof(data));
467 return *this;
468 }
470 StreamBuffer& operator<<(double data) {
471 swapToBuffer(&data, sizeof(data));
472 STREAM_ANALYSE(data, sizeof(data));
473 return *this;
474 }
476 StreamBuffer& operator>>(double & data) {
477 swapFromBuffer(&data, sizeof(data));
478 return *this;
479 }
481 StreamBuffer& operator>>(char* data) {
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
537 StreamBuffer& operator<<(const ContainedObject* pObject) {
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
570 inline StreamBuffer::SwapAction StreamBuffer::swapBuffer(int siz) const {
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 std::copy_n(src,siz,tar);
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 std::copy_n(src,siz,tar);
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 ( const auto& i : v ) s << i;
648 return s;
649 }
650
651 // Input serialize a vector of items
652 template <class T> inline
653 StreamBuffer& operator >> (StreamBuffer& s, std::vector<T>& v) {
654 long i, len;
655 s >> len;
656 v.clear();
657 for ( i = 0; i < len; i++ ) {
658 T temp;
659 s >> temp;
660 v.push_back(temp);
661 }
662 return s;
663 }
664
665 // Output serialize a list of items
666 template <class T> inline
667 StreamBuffer& operator << (StreamBuffer& s, const std::list<T>& l) {
668 s << l.size();
669 for ( const auto& i : l ) s << i ;
670 return s;
671 }
672
673 // Input serialize a list of items
674 template <class T> inline
675 StreamBuffer& operator >> (StreamBuffer& s, std::list<T>& l) {
676 long len;
677 s >> len;
678 l.clear();
679 for ( long i = 0; i < len; i++ ) {
680 T temp;
681 s >> temp;
682 l.push_back(temp);
683 }
684 return s;
685 }
686 #endif // GAUDIKERNEL_STREAMBUFFER_H
StreamBuffer::DataIO::load
virtual void load(StreamBuffer &)
Template function to load stream data.
Definition: StreamBuffer.h:64
StreamBuffer::ContainedLink
Definition of the contained link set.
Definition: StreamBuffer.h:119
StreamBuffer::Ostream
Writer for standard output streams.
Definition: StreamBuffer.h:95
StreamBuffer::StreamBuffer
StreamBuffer(bool do_swap=true)
Standard constructor.
Definition: StreamBuffer.h:203
StreamBuffer::Ostream::m_stream
std::ostream * m_stream
Definition: StreamBuffer.h:96
StreamBuffer::Mode
Mode
Streamer mode.
Definition: StreamBuffer.h:113
StreamBuffer::DataIO::serialize
virtual void serialize(StreamBuffer &stream)
Serialization method: loads/dumps streambuffer content.
Definition: StreamBuffer.h:55
StreamBuffer::operator<<
StreamBuffer & operator<<(const char *data)
Streamer to write strings in (char*) format.
Definition: StreamBuffer.h:490
Kernel.h
StreamBuffer::buffPointer
long buffPointer() const
Retrieve current buffer pointer.
Definition: StreamBuffer.h:289
StreamBuffer::operator>>
StreamBuffer & operator>>(long &data)
Input Streamer.
Definition: StreamBuffer.h:399
StreamBuffer::operator>>
StreamBuffer & operator>>(unsigned short &data)
Input Streamer.
Definition: StreamBuffer.h:432
StreamBuffer::Ostream::Ostream
Ostream(std::ostream &str)
Standard constructor: pass reference to stream object.
Definition: StreamBuffer.h:99
StreamBuffer::operator<<
StreamBuffer & operator<<(double data)
Output Streamer.
Definition: StreamBuffer.h:470
StreamBuffer::Istream::m_stream
std::istream * m_stream
Reference to input stream.
Definition: StreamBuffer.h:76
StreamBuffer::DataIO::DataIO
DataIO()=default
Standard constructor.
StreamBuffer::SWAP
Definition: StreamBuffer.h:115
StreamBuffer::operator<<
StreamBuffer & operator<<(float data)
Output Streamer.
Definition: StreamBuffer.h:459
StreamBuffer::operator<<
StreamBuffer & operator<<(const DataObject *pObject)
Streamer to write links to identified objects.
Definition: StreamBuffer.h:549
StreamBuffer
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:41
StreamBuffer::operator>>
StreamBuffer & operator>>(float &data)
Input Streamer.
Definition: StreamBuffer.h:465
StreamBuffer::SwapAction
SwapAction
Data Sawp actions.
Definition: StreamBuffer.h:115
StreamBuffer::m_containedLinks
ContainedLinks m_containedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:170
StreamBuffer::ContainedLink::ContainedLink
ContainedLink()
Definition: StreamBuffer.h:124
StreamBuffer::ContainedLink::ContainedLink
ContainedLink(const ContainedLink &copy)
Definition: StreamBuffer.h:126
StreamBuffer::Istream::Istream
Istream(std::istream &str)
Constructor.
Definition: StreamBuffer.h:79
StreamBuffer::m_analyzer
AnalyzeFunction m_analyzer
Hook function for analysis of data to the stream.
Definition: StreamBuffer.h:176
StreamBuffer::DataIO::dump
virtual void dump(StreamBuffer &)
Template function to save stream data.
Definition: StreamBuffer.h:68
StreamBuffer::m_length
long m_length
Total buffer length.
Definition: StreamBuffer.h:161
StreamBuffer::identifiedLinks
IdentifiedLinks & identifiedLinks()
Access to identified links.
Definition: StreamBuffer.h:263
StreamBuffer::m_buffer
char * m_buffer
Pointer to heap buffer.
Definition: StreamBuffer.h:164
Gaudi::Functional::void
class MergingTransformer< Out(const vector_of_const_< In > void
Definition: MergingTransformer.h:19
StreamBuffer::extend
void extend(long len)
Extend the buffer.
Definition: StreamBuffer.h:240
StreamBuffer::operator<<
StreamBuffer & operator<<(const ContainedObject *pObject)
Streamer to write links to contained objects.
Definition: StreamBuffer.h:537
StreamBuffer::operator>>
StreamBuffer & operator>>(char *data)
Streamer to read strings in (char*) format.
Definition: StreamBuffer.h:481
StreamBuffer::swapToBuffer
void swapToBuffer(const void *source, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:598
std::vector::end
T end(T...args)
StreamBuffer::isReading
bool isReading() const
Get stream buffer state.
Definition: StreamBuffer.h:280
StreamBuffer::ContainedLinks
std::vector< ContainedLink > ContainedLinks
Definition: StreamBuffer.h:145
StreamBuffer::operator<<
StreamBuffer & operator<<(unsigned long data)
Output Streamer.
Definition: StreamBuffer.h:404
std::copy_n
T copy_n(T...args)
StreamBuffer::READING
Definition: StreamBuffer.h:113
StreamBuffer::operator<<
StreamBuffer & operator<<(unsigned short data)
Output Streamer.
Definition: StreamBuffer.h:426
StreamBuffer::Istream
Reader for standard input streams.
Definition: StreamBuffer.h:74
StreamBuffer::ContainedLink::first
ContainedObject * first
Definition: StreamBuffer.h:121
StreamBuffer::data
const char * data() const
Read access to data buffer.
Definition: StreamBuffer.h:211
StreamBuffer::IdentifiedLink::second
long second
Definition: StreamBuffer.h:137
std::istream
STL class.
StreamBuffer::ContainedLink::third
long third
Definition: StreamBuffer.h:123
StreamBuffer::setAnalyzer
void setAnalyzer(AnalyzeFunction fun=nullptr)
Enable user analysis function.
Definition: StreamBuffer.h:297
StreamBuffer::data
char * data()
write access to data buffer
Definition: StreamBuffer.h:215
StreamBuffer::setBuffPointer
void setBuffPointer(long ptr)
Retrieve current buffer pointer.
Definition: StreamBuffer.h:293
std::type_info
StreamBuffer::operator>>
StreamBuffer & operator>>(unsigned char &data)
Input Streamer.
Definition: StreamBuffer.h:454
Gaudi::Units::second
constexpr double second
Definition: SystemOfUnits.h:122
std::string
STL class.
StreamBuffer::operator<<
StreamBuffer & operator<<(int data)
Output Streamer.
Definition: StreamBuffer.h:371
StreamBuffer::operator>>
StreamBuffer & operator>>(longlong &data)
Input Streamer.
Definition: StreamBuffer.h:366
std::vector::push_back
T push_back(T...args)
StreamBuffer::reserve
void reserve(long len)
Reserve buffer space; Default: 16 k buffer size.
Definition: StreamBuffer.h:233
StreamBuffer::m_mode
Mode m_mode
Boolean indicating wether the stream is in read or write mode.
Definition: StreamBuffer.h:155
STREAM_ANALYSE
#define STREAM_ANALYSE(data, len)
Definition: StreamBuffer.h:339
StreamBuffer::identifiedLinks
const IdentifiedLinks & identifiedLinks() const
CONST Access to identified links.
Definition: StreamBuffer.h:267
StreamBuffer::containedLinks
ContainedLinks & containedLinks()
Access to contained links.
Definition: StreamBuffer.h:254
__longlong
Definition: Kernel.h:56
StreamBuffer::operator<<
StreamBuffer & operator<<(long data)
Output Streamer.
Definition: StreamBuffer.h:393
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:93
std::string::append
T append(T...args)
gaudirun.type
type
Definition: gaudirun.py:125
StreamBuffer::operator<<
StreamBuffer & operator<<(unsigned char data)
Output Streamer.
Definition: StreamBuffer.h:448
std::vector::erase
T erase(T...args)
StreamBuffer::SINGLE_BYTE
Definition: StreamBuffer.h:115
std::vector::pop_back
T pop_back(T...args)
StreamBuffer::operator<<
StreamBuffer & operator<<(longlong data)
Output Streamer.
Definition: StreamBuffer.h:360
StreamBuffer::operator<<
StreamBuffer & operator<<(short data)
Output Streamer.
Definition: StreamBuffer.h:415
StreamBuffer::getObjectPointer
StreamBuffer & getObjectPointer(const ContainedObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:194
StreamBuffer::ContainedLink::ContainedLink
ContainedLink(ContainedObject *pObj, long hint, long link)
Definition: StreamBuffer.h:129
StreamBuffer::operator<<
StreamBuffer & operator<<(const std::string &data)
Streamer to write strings in (std::string) format.
Definition: StreamBuffer.h:510
StreamBuffer::DataIO::badStreamMode
void badStreamMode()
Throw Exception.
Definition: StreamBuffer.h:51
std::vector::clear
T clear(T...args)
StreamBuffer::Istream::load
void load(StreamBuffer &stream) override
Data load method.
Definition: StreamBuffer.h:85
std::list
STL class.
StreamBuffer::operator>>
StreamBuffer & operator>>(char &data)
Input Streamer.
Definition: StreamBuffer.h:443
StreamBuffer::IdentifiedLink::first
DataObject * first
Definition: StreamBuffer.h:136
StreamBuffer::operator>>
StreamBuffer & operator>>(unsigned long &data)
Input Streamer.
Definition: StreamBuffer.h:410
_swab
#define _swab(source, target, radix)
Definition: swab.h:7
StreamBuffer::UNINITIALIZED
Definition: StreamBuffer.h:113
StreamBuffer::addIdentifiedLink
void addIdentifiedLink(const DataObject *pObject, long hint)
Definition: StreamBuffer.h:321
gaudirun.l
dictionary l
Definition: gaudirun.py:421
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:29
StreamBuffer::DataIO::~DataIO
virtual ~DataIO()=default
Standard destructor.
std::string::length
T length(T...args)
StreamBuffer::Ostream::dump
void dump(StreamBuffer &stream) override
Output dumper.
Definition: StreamBuffer.h:105
std::vector< ContainedLink >
StreamBuffer::isWriting
bool isWriting() const
Get stream buffer state.
Definition: StreamBuffer.h:285
StreamBuffer::m_pointer
long m_pointer
Current buffer pointer.
Definition: StreamBuffer.h:158
std::vector::begin
T begin(T...args)
std::ostream::write
T write(T...args)
StreamBuffer::DataIO
A small base class to handle generic data streaming.
Definition: StreamBuffer.h:44
std::string::c_str
T c_str(T...args)
fun
double fun(const std::vector< double > &x)
Definition: PFuncTest.cpp:26
std::vector::back
T back(T...args)
gaudirun.s
string s
Definition: gaudirun.py:245
StreamBuffer::State
State
Link state defintions.
Definition: StreamBuffer.h:117
std::istream::read
T read(T...args)
StreamBuffer::WRITING
Definition: StreamBuffer.h:113
StreamBuffer::writeBytes
StreamBuffer & writeBytes(const char *str, long len)
Write string to output stream.
Definition: StreamBuffer.h:307
StreamBuffer::~StreamBuffer
virtual ~StreamBuffer()
Standard destructor.
Definition: StreamBuffer.h:207
StreamBuffer::erase
void erase()
Reset the buffer.
Definition: StreamBuffer.h:219
StreamBuffer::operator<<
StreamBuffer & operator<<(unsigned int data)
Output Streamer.
Definition: StreamBuffer.h:382
StreamBuffer::AnalyzeFunction
void(* AnalyzeFunction)(const void *data, int siz, const std::type_info &type)
Definition of the buffer analyzer.
Definition: StreamBuffer.h:149
StreamBuffer::VALID
Definition: StreamBuffer.h:117
StreamBuffer::operator>>
StreamBuffer & operator>>(std::string &data)
Streamer to read strings in (std::string) format.
Definition: StreamBuffer.h:501
StreamBuffer::INVALID
Definition: StreamBuffer.h:117
StreamBuffer::IdentifiedLink
Definition of the contained link set.
Definition: StreamBuffer.h:134
StreamBuffer::operator<<
StreamBuffer & operator<<(char data)
Output Streamer.
Definition: StreamBuffer.h:437
StreamBuffer::setMode
void setMode(Mode m)
Set mode of the stream and allocate buffer.
Definition: StreamBuffer.h:272
StreamBuffer::NOSWAP
Definition: StreamBuffer.h:115
StreamBuffer::adopt
char * adopt() const
Remove the data buffer and pass it to client. It&#39;s the client responsability to free the memory...
Definition: StreamBuffer.h:223
StreamBuffer::getObjectPointer
StreamBuffer & getObjectPointer(const DataObject *, TYPE *&refpObject)
Helper to distinguish between identified pointers and contained pointers.
Definition: StreamBuffer.h:184
StreamBuffer::ContainedLink::second
long second
Definition: StreamBuffer.h:122
StreamBuffer::operator>>
StreamBuffer & operator>>(unsigned int &data)
Input Streamer.
Definition: StreamBuffer.h:388
StreamBuffer::m_identifiedLinks
IdentifiedLinks m_identifiedLinks
Container with links to contained objects.
Definition: StreamBuffer.h:173
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
std::ostream
STL class.
StreamBuffer::swapBuffer
SwapAction swapBuffer(int siz) const
Check for byte swapping.
Definition: StreamBuffer.h:570
StreamBuffer::operator>>
StreamBuffer & operator>>(double &data)
Input Streamer.
Definition: StreamBuffer.h:476
StreamBuffer::addContainedLink
void addContainedLink(const ContainedObject *pObject, long hint, long link)
Definition: StreamBuffer.h:332
StreamBuffer::getContainedLink
void getContainedLink(ContainedObject *&pObject, long &hint, long &link)
Definition: StreamBuffer.h:325
StreamBuffer::size
long size() const
Total buffer size.
Definition: StreamBuffer.h:250
swab.h
StreamBuffer::operator>>
StreamBuffer & operator>>(int &data)
Input Streamer.
Definition: StreamBuffer.h:377
StreamBuffer::IdentifiedLinks
std::vector< IdentifiedLink > IdentifiedLinks
Definition of the identifiable link set.
Definition: StreamBuffer.h:147
StreamBuffer::serialize
void serialize(DataIO &ioObject)
Serialize the buffer using an IO object.
Definition: StreamBuffer.h:561
StreamBuffer::containedLinks
const ContainedLinks & containedLinks() const
CONST Access to contained links.
Definition: StreamBuffer.h:258
StreamBuffer::m_swapEnabled
bool m_swapEnabled
Flag indicating swapping.
Definition: StreamBuffer.h:167
StreamBuffer::operator>>
StreamBuffer & operator>>(short &data)
Input Streamer.
Definition: StreamBuffer.h:421
StreamBuffer::getIdentifiedLink
void getIdentifiedLink(DataObject *&pObject, long &hint)
Definition: StreamBuffer.h:315
StreamBuffer::operator>>
StreamBuffer & operator>>(TYPE *&refpObject)
Streamer to read links to contained or identified objects.
Definition: StreamBuffer.h:527
StreamBuffer::IdentifiedLink::IdentifiedLink
IdentifiedLink(DataObject *pObj, long hint)
Definition: StreamBuffer.h:140
StreamBuffer::swapFromBuffer
void swapFromBuffer(void *target, int siz)
Swap buffers: int, long, short, float and double.
Definition: StreamBuffer.h:622