rwfiledescriptor.h

00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Lesser General Public License as        *
00007  *   published by the Free Software Foundation version 2.1.                *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA              *
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

Generated on Sun Aug 6 12:16:57 2006 by  doxygen 1.4.6