00001 // /// // Mx clientSDK 00002 // ///// //// Mx Crossplatform Client Library 00003 // /// XXX XXX /// 00004 // /// XXX XXX /// $RCSfile: mxcpcBinaryFileWriter.h,v $ 00005 // /// XXX /// $Revision: 1.1 $ 00006 // /// XXX XXX /// $Date: 2006/01/11 19:07:06 $ 00007 // //// XXX XXX //// $Author: cvs-kai $ 00008 // //// //// 00009 // //// M O B O T I X //////////////////////////////////////////////// 00010 // //// Security Vision Systems ////////////////////////////////////////////// 00011 // // 00012 // Copyright (C) 2005 - 2006, MOBOTIX AG, Germany // 00013 // This software is made available under the BSD licence. Please refer // 00014 // to the file LICENCE.TXT contained in this distribution for details. // 00015 // // 00016 // ///////////////////////////////////////////////////////////////////// 00017 00018 00019 00020 #ifndef __MXCPC_BINARYFILEWRITER_H__ 00021 #define __MXCPC_BINARYFILEWRITER_H__ 00022 00023 00024 00025 #include <mxcpcByteStreamReceiver.h> 00026 00027 #include <cstdio> 00028 00029 00030 00031 //! Byte stream receiver writing to a binary file. 00032 /*! 00033 * \ingroup mxcpc_core 00034 * 00035 * If invoked by specifying a filename to the constructor, the respective file 00036 * is automatically opened for writing. It is also automatically closed again 00037 * when the binary file writer is deleted later. 00038 * 00039 * If, on the other hand, the writer is invoked by specifying a 00040 * <tt>POSIX</tt> file descriptor to the constructor, the file descriptor is 00041 * used instead. Note that in this case the corresponing file is <b>not 00042 * closed</b> upon writer destruction. 00043 */ 00044 class mxcpcBinaryFileWriter : public mxcpcByteStreamReceiver { 00045 00046 private: 00047 int OutFile; 00048 bool CloseFileUponDeletion; 00049 00050 protected: 00051 bool ErrorEncountered; 00052 00053 // only used on WINDOWS 00054 private: 00055 int RestoreMode; 00056 00057 public: 00058 mxcpcBinaryFileWriter(const char *filename); 00059 mxcpcBinaryFileWriter(int file_descriptor); 00060 ~mxcpcBinaryFileWriter(); 00061 00062 public: 00063 //! (Re)implemented. 00064 void receiveStreamBytes(const mxcpc::u8 *bytes, int byte_num); 00065 }; 00066 00067 00068 00069 #endif // __MXCPC_BINARYFILEWRITER_H__ 00070