The DejaVU Framework -- hush 3.0
[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?

include: wrapper.h hush-3.0b4/auxiliary/net/thread


[.] - [up] [top] - index README make include source scripts
  // File:                wrapper.h                -*- C++ -*-
  // Author:                Jacco van Ossenbruggen <jrvosse@cs.vu.nl>
  // History:                Changed to public handler to remove SIGIO callbacks
  // Description:        
  // Object to run an executable in another (forked) process.
  // stdin, stdout and stderr of the other process are 
  // connected to resp. in, out and err.
  
  ifndef _WRAPPER_H
  define _WRAPPER_H
  
    
/ TODO: ? handler

include<fstream.h> include<hush/handler.h> include <hush/export.h> const int aio_buf_size = 1024;

dvwrapper


  class  dvwrapper  { // no handler -- clashes with thread
    public:
      dvwrapper();                                                 // Constructor
      virtual ~dvwrapper();                                        // Destructor
      
      // run process
      virtual int run(const char* const path, char *const * argv);
      virtual int rerun();                        // run with same args
      
      virtual int sendsignal(int sig);                // Send signal to process
      virtual int running() const;
      
      virtual int delay_out(int b= 1);        // blocking I/O (see fcntl(2))
      virtual int delay_out() const;                // default 1 ( == "normal")
      
      ofstream *in;                                // connected with stdin
      ifstream *out;                                // connected with stdout
      ifstream *err;                                // connected with stderr
      
      operator()();
    protected:
      int pid_;                                        // process' ID
      int status_;                                // process' status
      
      int pipe_in_[2];                             // pipe connected to stdin  
      int pipe_out_[2];                            // pipe connected to stdout 
      int pipe_err_[2];                            // pipe connected to stderr 
      
      char* path_;
      char** argv_;
      
      int running_;                                // is process still running?
      int delay_out_;                                // blocking I/O out & err
      
      virtual void save_args(const char* const path, char * const * argv);
      virtual int set_up_pipes();                // Set up pipes declared above
      virtual void close_pipes();
      
      virtual void output_handler(const char* const); // redefine this one
      virtual void error_handler(const char* const);  // ,, ,, ,, ,, ,, ,,
      
      virtual void async_error(const char* const, int len);
      virtual void async_output(const char* const, int len);
      
      char err_buf[aio_buf_size];
      char out_buf[aio_buf_size];
  };

slide: dvwrapper

  
  ifndef wrapper
  define wrapper dvwrapper
  endif
  
  endif
  

[.] Papers Tutorials Examples Manuals Interfaces Sources Packages Resources ?
Hush Online Technology
hush@cs.vu.nl
09/09/98