[Orxonox-commit 4873] r9542 - in code/branches/testing: src/libraries/util/output test/util/output
landauf at orxonox.net
landauf at orxonox.net
Sun Mar 10 15:08:58 CET 2013
Author: landauf
Date: 2013-03-10 15:08:58 +0100 (Sun, 10 Mar 2013)
New Revision: 9542
Modified:
code/branches/testing/src/libraries/util/output/ConsoleWriter.h
code/branches/testing/src/libraries/util/output/LogWriter.h
code/branches/testing/src/libraries/util/output/OutputDefinitions.h
code/branches/testing/test/util/output/OutputStreamTest.cc
Log:
added option to disable static caching of output contexts (for unit tests)
fixed description of ConsoleWriter and LogWriter
Modified: code/branches/testing/src/libraries/util/output/ConsoleWriter.h
===================================================================
--- code/branches/testing/src/libraries/util/output/ConsoleWriter.h 2013-03-10 10:58:49 UTC (rev 9541)
+++ code/branches/testing/src/libraries/util/output/ConsoleWriter.h 2013-03-10 14:08:58 UTC (rev 9542)
@@ -46,8 +46,7 @@
/**
@brief ConsoleWriter inherits from BaseWriter and writes output to the console.
- This class can be seen as an equivalent to std::cout within the output
- system. It is implemented as a singleton for static acces.
+ This class can be seen as an equivalent to std::cout within the output system.
*/
class _UtilExport ConsoleWriter : public BaseWriter
{
Modified: code/branches/testing/src/libraries/util/output/LogWriter.h
===================================================================
--- code/branches/testing/src/libraries/util/output/LogWriter.h 2013-03-10 10:58:49 UTC (rev 9541)
+++ code/branches/testing/src/libraries/util/output/LogWriter.h 2013-03-10 14:08:58 UTC (rev 9542)
@@ -46,8 +46,7 @@
/**
@brief The LogWriter class inherits from BaseWriter and writes output to a log-file.
- It is implemented as singleton because we (currently) use only one
- log-file. The path of the file can be changed, in which case the file
+ The path of the file can be changed, in which case the file
is rewritten by using the output stored by MemoryWriter. This adds the
possibility to change the desired output levels before changing the
path in order to get the complete output with the new output levels
Modified: code/branches/testing/src/libraries/util/output/OutputDefinitions.h
===================================================================
--- code/branches/testing/src/libraries/util/output/OutputDefinitions.h 2013-03-10 10:58:49 UTC (rev 9541)
+++ code/branches/testing/src/libraries/util/output/OutputDefinitions.h 2013-03-10 14:08:58 UTC (rev 9542)
@@ -46,8 +46,13 @@
functions (or the containers they return) can be passed to orxout() as
context argument.
*/
-#define REGISTER_OUTPUT_CONTEXT(name) \
- const OutputContextContainer& name() { static OutputContextContainer context = registerContext(#name); return context; }
+#ifndef DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
+ #define REGISTER_OUTPUT_CONTEXT(name) \
+ const OutputContextContainer& name() { static OutputContextContainer context = registerContext(#name); return context; }
+#else
+ #define REGISTER_OUTPUT_CONTEXT(name) \
+ const OutputContextContainer& name() { return registerContext(#name); }
+#endif
/**
@brief Defines a sub-context.
@@ -59,8 +64,13 @@
more descriptive names (e.g. input::keyboard) and they can be filtered
individually by derivatives of orxonox::SubcontextOutputListener.
*/
-#define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
- const OutputContextContainer& subname() { static const OutputContextContainer& context = registerContext(#name, #subname); return context; }
+#ifndef DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
+ #define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
+ const OutputContextContainer& subname() { static const OutputContextContainer context = registerContext(#name, #subname); return context; }
+#else
+ #define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
+ const OutputContextContainer& subname() { return registerContext(#name, #subname); }
+#endif
// tolua_begin
namespace orxonox
Modified: code/branches/testing/test/util/output/OutputStreamTest.cc
===================================================================
--- code/branches/testing/test/util/output/OutputStreamTest.cc 2013-03-10 10:58:49 UTC (rev 9541)
+++ code/branches/testing/test/util/output/OutputStreamTest.cc 2013-03-10 14:08:58 UTC (rev 9542)
@@ -1,5 +1,8 @@
#include <gtest/gtest.h>
#include <gmock/gmock.h>
+
+#define DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
+
#include "util/Output.h"
#include "util/output/OutputStream.h"
#include "util/output/OutputManager.h"
@@ -140,7 +143,7 @@
OutputStream stream;
- const OutputContextContainer& context = context::undefined();
+ const OutputContextContainer& context = context::unittest1();
stream.setOutputAttributes(level::verbose, context);
EXPECT_FALSE(stream.acceptsOutput());
More information about the Orxonox-commit
mailing list