00001 /* 00002 * Copyright (c) 2004 CSIRO ICT Centre 00003 * 00004 * $Id: FilePairWriter.h 587 2004-12-03 15:06:33Z nch $ 00005 */ 00006 00007 /* 00008 * Writes pair of 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 FILEPAIRWRITER_DEFINED 00017 #define FILEPAIRWRITER_DEFINED 00018 00019 #include "FileObjectWriter.h" 00020 #include "FileUtil.h" 00021 #include "ObjectPairWriter.h" 00022 00023 class Object; 00024 00025 00026 class FilePairWriter : public ObjectPairWriter 00027 { 00028 public: 00029 FilePairWriter(FileObjectWriter * w, char const * name, bool isLarge=false); 00030 virtual ~FilePairWriter(); 00031 00032 virtual void open(); 00033 virtual void close(); 00034 virtual void write(Object const * redObject, 00035 Object const * blueObject) 00036 { 00037 writer->write(filePtr, redObject); 00038 writer->write(filePtr, blueObject); 00039 }; 00040 00041 protected: 00042 FileObjectWriter * writer; 00043 FILE * filePtr; 00044 char const * fileName; 00045 bool isLarge; 00046 00047 private: 00048 FilePairWriter(); 00049 FilePairWriter(FilePairWriter const & other); 00050 FilePairWriter & operator=(FilePairWriter const &); 00051 }; 00052 00053 #endif // ifndef FILEPAIRWRITER_DEFINED 00054