basix_doc 0.1
|
Definition at line 24 of file file_port.cpp.
file_port_rep | ( | int | kind, |
FILE * | f2, | ||
bool | cf2, | ||
const string & | name2 | ||
) | [inline] |
Definition at line 62 of file file_port.cpp.
: posix_port_rep (kind, fileno (f2)), f (f2), cf (cf2), name (name2), next (-1) {}
~file_port_rep | ( | ) | [inline] |
Definition at line 65 of file file_port.cpp.
{
if (cf) fclose (f); }
port accept | ( | ) | [virtual, inherited] |
Reimplemented in socket_port_rep.
Definition at line 87 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
{ mmerr << "port= " << expression () << lf; ERROR ("socket server port expected"); }
bool busy | ( | ) | [inline, virtual] |
Reimplemented from posix_port_rep.
Definition at line 37 of file file_port.cpp.
References file_port_rep::can_read(), and posix_port_rep::kind.
nat can_read | ( | ) | [inline, virtual] |
Reimplemented from posix_port_rep.
Definition at line 45 of file file_port.cpp.
References posix_port_rep::kind.
Referenced by file_port_rep::busy().
{ if (next != -1) return 1; if (this->kind == 1 || feof (f) != 0) return 0; next= fgetc (f); if (next != -1) return 1; return 0; }
nat can_write | ( | ) | [inline, virtual] |
Reimplemented from posix_port_rep.
Definition at line 41 of file file_port.cpp.
References posix_port_rep::kind.
Reimplemented in composite_port_rep, and formatting_port_rep.
Definition at line 93 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
{ mmerr << "port= " << expression () << lf; ERROR ("composite port expected"); }
bool error_flag | ( | ) | [virtual, inherited] |
Reimplemented in composite_port_rep, formatting_port_rep, and error_port_rep.
Definition at line 38 of file port.cpp.
{ return false; }
string error_message | ( | ) | [virtual, inherited] |
Reimplemented in composite_port_rep, formatting_port_rep, and error_port_rep.
Definition at line 43 of file port.cpp.
{ return ""; }
syntactic expression | ( | ) | const [inline, virtual] |
Implements port_rep.
Definition at line 31 of file file_port.cpp.
References posix_port_rep::kind, and mmx::syn().
void feed | ( | ) | [virtual, inherited] |
Reimplemented in socket_port_rep.
Definition at line 62 of file posix_port.cpp.
References posix_port_rep::alive, posix_port_rep::buffer, ERROR, posix_port_rep::fd, posix_port_rep::read(), and posix_port_rep::wait().
Referenced by posix_port_rep::busy(), posix_port_rep::can_read(), and posix_port_rep::read().
void flush | ( | ) | [inline, virtual] |
void format | ( | const print_format & | fm | ) | [virtual, inherited] |
Reimplemented in formatting_port_rep.
Definition at line 99 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
{ mmerr << "port= " << expression () << lf; ERROR ("formatting port expected"); }
virtual bool is_input_port | ( | ) | [inline, virtual, inherited] |
Reimplemented from port_rep.
Definition at line 40 of file posix_port.hpp.
References posix_port_rep::kind.
{ return (kind & 2) != 0; }
virtual bool is_output_port | ( | ) | [inline, virtual, inherited] |
Reimplemented from port_rep.
Definition at line 39 of file posix_port.hpp.
References posix_port_rep::kind.
{ return (kind & 1) != 0; }
void read | ( | char * | s, |
nat | n | ||
) | [inline, virtual] |
void send | ( | const char * | s, |
nat | n | ||
) | [virtual, inherited] |
Reimplemented in socket_port_rep.
Definition at line 54 of file posix_port.cpp.
References posix_port_rep::alive, posix_port_rep::fd, n, s, and posix_port_rep::write().
Referenced by posix_port_rep::write().
bool wait | ( | int | msecs | ) | [virtual, inherited] |
Reimplemented from port_rep.
Definition at line 77 of file posix_port.cpp.
References posix_port_rep::alive, posix_port_rep::fd, and posix_port_rep::kind.
Referenced by socket_port_rep::accept(), socket_port_rep::feed(), and posix_port_rep::feed().
{ //mmout << "Wait " << msecs << " ms on " << expression () << "\n"; if ((kind & 2) == 0 || !alive) return false; fd_set in_fds; FD_ZERO (&in_fds); FD_SET (fd, &in_fds); nat nr; struct timeval tv; tv.tv_sec = msecs / 1000; tv.tv_usec = 1000 * (msecs % 1000); if (msecs < 0) nr= select (fd + 1, &in_fds, NULL, NULL, NULL); else nr= select (fd + 1, &in_fds, NULL, NULL, &tv); //mmout << "Received " << nr << " on " << fd << "\n"; return nr > 0; }
void write | ( | const char * | s, |
nat | n | ||
) | [inline, virtual] |
bool alive [protected, inherited] |
Definition at line 32 of file posix_port.hpp.
Referenced by socket_port_rep::accept(), posix_port_rep::busy(), posix_port_rep::can_write(), socket_port_rep::feed(), posix_port_rep::feed(), socket_port_rep::send(), posix_port_rep::send(), and posix_port_rep::wait().
Definition at line 30 of file posix_port.hpp.
Referenced by posix_port_rep::busy(), posix_port_rep::can_read(), socket_port_rep::feed(), posix_port_rep::feed(), and posix_port_rep::read().
int fd [protected, inherited] |
Definition at line 29 of file posix_port.hpp.
Referenced by socket_port_rep::accept(), socket_port_rep::feed(), posix_port_rep::feed(), posix_port_rep::posix_port_rep(), socket_port_rep::send(), posix_port_rep::send(), posix_port_rep::wait(), pipe_port_rep::~pipe_port_rep(), posix_port_rep::~posix_port_rep(), and socket_port_rep::~socket_port_rep().
int kind [protected, inherited] |
Definition at line 28 of file posix_port.hpp.
Referenced by file_port_rep::busy(), file_port_rep::can_read(), file_port_rep::can_write(), file_port_rep::expression(), posix_port_rep::is_input_port(), posix_port_rep::is_output_port(), posix_port_rep::posix_port_rep(), posix_port_rep::wait(), and posix_port_rep::~posix_port_rep().
Definition at line 31 of file posix_port.hpp.
Referenced by posix_port_rep::busy(), posix_port_rep::can_read(), socket_port_rep::feed(), and posix_port_rep::read().