ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/c++/socket++-1.10/pipestream.h
Revision: 1.1
Committed: Mon Feb 26 15:01:39 2001 UTC (23 years, 6 months ago) by ab11
Content type: text/plain
Branch: MAIN
CVS Tags: PROJECT_COMPLETION
Log Message:
Networking class. Assumed to be bug free.

File Contents

# User Rev Content
1 ab11 1.1 // pipestream.h -*- C++ -*- socket library
2     // Copyright (C) 1992,1993,1994 Gnanasekaran Swaminathan <gs4t@virginia.edu>
3     //
4     // Permission is granted to use at your own risk and distribute this software
5     // in source and binary forms provided the above copyright
6     // notice and this paragraph are preserved on all copies.
7     // This software is provided "as is" with no express or implied warranty.
8     //
9     // Version: 17Oct95 1.10
10    
11     #ifndef _PIPESTREAM_H
12     #define _PIPESTREAM_H
13    
14     #include <sockstream.h>
15    
16     class ipipestream: public isockstream {
17     protected:
18     ipipestream (): ios (0) {}
19     public:
20     ipipestream (const char* cmd);
21     ~ipipestream () { delete ios::rdbuf (); ios::init (0); }
22     };
23    
24     class opipestream: public osockstream {
25     protected:
26     opipestream ():ios(0) {}
27     public:
28     opipestream (const char* cmd);
29     ~opipestream () { delete ios::rdbuf (); ios::init (0); }
30     };
31    
32     class iopipestream: public iosockstream {
33     private:
34     iopipestream(const iopipestream& sp); // no defintion provided
35     iopipestream& operator = (iopipestream&); // no definition provided
36    
37     protected:
38     int sp[2]; // socket pair
39     // childs pid if this is parent and
40     // 0 if this is child if object is created through
41     // iopipstream (sockbuf::type, int).
42     // -1 otherwise;
43     pid_t cpid;
44     iopipestream* next; // next in the chain
45    
46     static iopipestream* head; // list to take care of by fork()
47    
48     public:
49     iopipestream(sockbuf::type ty=sockbuf::sock_stream, int proto=0);
50     iopipestream(const char* cmd);
51     ~iopipestream () { delete ios::rdbuf (); ios::init (0); }
52    
53     pid_t pid () const { return cpid; } // returns cpid
54     static pid_t fork(); // sets cpid of all iopipestream* in the head
55     };
56    
57     #endif // _PIPESTREAM_H