conexus logo

file.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2001 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the conexus library.                             *
00006  *                                                                         *
00007  *   The conexus library is free software; you can redistribute it and/or  *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The conexus library is distributed in the hope that it will be        *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 #ifndef CONEXUSFILE_H
00020 #define CONEXUSFILE_H
00021 
00022 #include <conexus/enums.h>
00023 #include <conexus/filedescriptor.h>
00024 
00036 namespace Conexus
00037 {
00038 
00048   class File : public FileDescriptor
00049   {
00050     protected:
00051 
00052       File( const std::string& filename,
00053             long unsigned mode );
00054 
00055     public:
00056       typedef ConexusPointer<File> pointer;
00057 
00058       CONEXUS_ENDPOINT_GENERIC_CREATE();
00059 
00060       static File::pointer create( const std::string& filename = std::string(),
00061                                    long unsigned mode = 0 );
00062 
00063       virtual ~File();
00064 
00068       virtual void open( const std::string name,
00069                          long unsigned mode = FILE_UNCHANGED )
00070           throw ( open_exception);
00071 
00076       virtual void open() throw ( open_exception );
00077 
00079       std::string filename();
00080 
00082       long unsigned mode();
00083 
00085       bool eof();
00086 
00095       void set_eof(bool state=true);
00096 
00102       bool is_throw_eof_set();
00103 
00109       void set_throw_eof( bool teof = true );
00110 
00123       void set_filename( std::string d, long unsigned mode = FILE_UNCHANGED ) throw ( open_exception );
00124 
00125       sigc::signal<void> signal_filename_changed();
00126 
00127     protected:
00128       std::string m_filename;
00129       long unsigned m_mode;
00130       bool m_eof;
00131       bool m_throw_eof;
00132 
00133       sigc::signal<void> m_signal_filename_changed;
00134 
00141       virtual Data read_data( size_t size, Timeout timeout ) throw ( read_exception );
00142 
00143   };
00144 
00145 }
00146 
00147 #endif

Generated on Wed Jul 8 15:50:07 2009 for conexus by doxygen 1.5.8