Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

FileSink.h

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002 
00003    Copyright (c) 2000 Tyrell Corporation. All rights reserved.
00004 
00005    Tyrell DarkIce
00006 
00007    File     : FileSink.h
00008    Version  : $Revision: 1.5 $
00009    Author   : $Author: darkeye $
00010    Location : $Source: /cvsroot/darkice/darkice/src/FileSink.h,v $
00011    
00012    Copyright notice:
00013 
00014     This program is free software; you can redistribute it and/or
00015     modify it under the terms of the GNU General Public License  
00016     as published by the Free Software Foundation; either version 2
00017     of the License, or (at your option) any later version.
00018    
00019     This program is distributed in the hope that it will be useful,
00020     but WITHOUT ANY WARRANTY; without even the implied warranty of 
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
00022     GNU General Public License for more details.
00023    
00024     You should have received a copy of the GNU General Public License
00025     along with this program; if not, write to the Free Software
00026     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 
00028 ------------------------------------------------------------------------------*/
00029 #ifndef FILE_SINK_H
00030 #define FILE_SINK_H
00031 
00032 #ifndef __cplusplus
00033 #error This is a C++ include file
00034 #endif
00035 
00036 
00037 /* ============================================================ include files */
00038 
00039 #include "Reporter.h"
00040 #include "Sink.h"
00041 
00042 
00043 /* ================================================================ constants */
00044 
00045 
00046 /* =================================================================== macros */
00047 
00048 
00049 /* =============================================================== data types */
00050 
00057 class FileSink : public Sink, public virtual Reporter
00058 {
00059     private:
00060 
00064         char      * fileName;
00065 
00072         void
00073         init (  const char    * name )              throw ( Exception );
00074 
00080         void
00081         strip ( void )                              throw ( Exception );
00082 
00083 
00084     protected:
00085 
00089         int         fileDescriptor;
00090 
00096         inline
00097         FileSink ( void )                           throw ( Exception )
00098         {
00099             throw Exception( __FILE__, __LINE__);
00100         }
00101 
00102 
00103     public:
00104 
00111         inline
00112         FileSink(   const char        * name )      throw ( Exception )
00113         {
00114             init( name);
00115         }
00116 
00123         FileSink(   const FileSink &    fsink )     throw ( Exception );
00124 
00130         inline virtual
00131         ~FileSink( void )                           throw ( Exception )
00132         {
00133             strip();
00134         }
00135 
00143         virtual FileSink &
00144         operator= ( const FileSink &    fs )        throw ( Exception );
00145 
00151         inline const char *
00152         getFileName ( void ) const                  throw ()
00153         {
00154             return fileName;
00155         }
00156 
00163         virtual bool
00164         exists ( void ) const                       throw ();
00165 
00172         virtual bool
00173         create ( void )                             throw ( Exception );
00174 
00181         virtual bool
00182         open ( void )                               throw ( Exception );
00183 
00189         inline virtual bool
00190         isOpen ( void ) const                       throw ()
00191         {
00192             return fileDescriptor != 0;
00193         }
00194 
00204         virtual bool
00205         canWrite (     unsigned int    sec,
00206                        unsigned int    usec )       throw ( Exception );
00207 
00216         virtual unsigned int
00217         write (        const void    * buf,
00218                        unsigned int    len )        throw ( Exception );
00219 
00225         inline virtual void
00226         flush ( void )                              throw ( Exception )
00227         {
00228         }
00229 
00235         virtual void
00236         close ( void )                              throw ( Exception );
00237 };
00238 
00239 
00240 /* ================================================= external data structures */
00241 
00242 
00243 /* ====================================================== function prototypes */
00244 
00245 
00246 
00247 #endif  /* FILE_SINK_H */
00248 
00249 
00250 /*------------------------------------------------------------------------------
00251  
00252   $Source: /cvsroot/darkice/darkice/src/FileSink.h,v $
00253 
00254   $Log: FileSink.h,v $
00255   Revision 1.5  2002/02/20 11:54:11  darkeye
00256   added local dump file possibility
00257 
00258   Revision 1.3  2000/11/11 12:33:13  darkeye
00259   added kdoc-style documentation
00260 
00261   Revision 1.2  2000/11/05 17:37:24  darkeye
00262   removed clone() functions
00263 
00264   Revision 1.1.1.1  2000/11/05 10:05:51  darkeye
00265   initial version
00266 
00267   
00268 ------------------------------------------------------------------------------*/
00269 

Generated on Sat Oct 22 13:17:04 2005 for DarkIce by  doxygen 1.4.4