Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-01 19:34:47 +0000
committerStijn Buys <ingar@osirion.org>2008-02-01 19:34:47 +0000
commit6c8446cddb37df732fc9e5fc21f98e31968ce634 (patch)
tree25515ae78969e2f0ef216a5cbef8a650b217e8f8 /src/common
parentf794b9ee52293cefd6ac73fdf0d2a01c5388f057 (diff)
interface cleanup
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Makefile.am4
-rw-r--r--src/common/common.cc20
-rw-r--r--src/common/common.h13
-rw-r--r--src/common/console.cc36
-rw-r--r--src/common/consoleinterface.cc36
-rw-r--r--src/common/consoleinterface.h (renamed from src/common/console.h)29
6 files changed, 55 insertions, 83 deletions
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index dd5c5d1..a3f50a6 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -1,6 +1,6 @@
METASOURCES = AUTO
-libcommon_la_SOURCES = common.cc console.cc
+libcommon_la_SOURCES = consoleinterface.cc
libcommon_la_LDFLAGS = -avoid-version -no-undefined
noinst_LTLIBRARIES = libcommon.la
-noinst_HEADERS = common.h console.h
+noinst_HEADERS = common.h consoleinterface.h
INCLUDES = -I$(top_srcdir)/src
diff --git a/src/common/common.cc b/src/common/common.cc
deleted file mode 100644
index cb968c0..0000000
--- a/src/common/common.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- common/common.cc
- This file is part of the Osirion project and is distributed under
- the terms of the GNU General Public License version 2
-*/
-
-#include "common/common.h"
-
-namespace common {
-
-void init() {
- con_debug << "Initializing common..." << std::endl;
-}
-
-void shutdown() {
- con_debug << "Shutting down common..." << std::endl;
-}
-
-}
-
diff --git a/src/common/common.h b/src/common/common.h
index 1be6827..61aa47c 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -9,18 +9,11 @@
#include "config.h"
-/// common functions and components that are used by the other subsytems
-namespace common {
+/// common functions and components that can be use by any subsytem
+namespace common {}
- /// initialize common components
- void init();
+#include "common/consoleinterface.h"
- /// shutdown common components
- void shutdown();
-
-}
-
-#include "common/console.h"
#endif // __INCLUDED_COMMON_H__
diff --git a/src/common/console.cc b/src/common/console.cc
deleted file mode 100644
index a7d0dd7..0000000
--- a/src/common/console.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- common/console.cc
- This file is part of the Osirion project and is distributed under
- the terms of the GNU General Public License version 2
-*/
-
-#include "common/console.h"
-
-#include <iostream>
-
-#include <stdlib.h>
-
-namespace common {
-
-Console *Console::console_instance = 0;
-
-Console::Console() {
- if (console_instance) {
- std::cerr << "duplicate common::Console::console_instance" << std::endl;
- exit(2);
- }
- console_instance = this;
-}
-
-Console::~Console()
-{
- console_instance = 0;
-}
-
-Console *Console::instance()
-{
- return console_instance;
-}
-
-} // namespace common
-
diff --git a/src/common/consoleinterface.cc b/src/common/consoleinterface.cc
new file mode 100644
index 0000000..eb532c6
--- /dev/null
+++ b/src/common/consoleinterface.cc
@@ -0,0 +1,36 @@
+/*
+ common/consoleinterface.cc
+ This file is part of the Osirion project and is distributed under
+ the terms of the GNU General Public License version 2
+*/
+
+#include "common/consoleinterface.h"
+
+#include <iostream>
+
+#include <stdlib.h>
+
+namespace common {
+
+ConsoleInterface *ConsoleInterface::consoleinterface_instance = 0;
+
+ConsoleInterface::ConsoleInterface() {
+ if (consoleinterface_instance) {
+ std::cerr << "multiple singleton instances: common::ConsoleInterface" << std::endl;
+ exit(2);
+ }
+ consoleinterface_instance = this;
+}
+
+ConsoleInterface::~ConsoleInterface()
+{
+ consoleinterface_instance = 0;
+}
+
+ConsoleInterface *ConsoleInterface::instance()
+{
+ return consoleinterface_instance;
+}
+
+} // namespace common
+
diff --git a/src/common/console.h b/src/common/consoleinterface.h
index 0706f11..ec77e1d 100644
--- a/src/common/console.h
+++ b/src/common/consoleinterface.h
@@ -1,11 +1,11 @@
/*
- common/console.h
+ common/consoleinterface.h
This file is part of the Osirion project and is distributed under
the terms of the GNU General Public License version 2.
*/
-#ifndef __INCLUDED_COMMON_CONSOLE_H__
-#define __INCLUDED_COMMON_CONSOLE_H__
+#ifndef __INCLUDED_COMMON_CONSOLEINTERFACE_H__
+#define __INCLUDED_COMMON_CONSOLEINTERFACE_H__
// project headers
#include "common/common.h"
@@ -14,27 +14,27 @@
#include <iostream>
/// global define to send a message to the system console
-#define con_print common::Console::instance()->messagestream()
+#define con_print common::ConsoleInterface::instance()->messagestream()
/// global define to send a warning message to the system console
-#define con_warn common::Console::instance()->warningstream()
+#define con_warn common::ConsoleInterface::instance()->warningstream()
#ifdef HAVE_DEBUG_MESSAGES
/// global define to send a debug message to the system console
-#define con_debug common::Console::instance()->debugstream()
+#define con_debug common::ConsoleInterface::instance()->debugstream()
#else
#define con_debug if (0) *(std::ostream*)(0)
#endif
namespace common {
-/// interface for a console object that writes messages on the screen
-class Console {
+/// common interface for the client and server Console classes
+class ConsoleInterface {
public:
/// default constructor
- Console();
+ ConsoleInterface();
/// default destructor
- virtual ~Console();
+ virtual ~ConsoleInterface();
/// stream to send normal messages too
virtual std::ostream & messagestream() = 0;
@@ -46,15 +46,14 @@ public:
virtual std::ostream & debugstream() = 0;
/// a pointer to the current console instance
- static Console *instance();
+ static ConsoleInterface *instance();
private:
/// console singleton
- static Console *console_instance;
-}
-; // class Console
+ static ConsoleInterface *consoleinterface_instance;
+};
} // namespace common
-#endif // __INCLUDED_COMMON_CONSOLE_H__
+#endif // __INCLUDED_COMMON_CONSOLEINTERFACE_H__