tuyau.hpp

Go to the documentation of this file.
00001 /*********************************************************************/
00002 // dar - disk archive - a backup/restoration program
00003 // Copyright (C) 2002-2052 Denis Corbin
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 // to contact the author : dar.linux@free.fr
00020 /*********************************************************************/
00021 // $Id: tuyau.hpp,v 1.13.4.1 2007/07/22 16:35:00 edrusb Rel $
00022 //
00023 /*********************************************************************/
00024 
00032 
00033 #ifndef TUYAU_HPP
00034 #define TUYAU_HPP
00035 
00036 #include "../my_config.h"
00037 #include "infinint.hpp"
00038 #include "generic_file.hpp"
00039 #include "thread_cancellation.hpp"
00040 
00041 namespace libdar
00042 {
00043 
00045 
00047 
00048     class tuyau : public generic_file, public thread_cancellation
00049     {
00050     public:
00051         tuyau(user_interaction & dialog, int fd); // fd is the filedescriptor of a pipe extremity
00052         tuyau(user_interaction & dialog, int fd, gf_mode mode); // forces the mode if possible
00053         tuyau(user_interaction & dialog, const std::string &filename, gf_mode mode);
00054         ~tuyau() { close(filedesc); };
00055 
00056             // inherited from generic_file
00057         bool skip(const infinint & pos);
00058         bool skip_to_eof();
00059         bool skip_relative(signed int x);
00060         infinint get_position() { return position; };
00061 
00062     protected:
00063         virtual int inherited_read(char *a, size_t size);
00064         virtual int inherited_write(const char *a, size_t size);
00065 
00066     private:
00067         infinint position;
00068         int filedesc;
00069         std::string chemin; // named pipe open later
00070 
00071         void ouverture();
00072     };
00073 
00074 } // end of namespace
00075 
00076 #endif

Generated on Mon Jul 21 08:32:13 2008 for Disk ARchive by  doxygen 1.5.6