Definition at line 39 of file pipe_port.cpp.
Definition at line 50 of file pipe_port.cpp.
00051 : 00052 posix_port_rep (kind, fd), 00053 cmd (cmd2), role (role2), pid (pid2) {} inline ~pipe_port_rep () {
~pipe_port_rep | ( | ) | [inline] |
Definition at line 54 of file pipe_port.cpp.
References posix_port_rep::fd.
00054 { 00055 close (this->fd); }
port accept | ( | ) | [virtual, inherited] |
Reimplemented in socket_port_rep.
Definition at line 88 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
00088 { 00089 mmerr << "port= " << expression () << lf; 00090 ERROR ("socket server port expected"); 00091 }
virtual bool busy | ( | ) | [inline, virtual, inherited] |
Reimplemented from port_rep.
Reimplemented in file_port_rep.
Definition at line 41 of file posix_port.hpp.
References posix_port_rep::alive, posix_port_rep::buffer, posix_port_rep::feed(), mmx::N(), and posix_port_rep::pos.
virtual nat can_read | ( | ) | [inline, virtual, inherited] |
Reimplemented from port_rep.
Reimplemented in file_port_rep.
Definition at line 43 of file posix_port.hpp.
References posix_port_rep::buffer, posix_port_rep::feed(), mmx::N(), and posix_port_rep::pos.
virtual nat can_write | ( | ) | [inline, virtual, inherited] |
Reimplemented from port_rep.
Reimplemented in file_port_rep.
Definition at line 42 of file posix_port.hpp.
References posix_port_rep::alive.
Reimplemented in composite_port_rep, and formatting_port_rep.
Definition at line 94 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
00094 { 00095 mmerr << "port= " << expression () << lf; 00096 ERROR ("composite port expected"); 00097 }
bool error_flag | ( | ) | [virtual, inherited] |
Reimplemented in composite_port_rep, formatting_port_rep, and error_port_rep.
string error_message | ( | ) | [virtual, inherited] |
Reimplemented in composite_port_rep, formatting_port_rep, and error_port_rep.
syntactic expression | ( | ) | const [inline, virtual] |
void feed | ( | ) | [virtual, inherited] |
Reimplemented in socket_port_rep.
Definition at line 67 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().
00067 { 00068 while (alive && wait (0)) { 00069 int r; 00070 char tempout[1024]; 00071 r = ::read (fd, tempout, 1024); 00072 if (r == -1) { 00073 #if defined(__MINGW__) || defined(__MINGW32__) 00074 _cwait (NULL, 0, _WAIT_CHILD); 00075 #else 00076 ::wait (NULL); 00077 #endif 00078 ERROR ("read failed"); 00079 } 00080 else if (r == 0) alive= false; 00081 else buffer << string (tempout, r); 00082 } 00083 }
void flush | ( | ) | [virtual, inherited] |
Reimplemented in composite_port_rep, file_port_rep, and formatting_port_rep.
void format | ( | const print_format & | fm | ) | [virtual, inherited] |
Reimplemented in formatting_port_rep.
Definition at line 100 of file port.cpp.
References ERROR, port_rep::expression(), mmx::lf, and mmx::mmerr.
00100 { 00101 mmerr << "port= " << expression () << lf; 00102 ERROR ("formatting port expected"); 00103 }
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.
00040 { 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.
00039 { return (kind & 1) != 0; }
virtual void read | ( | char * | s, | |
nat | n | |||
) | [inline, virtual, inherited] |
Reimplemented from port_rep.
Reimplemented in file_port_rep.
Definition at line 45 of file posix_port.hpp.
References posix_port_rep::buffer, posix_port_rep::feed(), mmx::inside(), mmx::mem_copy(), mmx::N(), and posix_port_rep::pos.
Referenced by posix_port_rep::feed().
virtual void send | ( | const char * | s, | |
nat | n | |||
) | [virtual, inherited] |
Referenced by posix_port_rep::write().
bool wait | ( | int | msecs | ) | [virtual, inherited] |
Reimplemented from port_rep.
Definition at line 86 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().
00086 { 00087 //mmout << "Wait " << msecs << " ms on " << expression () << "\n"; 00088 if ((kind & 2) == 0 || !alive) return false; 00089 fd_set in_fds; 00090 FD_ZERO (&in_fds); 00091 FD_SET (fd, &in_fds); 00092 00093 nat nr; 00094 struct timeval tv; 00095 tv.tv_sec = msecs / 1000; 00096 tv.tv_usec = 1000 * (msecs % 1000); 00097 if (msecs < 0) nr= select (fd + 1, &in_fds, NULL, NULL, NULL); 00098 else nr= select (fd + 1, &in_fds, NULL, NULL, &tv); 00099 //mmout << "Received " << nr << " on " << fd << "\n"; 00100 return nr > 0; 00101 }
virtual void write | ( | const char * | s, | |
nat | n | |||
) | [inline, virtual, inherited] |
Reimplemented from port_rep.
Reimplemented in file_port_rep.
Definition at line 44 of file posix_port.hpp.
References posix_port_rep::send().
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(), 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::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().