Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::iobuffer Class Reference

#include <iobuffer.hpp>

Inheritance diagram for fc::iobuffer:
Collaboration diagram for fc::iobuffer:

Public Member Functions

 iobuffer (size_t s)
 
size_t size () const
 
size_t pos () const
 
size_t seek (size_t pos)
 
virtual size_t readsome (char *buf, size_t len)
 
char peek () const
 
virtual size_t writesome (const char *buf, size_t len)
 
char * data ()
 
virtual void close ()
 
virtual void flush ()
 

Detailed Description

Definition at line 32 of file iobuffer.hpp.

Constructor & Destructor Documentation

◆ iobuffer()

fc::iobuffer::iobuffer ( size_t s)
inline

Definition at line 35 of file iobuffer.hpp.

36 :_data(s){}
char * s

Member Function Documentation

◆ close()

virtual void fc::iobuffer::close ( )
inlinevirtual

Definition at line 73 of file iobuffer.hpp.

73{}

◆ data()

char * fc::iobuffer::data ( )
inline

Definition at line 71 of file iobuffer.hpp.

71{ return _data.data(); }

◆ flush()

virtual void fc::iobuffer::flush ( )
inlinevirtual

Definition at line 74 of file iobuffer.hpp.

74{}

◆ peek()

char fc::iobuffer::peek ( ) const
inline

This method may block until at least 1 character is available.

Definition at line 57 of file iobuffer.hpp.

58 {
59 if( _pos == _data.size() ) throw fc::eof_exception();
60 return _data[_pos];
61 }

◆ pos()

size_t fc::iobuffer::pos ( ) const
inline

Definition at line 39 of file iobuffer.hpp.

39{ return _pos; }
Here is the caller graph for this function:

◆ readsome()

virtual size_t fc::iobuffer::readsome ( char * buf,
size_t len )
inlinevirtual

Definition at line 45 of file iobuffer.hpp.

46 {
47 auto avail = std::min<size_t>( _data.size()-_pos, len );
48 if( avail == 0 ) throw fc::eof_exception();
49 memcpy( buf, _data.data()+_pos, avail );
50 _pos += avail;
51 return avail;
52 }
size_t len
uint8_t buf[2048]
memcpy((char *) pInfo->slotDescription, s, l)
Here is the call graph for this function:

◆ seek()

size_t fc::iobuffer::seek ( size_t pos)
inline

Definition at line 40 of file iobuffer.hpp.

41 {
42 return _pos = std::min<size_t>(_data.size(),pos);
43 }
size_t pos() const
Definition iobuffer.hpp:39
Here is the call graph for this function:

◆ size()

size_t fc::iobuffer::size ( ) const
inline

Definition at line 38 of file iobuffer.hpp.

38{ return _data.size(); }

◆ writesome()

virtual size_t fc::iobuffer::writesome ( const char * buf,
size_t len )
inlinevirtual

Definition at line 63 of file iobuffer.hpp.

64 {
65 auto avail = std::max<size_t>( _data.size(), _pos + len );
66 _data.resize(avail);
67 memcpy( _data.data()+_pos, buf, len );
68 _pos += avail;
69 return avail;
70 }
Here is the call graph for this function:

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