wvpipe.h

00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  *
00005  * Provides support for piping data to/from subprocesses.
00006  */ 
00007 #ifndef __WVPIPE_H
00008 #define __WVPIPE_H
00009 
00010 #include "wvfdstream.h"
00011 #include "wvsubproc.h"
00012 
00032 class WvPipe : public WvFDStream
00033 {
00034     WvSubProc proc;
00035 protected:
00036     void setup(const char *program, const char * const *argv,
00037                bool writable, bool readable, bool catch_stderr,
00038                int stdin_fd, int stdout_fd, int stderr_fd);
00039 public:
00053     WvPipe(const char *program, const char * const *argv,
00054            bool writable, bool readable, bool catch_stderr,
00055            int stdin_fd = 0, int stdout_fd = 1, int stderr_fd = 2);
00056     
00070     WvPipe(const char *program, const char * const *argv,
00071            bool writable, bool readable, bool catch_stderr,
00072            WvFDStream *stdin_str, WvFDStream *stdout_str = NULL,
00073            WvFDStream *stderr_str = NULL);
00074     
00079     WvPipe(const char *program, const char **argv,
00080            bool writable, bool readable, bool catch_stderr,
00081            WvFDStream *stdio_str);
00082 
00084     virtual ~WvPipe();
00085 
00090     void kill(int signum);
00091     
00093     int finish(bool wait_children = true);
00094     
00096     bool child_exited();
00097 
00099     bool child_killed() const;
00100     
00106     int exit_status();
00107 
00108     // returns pid
00109     int getpid() const { return proc.pid; };
00110 
00111     // callback to ignore everything.  see comment in wvpipe.cc.
00112     static void ignore_read(WvStream& s, void *userdata);
00113 };
00114 
00115 #endif // __WVPIPE_H

Generated on Wed Jul 12 17:53:21 2006 for WvStreams by  doxygen 1.4.7