47 #include <sys/types.h>
69 extern "C" std::FILE*
fdopen(
int ,
const char *);
73 class fdbuf:
public std::streambuf
103 fdbuf*
open(
const char*, std::ios_base::openmode);
119 if (gptr() == egptr())
123 return traits_type::eof();
126 return traits_type::to_int_type(*gptr());
134 return traits_type::eof();}
136 if (!traits_type::eq_int_type(c, traits_type::eof()))
138 *pptr() = traits_type::to_char_type(c);
142 return traits_type::not_eof(c);
147 std::streamsize size = pptr() - pbase();
180 std::ostream(0),
sb()
182 std::ostream::rdbuf(&
sb);
186 explicit ofdstream(
const char* s, std::ios_base::openmode mode = std::ios_base::out):
187 std::ostream(0),
sb()
189 std::ostream::rdbuf(&
sb);
196 std::ostream(0),
sb(fd)
198 std::ostream::rdbuf(&
sb);
204 return const_cast<fdbuf*
>(&
sb);
212 void open(
const char* s, std::ios_base::openmode mode = std::ios_base::out)
214 if (
rdbuf()->
open(s, mode|std::ios_base::out) == NULL)
232 std::istream(0),
sb()
234 std::istream::rdbuf(&
sb);
238 explicit ifdstream(
const char* s, std::ios_base::openmode mode = std::ios_base::in):
239 std::istream(0),
sb()
241 std::istream::rdbuf(&
sb);
247 std::istream(0),
sb(fd)
249 std::istream::rdbuf(&
sb);
256 return const_cast<fdbuf*
>(&
sb);
264 void open(
const char* s, std::ios_base::openmode mode = std::ios_base::in)
266 if (
rdbuf()->
open(s, mode|std::ios_base::in) == NULL)
284 std::iostream(0),
sb()
286 std::iostream::rdbuf(&
sb);
290 explicit fdstream(
const char* s, std::ios_base::openmode mode):
291 std::iostream(0),
sb()
293 std::iostream::rdbuf(&
sb);
299 std::iostream(0),
sb(fd)
301 std::iostream::rdbuf(&
sb);
308 return const_cast<fdbuf*
>(&
sb);
316 void open(
const char* s, std::ios_base::openmode mode)
ofdstream(int fd)
Definition: fdstream.h:195
void open(const char *s, std::ios_base::openmode mode=std::ios_base::out)
Definition: fdstream.h:212
Definition: fdstream.h:279
fdbuf * close()
Definition: fdstream.cc:87
static std::streamsize const s_bufsiz
Definition: fdstream.h:75
Definition: fdstream.h:73
bool is_open()
Definition: fdstream.h:311
fdbuf * rdbuf() const
Definition: fdstream.h:254
fdbuf sb
Definition: fdstream.h:328
bool is_open() const
Definition: fdstream.h:98
char m_inbuf[s_bufsiz]
Definition: fdstream.h:158
bool m_isopen
Definition: fdstream.h:157
int fd()
Return the underlying file descriptor.
Definition: fdstream.h:110
Definition: fdstream.h:166
fdbuf sb
Definition: fdstream.h:276
const Name std("std")
Miscellaneous parameters.
Definition: nest_names.h:265
Definition: fdstream.h:227
int_type underflow()
Definition: fdstream.h:117
~fdbuf()
Definition: fdstream.h:91
fdbuf()
Definition: fdstream.h:79
void close()
Definition: fdstream.cc:130
C std::FILE * fdopen(int, const char *)
void close()
Definition: fdstream.cc:113
fdstream()
Definition: fdstream.h:283
bool is_open()
Definition: fdstream.h:259
ofdstream()
Definition: fdstream.h:179
std::iostream fdstream
Definition: fdstream.h:38
ifdstream(const char *s, std::ios_base::openmode mode=std::ios_base::in)
Definition: fdstream.h:238
int m_fd
Definition: fdstream.h:156
std::ifstream ifdstream
Definition: fdstream.h:36
fdbuf sb
Definition: fdstream.h:224
std::ofstream ofdstream
Definition: fdstream.h:37
void open(const char *s, std::ios_base::openmode mode=std::ios_base::in)
Definition: fdstream.h:264
void open(const char *s, std::ios_base::openmode mode)
Definition: fdstream.h:316
fdbuf * rdbuf() const
Definition: fdstream.h:202
fdbuf * open(const char *, std::ios_base::openmode)
Definition: fdstream.cc:30
ifdstream(int fd)
Definition: fdstream.h:246
fdbuf(int fd)
Definition: fdstream.h:85
fdbuf * rdbuf() const
Definition: fdstream.h:306
int sync()
Definition: fdstream.h:145
int_type overflow(int_type c)
Definition: fdstream.h:129
bool is_open()
Definition: fdstream.h:207
ifdstream()
Definition: fdstream.h:231
const Name c("c")
Specific to Izhikevich 2003.
Definition: nest_names.h:62
fdstream(const char *s, std::ios_base::openmode mode)
Definition: fdstream.h:290
char m_outbuf[s_bufsiz]
Definition: fdstream.h:159
void close()
Definition: fdstream.cc:122
fdstream(int fd)
Definition: fdstream.h:298
ofdstream(const char *s, std::ios_base::openmode mode=std::ios_base::out)
Definition: fdstream.h:186