00001 /* 00002 * Copyright (c) 2004 CSIRO ICT Centre 00003 * 00004 * $Id: FileWriter.h 587 2004-12-03 15:06:33Z nch $ 00005 */ 00006 00007 /* 00008 * Writes objects to a file. 00009 * 00010 * The FileObjectWriter is used to hide the details of the 00011 * object being written. This allows this same class to be used 00012 * to write different kinds of objects (Object, Datum, ...) to 00013 * different file types (ascii, binary, ...). 00014 */ 00015 00016 #ifndef FILEWRITER_DEFINED 00017 #define FILEWRITER_DEFINED 00018 00019 #include "FileObjectWriter.h" 00020 #include "FileUtil.h" 00021 #include "ObjectWriter.h" 00022 00023 class Object; 00024 00025 00026 class FileWriter : public ObjectWriter 00027 { 00028 public: 00029 FileWriter(FileObjectWriter * w, char const * name, bool isLarge=false); 00030 virtual ~FileWriter(); 00031 00032 virtual void open(); 00033 virtual void close(); 00034 virtual void write(Object const * object) { return writer->write(filePtr, object); }; 00035 00036 protected: 00037 FileObjectWriter * writer; 00038 FILE * filePtr; 00039 char const * fileName; 00040 bool isLarge; 00041 00042 private: 00043 FileWriter(); 00044 FileWriter(FileWriter const & other); 00045 FileWriter & operator=(FileWriter const &); 00046 }; 00047 00048 #endif // ifndef FILEWRITER_DEFINED 00049