00001 // Filename: datagramOutputFile.h 00002 // Created by: drose (30Oct00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef DATAGRAMOUTPUTFILE_H 00020 #define DATAGRAMOUTPUTFILE_H 00021 00022 #include <pandabase.h> 00023 00024 #include "datagramSink.h" 00025 #include "filename.h" 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : DatagramOutputFile 00029 // Description : This class can be used to write a binary file that 00030 // consists of an arbitrary header followed by a number 00031 // of datagrams. 00032 //////////////////////////////////////////////////////////////////// 00033 class EXPCL_PANDA DatagramOutputFile : public DatagramSink { 00034 public: 00035 INLINE DatagramOutputFile(); 00036 00037 INLINE bool open(Filename filename); 00038 00039 bool write_header(const string &header); 00040 virtual bool put_datagram(const Datagram &data); 00041 virtual bool is_error(); 00042 00043 INLINE void close(); 00044 00045 private: 00046 bool _wrote_first_datagram; 00047 bool _error; 00048 ofstream _out; 00049 }; 00050 00051 #include "datagramOutputFile.I" 00052 00053 #endif