fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::fdinbuf Class Reference

Create a streambuf from an open file descriptor. More...

#include <f8utils.hpp>

Inheritance diagram for FIX8::fdinbuf:

Public Member Functions

 fdinbuf (int infd)
 

Protected Member Functions

virtual int_type underflow ()
 

Protected Attributes

char _buffer [_buffer_size]
 
int _fd
 

Private Types

enum  { _back_limit = 4, _buffer_size = 16 }
 

Detailed Description

Create a streambuf from an open file descriptor.

Definition at line 1136 of file f8utils.hpp.

Member Enumeration Documentation

anonymous enum
private
Enumerator
_back_limit 
_buffer_size 

Definition at line 1138 of file f8utils.hpp.

Constructor & Destructor Documentation

FIX8::fdinbuf::fdinbuf ( int  infd)
inline

Definition at line 1164 of file f8utils.hpp.

References _back_limit.

Member Function Documentation

virtual int_type FIX8::fdinbuf::underflow ( )
inlineprotectedvirtual

Definition at line 1144 of file f8utils.hpp.

References _back_limit, and _buffer_size.

1145  {
1146  if (gptr() < egptr())
1147  return *gptr();
1148  int put_back_cnt(gptr() - eback());
1149  if (put_back_cnt > _back_limit)
1150  put_back_cnt = _back_limit;
1151  memcpy(_buffer + (_back_limit - put_back_cnt), gptr() - put_back_cnt, put_back_cnt);
1152 #ifdef _MSC_VER
1153  int num_read(_read (_fd, _buffer + _back_limit, _buffer_size - _back_limit));
1154 #else
1155  int num_read(read (_fd, _buffer + _back_limit, _buffer_size - _back_limit));
1156 #endif
1157  if (num_read <= 0)
1158  return -1;
1159  setg(_buffer + (_back_limit - put_back_cnt), _buffer + _back_limit, _buffer + _back_limit + num_read);
1160  return *gptr();
1161  }
char _buffer[_buffer_size]
Definition: f8utils.hpp:1141

Member Data Documentation

char FIX8::fdinbuf::_buffer[_buffer_size]
protected

Definition at line 1141 of file f8utils.hpp.

int FIX8::fdinbuf::_fd
protected

Definition at line 1142 of file f8utils.hpp.


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