CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ext::basic_omemstream< Item_t, Traits_t, Allocator_t > Class Template Reference

#include <memstream.h>

Inheritance diagram for ext::basic_omemstream< Item_t, Traits_t, Allocator_t >:

Public Types

typedef Traits_t::char_type char_type
 
typedef Traits_t::int_type int_type
 
typedef Traits_t traits_type
 

Public Member Functions

 basic_omemstream (char_type *buf, size_t size)
 
char_typebegin () const
 
bool empty () const
 
char_typeend () const
 
size_t size () const
 

Private Member Functions

int_type overflow (int_type c) override
 
int sync () override
 
std::streamsize xsputn (char_type const *data, std::streamsize size) override
 

Private Attributes

char_typebuffer
 
char_typecur
 
char_typelast
 

Detailed Description

template<typename Item_t, typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
class ext::basic_omemstream< Item_t, Traits_t, Allocator_t >

Definition at line 23 of file memstream.h.

Member Typedef Documentation

template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
typedef Traits_t::char_type ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::char_type

Definition at line 26 of file memstream.h.

template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
typedef Traits_t::int_type ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::int_type

Definition at line 27 of file memstream.h.

template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
typedef Traits_t ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::traits_type

Definition at line 28 of file memstream.h.

Constructor & Destructor Documentation

template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::basic_omemstream ( char_type buf,
size_t  size 
)
inline

Definition at line 30 of file memstream.h.

30  :
31  std::basic_ostream<Item_t, Traits_t>(this),
32  buffer(buf), cur(buf), last(buf + size)
33  { this->exceptions(std::ios_base::badbit); }
char_type * buffer
Definition: memstream.h:61
char_type * cur
Definition: memstream.h:61
char_type * last
Definition: memstream.h:61
size_t size() const
Definition: memstream.h:37

Member Function Documentation

template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
char_type* ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::begin ( void  ) const
inline

Definition at line 35 of file memstream.h.

References ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::buffer.

35 { return buffer; }
char_type * buffer
Definition: memstream.h:61
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
bool ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::empty ( void  ) const
inline
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
char_type* ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::end ( void  ) const
inline

Definition at line 36 of file memstream.h.

References ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::cur.

36 { return cur; }
char_type * cur
Definition: memstream.h:61
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
int_type ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::overflow ( int_type  c)
inlineoverrideprivate

Definition at line 48 of file memstream.h.

References EnergyCorrector::c, protons_cff::t, and ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::xsputn().

49  {
50  if (!traits_type::eq_int_type(c, traits_type::eof())) {
51  char_type t = traits_type::to_char_type(c);
52  if (xsputn(&t, 1) < 1)
53  return traits_type::eof();
54  }
55 
56  return c;
57  }
Traits_t::char_type char_type
Definition: memstream.h:26
std::streamsize xsputn(char_type const *data, std::streamsize size) override
Definition: memstream.h:41
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
size_t ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::size ( void  ) const
inline
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
int ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::sync ( )
inlineoverrideprivate

Definition at line 59 of file memstream.h.

59 { return 0; }
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
std::streamsize ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::xsputn ( char_type const *  data,
std::streamsize  size 
)
inlineoverrideprivate

Definition at line 41 of file memstream.h.

References popcon2dropbox::copy(), ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::cur, ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::last, gen::n, and ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::size().

Referenced by ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::overflow().

41  {
42  size_t n = std::min<size_t>(last - cur, size);
43  traits_type::copy(cur, data, n);
44  cur += n;
45  return n;
46  }
def copy(args, dbName)
char_type * cur
Definition: memstream.h:61
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
char_type * last
Definition: memstream.h:61
size_t size() const
Definition: memstream.h:37

Member Data Documentation

template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
char_type* ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::buffer
private
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
char_type * ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::cur
private
template<typename Item_t , typename Traits_t = std::char_traits<Item_t>, typename Allocator_t = std::allocator<Item_t>>
char_type * ext::basic_omemstream< Item_t, Traits_t, Allocator_t >::last
private