Started over.

This commit is contained in:
crs
2001-10-06 14:13:28 +00:00
parent 27ead1f713
commit ff81f708e2
132 changed files with 7634 additions and 3960 deletions

42
net/CSocketInputStream.h Normal file
View File

@@ -0,0 +1,42 @@
#ifndef CSOCKETINPUTSTREAM_H
#define CSOCKETINPUTSTREAM_H
#include "CSocketStreamBuffer.h"
#include "CCondVar.h"
#include "IInputStream.h"
class CMutex;
class IJob;
class CSocketInputStream : public IInputStream {
public:
CSocketInputStream(CMutex*, IJob* adoptedCloseCB);
~CSocketInputStream();
// manipulators
// write() appends n bytes to the buffer
void write(const void*, UInt32 n) throw();
// causes read() to always return immediately. if there is no
// more data then it returns 0. further writes are discarded.
void hangup() throw();
// accessors
// IInputStream overrides
// these all lock the mutex for their duration
virtual void close() throw(XIO);
virtual UInt32 read(void*, UInt32 count) throw(XIO);
virtual UInt32 getSize() const throw();
private:
CMutex* m_mutex;
CCondVar<bool> m_empty;
IJob* m_closeCB;
CSocketStreamBuffer m_buffer;
bool m_closed;
bool m_hungup;
};
#endif