home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OPipe.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  4KB  |  132 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OPipe.hpp
  5.  
  6. // Unnamed streamable pipes
  7.  
  8. /*
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  15.  *    endorse or promote products derived from this software
  16.  *    without specific prior written permission.
  17.  * 3. See OCL.INF for a detailed copyright notice.
  18.  *
  19.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  20.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29.  * SUCH DAMAGE.
  30.  */
  31.  
  32. // $Header: W:/Projects/OCL/Include/rcs/OPipe.hpp 1.50 1996/08/11 23:47:25 B.STEIN Release $
  33.  
  34. #ifndef OPIPE_INCLUDED
  35.  #define OPIPE_INCLUDED
  36.  
  37. #if ((!defined (__fstream_h)) && (!defined (__FSTREAM_H)))
  38.   #include <fstream.h>
  39. #endif
  40.  
  41.  
  42. #ifndef OVIOEXCEPTION_INCLUDED
  43.   #include <OVioException.hpp>
  44. #endif
  45.  
  46.  
  47. typedef class OPipe_streamable *pOPipe_streamable;
  48. typedef OPipe_streamable OPipe;
  49. typedef OPipe *pOPipe;
  50.  
  51. typedef class OPipe_istream *pOPipe_istream;
  52. typedef OPipe_istream OIPipe;
  53. typedef OIPipe *pOIPipe;
  54.  
  55. typedef class OPipe_ostream *pOPipe_ostream;
  56. typedef OPipe_ostream OOPipe;
  57. typedef OOPipe *pOOPipe;
  58.  
  59. typedef class OPipe_iostream *pOPipe_iostream;
  60. typedef OPipe_iostream OIOPipe;
  61. typedef OIOPipe *pOIOPipe;
  62.  
  63.  
  64.  
  65. class __CPP_EXPORT__ OPipe_streamable
  66.   : public OCLObject
  67. {
  68.  private:
  69.    BOOL                 wasCreator;
  70.  
  71.    void
  72.      closePipe          ();
  73.  
  74.  public:
  75.    HFILE                ifh;
  76.    HFILE                ofh;
  77.  
  78.    OPipe_streamable     ();
  79.    OPipe_streamable     (ULONG storage);
  80.    OPipe_streamable     (pOPipe_streamable pipe);
  81.    OPipe_streamable     (OPipe_streamable& pipe);
  82.    OPipe_streamable     (HFILE in, HFILE out);
  83.  
  84.    virtual
  85.       ~OPipe_streamable (); // the pipe is destroyed only when
  86.                             // the object was created using 
  87.                             // OPipe_streamable(ULONG storage)
  88.    virtual
  89.       PSZ isOfType      () const;
  90. };
  91.  
  92.  
  93. class __CPP_EXPORT__ OPipe_istream 
  94.   : public OPipe_streamable, 
  95.     public ifstream
  96. {
  97.  public:
  98.    OPipe_istream     (ULONG storage = USHRT_MAX);
  99.    OPipe_istream     (pOPipe_streamable pipe);
  100.    OPipe_istream     (OPipe_streamable& pipe);
  101.  
  102.    virtual
  103.       ~OPipe_istream (); // the pipe is destroyed only when
  104.                          // the object was created using 
  105.                          // OPipe_istream(ULONG storage)
  106.    virtual 
  107.       PSZ isOfType   () const;
  108. };
  109.  
  110.  
  111. class __CPP_EXPORT__ OPipe_ostream 
  112.   : public OPipe_streamable, 
  113.     public ofstream
  114. {
  115.  public:
  116.    OPipe_ostream     (ULONG storage = USHRT_MAX);
  117.    OPipe_ostream     (pOPipe_streamable pipe);
  118.    OPipe_ostream     (OPipe_streamable& pipe);
  119.  
  120.    virtual
  121.       ~OPipe_ostream (); // the pipe is destroyed only when
  122.                          // the object was created using 
  123.                          // OPipe_ostream(ULONG storage)
  124.    virtual
  125.       PSZ isOfType   () const;
  126. };
  127.  
  128.  
  129. #endif // OPIPE_INCLUDED
  130.  
  131. // end of source
  132.