00001 /*************************************************************************** 00002 l1394_message.h - description 00003 ------------------- 00004 begin : Wed Mar 7 2001 00005 copyright : (C) 2001-2004 by Michael Repplinger 00006 email : repplix@studcs.uni-sb.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef L1394_MESSAGE_H 00019 #define L1394_MESSAGE_H 00020 00021 #include <fstream> 00022 #include "Thread.hpp" 00023 #include "Singleton.hpp" 00024 00025 00026 namespace L1394 { 00027 class Node; 00028 00029 namespace internal{ 00030 /** This class provides 4 streams for the different output messages (error-, warning-, debug- and simple messages) 00031 * All streams can be redirect to any other valid stream, like a file, or can be disabled. 00032 * 00033 *@author Michael Repplinger 00034 */ 00035 00036 class Message { 00037 friend class CreateUsingNew<Message>; 00038 public: 00039 void setErrorStream(std::ostream* o); 00040 void setDebugStream(std::ostream* o); 00041 void setWarningStream(std::ostream* o); 00042 void setMessageStream(std::ostream* o); 00043 00044 std::ostream& errorStream() const; 00045 std::ostream& debugStream() const; 00046 std::ostream& warningStream() const; 00047 std::ostream& messageStream() const; 00048 00049 std::ostream& errorStream(const Node*) const; 00050 std::ostream& debugStream(const Node*) const; 00051 std::ostream& warningStream(const Node*) const; 00052 std::ostream& messageStream(const Node*) const; 00053 00054 private: 00055 Message(); 00056 ~Message(); 00057 Message(const Message&); 00058 00059 std::ostream* error_stream; 00060 std::ostream* warning_stream; 00061 std::ostream* debug_stream; 00062 std::ostream* message_stream; 00063 std::ofstream* default_stream; 00064 }; 00065 typedef Singleton<L1394::internal::Message, CreateUsingNew> SMessage; 00066 } 00067 } 00068 #endif