00001 // Filename: multiplexStream.h 00002 // Created by: drose (27Nov00) 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 MULTIPLEXSTREAM_H 00020 #define MULTIPLEXSTREAM_H 00021 00022 #include <pandabase.h> 00023 00024 #include "multiplexStreamBuf.h" 00025 00026 #include <filename.h> 00027 00028 #include <stdio.h> 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Class : MultiplexStream 00032 // Description : This is a special ostream that forwards the data that 00033 // is written to it to any number of other sources, for 00034 // instance other ostreams, or explicitly to a disk file 00035 // or to system logging utilities. It's a very handy 00036 // thing to set Notify to refer to when running in batch 00037 // mode. 00038 //////////////////////////////////////////////////////////////////// 00039 class EXPCL_PANDAEXPRESS MultiplexStream : public ostream { 00040 PUBLISHED: 00041 INLINE MultiplexStream(); 00042 00043 INLINE void add_ostream(ostream *out, bool delete_later = false); 00044 INLINE bool add_stdio_file(FILE *file, bool close_when_done); 00045 INLINE void add_standard_output(); 00046 INLINE bool add_file(Filename file); 00047 INLINE void add_system_debug(); 00048 00049 INLINE void flush(); 00050 00051 private: 00052 MultiplexStreamBuf _msb; 00053 }; 00054 00055 #include "multiplexStream.I" 00056 00057 #endif