BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
basic_binstreambuf< _Ch, _Tr > Class Template Reference

#include <binarystream.h>

+ Inheritance diagram for basic_binstreambuf< _Ch, _Tr >:

Public Member Functions

 basic_binstreambuf (std::streamsize sz)
 
 basic_binstreambuf (const _Ch *p)
 
virtual ~basic_binstreambuf ()
 
_Ch * givebuf ()
 
size_t outbufsize () const
 

Static Public Member Functions

static size_t computesize (size_t s)
 

Detailed Description

template<class _Ch, class _Tr = std::char_traits<_Ch>>
class basic_binstreambuf< _Ch, _Tr >

Definition at line 26 of file binarystream.h.

Constructor & Destructor Documentation

◆ basic_binstreambuf() [1/2]

template<class _Ch , class _Tr = std::char_traits<_Ch>>
basic_binstreambuf< _Ch, _Tr >::basic_binstreambuf ( std::streamsize  sz)
inline

Definition at line 29 of file binarystream.h.

29 : _outbuf(new _Ch[sz + sizeof(std::streamsize)/sizeof(_Ch)]), _inbuf(0) {
30 memcpy(_outbuf, &sz, sizeof(std::streamsize));
31 setp (_outbuf + sizeof(std::streamsize), _outbuf + sz*sizeof(_Ch) + sizeof(unsigned int));
32 }

◆ basic_binstreambuf() [2/2]

template<class _Ch , class _Tr = std::char_traits<_Ch>>
basic_binstreambuf< _Ch, _Tr >::basic_binstreambuf ( const _Ch *  p)
inline

Definition at line 33 of file binarystream.h.

33 : _outbuf(0), _inbuf(0) {
34 std::streamsize sz = *((const std::streamsize*)p);
35 _inbuf = new _Ch[sz];
36 memcpy (_inbuf, p + sizeof(std::streamsize), sz);
37 setg (_inbuf, _inbuf, _inbuf + sz * sizeof(_Ch));
38 }

◆ ~basic_binstreambuf()

template<class _Ch , class _Tr = std::char_traits<_Ch>>
virtual basic_binstreambuf< _Ch, _Tr >::~basic_binstreambuf ( )
inlinevirtual

Definition at line 39 of file binarystream.h.

39{ delete _outbuf; delete _inbuf; }

Member Function Documentation

◆ computesize()

template<class _Ch , class _Tr = std::char_traits<_Ch>>
static size_t basic_binstreambuf< _Ch, _Tr >::computesize ( size_t  s)
inlinestatic

Definition at line 56 of file binarystream.h.

56 {
57 return s + sizeof(std::streamsize);
58 }
XmlRpcServer s
Definition: HelloServer.cpp:11

Referenced by basic_binostream< _Ch, _Tr >::computesize().

◆ givebuf()

template<class _Ch , class _Tr = std::char_traits<_Ch>>
_Ch * basic_binstreambuf< _Ch, _Tr >::givebuf ( )
inline

Definition at line 42 of file binarystream.h.

42 {
43 _Ch* p = _outbuf;
44 _outbuf = 0;
45 return p;
46 }

◆ outbufsize()

template<class _Ch , class _Tr = std::char_traits<_Ch>>
size_t basic_binstreambuf< _Ch, _Tr >::outbufsize ( ) const
inline

Definition at line 50 of file binarystream.h.

50 {
51 return (_outbuf) ? (sizeof(_Ch) * (*(std::streamsize*)_outbuf) + sizeof(std::streamsize)) : 0;
52 }

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