Panda3D
|
00001 // Filename: multiplexStream.h 00002 // Created by: drose (27Nov00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef MULTIPLEXSTREAM_H 00016 #define MULTIPLEXSTREAM_H 00017 00018 #include "pandabase.h" 00019 00020 #include "multiplexStreamBuf.h" 00021 00022 #include "filename.h" 00023 00024 #include <stdio.h> 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : MultiplexStream 00028 // Description : This is a special ostream that forwards the data that 00029 // is written to it to any number of other sources, for 00030 // instance other ostreams, or explicitly to a disk file 00031 // or to system logging utilities. It's a very handy 00032 // thing to set Notify to refer to when running in batch 00033 // mode. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDAEXPRESS MultiplexStream : public ostream { 00036 PUBLISHED: 00037 INLINE MultiplexStream(); 00038 00039 INLINE void add_ostream(ostream *out, bool delete_later = false); 00040 INLINE bool add_stdio_file(FILE *file, bool close_when_done); 00041 INLINE void add_standard_output(); 00042 INLINE bool add_file(Filename file); 00043 INLINE void add_system_debug(); 00044 00045 INLINE void flush(); 00046 00047 private: 00048 MultiplexStreamBuf _msb; 00049 }; 00050 00051 #include "multiplexStream.I" 00052 00053 #endif