From 69f7ffa70863bef2be4cae08c466b5d97a627277 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 30 Jan 2008 17:34:35 +0000 Subject: accomodate the new modules --- src/common/console.h | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) (limited to 'src/common/console.h') diff --git a/src/common/console.h b/src/common/console.h index b661afc..fbda5da 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -1,47 +1,60 @@ /* common/console.h - This file is part of the Osirion project and is distributed under - the terms of the GNU General Public License version 2 + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2. */ -#ifndef __INCLUDED_CONSOLE_H__ -#define __INCLUDED_CONSOLE_H__ +#ifndef __INCLUDED_COMMON_CONSOLE_H__ +#define __INCLUDED_COMMON_CONSOLE_H__ + +// project headers +#include "common/common.h" // C++ headers #include /// global define to send a message to the system console -#define conmesg common::Console::instance->message() +#define con_print common::Console::instance()->messagestream() /// global define to send a warning message to the system console -#define conwarn common::Console::instance->warning() - -#define DEBUG 1 +#define con_warn common::Console::instance()->warningstream() -#ifdef DEBUG +#ifdef HAVE_DEBUG_MESSAGES /// global define to send a debug message to the system console -#define condebug common::Console::instance->debug() +#define con_debug common::Console::instance()->debugstream() #else -#define condebug if (0) *(std::ostream*)(0) -#endif // DEBUG +#define con_debug if (0) *(std::ostream*)(0) +#endif namespace common { -/// Interface for a console object that writes messages on the screen +/// interface for a console object that writes messages on the screen class Console { public: + /// default constructor + Console(); + + /// default destructor + virtual ~Console(); + /// stream to send normal messages too - virtual std::ostream & message() = 0; + virtual std::ostream & messagestream() = 0; /// stream to send warning messages too - virtual std::ostream & warning() = 0; + virtual std::ostream & warningstream() = 0; /// stream to send debug messages too - virtual std::ostream & debug() = 0 ; + virtual std::ostream & debugstream() = 0; + + /// a pointer to the current console implementation + static Console *instance(); - static Console *instance; -}; // class Console +private: + /// console singleton + static Console *console_instance; +} +; // class Console } // namespace common -#endif // __INCLUDED_CONSOLE_H__ +#endif // __INCLUDED_COMMON_CONSOLE_H__ -- cgit v1.2.3