00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONEXUSRWFILEDESCRIPTOR_H
00020 #define CONEXUSRWFILEDESCRIPTOR_H
00021
00022 #include <conexus/filedescriptor.h>
00023
00024 namespace Conexus
00025 {
00026
00033 class RWFileDescriptor : public FileDescriptor
00034 {
00035 public:
00040 typedef enum RWFileDescriptorState {
00041 READ=LASTENDPOINTSTATE<<1,
00042 WRITE=LASTENDPOINTSTATE<<2,
00043 LASTRWFILEDESCRIPTORSTATE=WRITE,
00044 } RWFileDescriptorState;
00045
00046 RWFileDescriptor(unsigned long readwrite=READ|WRITE);
00047
00048 virtual ~RWFileDescriptor();
00049
00053 virtual ssize_t write(const void* data, size_t size, IOMETHOD block=BLOCK) throw (write_error);
00054
00058 virtual Data read(size_t s = 0) throw (read_error);
00059
00060 virtual void change_state(long unsigned new_state) throw (state_error);
00061
00062 sigc::signal<void,bool> signal_readable_changed();
00063
00064 sigc::signal<void,bool> signal_writable_changed();
00065
00066 bool is_readable();
00067 bool is_writable();
00068
00069 virtual const std::string& object_type() { static std::string s("Conexus::RWFileDescriptor"); return s; }
00070
00071 protected:
00072 sigc::signal<void,bool> m_signal_readable_changed;
00073 sigc::signal<void,bool> m_signal_writable_changed;
00074
00075 void set_state_readable(bool b);
00076 void set_state_writable(bool b);
00077 };
00078
00079 }
00080
00081 #endif