![]() |
The Simons
|
00001 00002 // 00003 // SCL : Simons Component Library 00004 // 00006 // 00007 // Filename: Stream.h 00008 // Contents: Stream class 00009 // Author: Anthony J H Simons 00010 // Revised: 2 November 2005 00011 00012 // This software is distributed free in the hope that others will 00013 // find it useful. However, it comes WITHOUT ANY WARRANTY. No 00014 // liability can be accepted for software failure, merchantability 00015 // or fitness for a particular purpose. You can redistribute this 00016 // software in its original form, or in a modified form, provided 00017 // that this disclaimer is retained in the file banner. 00018 00019 #ifndef SCL_STREAM 00020 #define SCL_STREAM 00021 00022 #include "Object.h" // Include my superclass type 00023 #include "StreamID.h" // Include my pointer type 00024 00025 #include "StringID.h" // Depend on the pointer type 00026 00038 00039 class Stream : public Object { 00040 protected: 00041 Void readFailure(StringID, ObjectID) const; 00042 Void writeFailure(StringID, ObjectID) const; 00043 Stream(const Stream&); 00044 public: 00045 Stream(); 00046 virtual ~Stream(); 00047 virtual Void openOn(StringID); 00048 virtual Void open(); 00049 virtual Void close(); 00050 virtual StringID name() const; 00051 virtual Boolean exists() const; 00052 virtual Boolean empty() const; 00053 virtual Boolean ready() const; 00054 virtual Boolean failed() const; 00055 virtual Boolean source() const; 00056 virtual Boolean sink() const; 00057 }; 00058 00060 00063 inline StreamID::StreamID() {} 00064 00066 inline StreamID::~StreamID() {} 00067 00071 inline StreamID::StreamID(const Null* null) : 00072 ObjectID(null) {} 00073 00077 inline StreamID::StreamID(const Stream* stream) : 00078 ObjectID(stream) {} 00079 00083 inline StreamID::StreamID(const StreamID& pointer) : 00084 ObjectID(pointer) {} 00085 00089 inline StreamID& StreamID::operator=(const Stream* stream) { 00090 assign(stream); 00091 return *this; 00092 } 00093 00098 inline StreamID& StreamID::operator=(const StreamID& pointer) { 00099 assign(pointer); 00100 return *this; 00101 } 00102 00103 00104 #endif 00105