Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9542 for code/branches


Ignore:
Timestamp:
Mar 10, 2013, 3:08:58 PM (12 years ago)
Author:
landauf
Message:

added option to disable static caching of output contexts (for unit tests)
fixed description of ConsoleWriter and LogWriter

Location:
code/branches/testing
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/testing/src/libraries/util/output/ConsoleWriter.h

    r9537 r9542  
    4747        @brief ConsoleWriter inherits from BaseWriter and writes output to the console.
    4848
    49         This class can be seen as an equivalent to std::cout within the output
    50         system. It is implemented as a singleton for static acces.
     49        This class can be seen as an equivalent to std::cout within the output system.
    5150    */
    5251    class _UtilExport ConsoleWriter : public BaseWriter
  • code/branches/testing/src/libraries/util/output/LogWriter.h

    r9538 r9542  
    4747        @brief The LogWriter class inherits from BaseWriter and writes output to a log-file.
    4848
    49         It is implemented as singleton because we (currently) use only one
    50         log-file. The path of the file can be changed, in which case the file
     49        The path of the file can be changed, in which case the file
    5150        is rewritten by using the output stored by MemoryWriter. This adds the
    5251        possibility to change the desired output levels before changing the
  • code/branches/testing/src/libraries/util/output/OutputDefinitions.h

    r9540 r9542  
    4747    context argument.
    4848*/
    49 #define REGISTER_OUTPUT_CONTEXT(name) \
    50     const OutputContextContainer& name() { static OutputContextContainer context = registerContext(#name); return context; }
     49#ifndef DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
     50    #define REGISTER_OUTPUT_CONTEXT(name) \
     51        const OutputContextContainer& name() { static OutputContextContainer context = registerContext(#name); return context; }
     52#else
     53    #define REGISTER_OUTPUT_CONTEXT(name) \
     54        const OutputContextContainer& name() { return registerContext(#name); }
     55#endif
    5156
    5257/**
     
    6065    individually by derivatives of orxonox::SubcontextOutputListener.
    6166*/
    62 #define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
    63     const OutputContextContainer& subname() { static const OutputContextContainer& context = registerContext(#name, #subname); return context; }
     67#ifndef DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
     68    #define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
     69        const OutputContextContainer& subname() { static const OutputContextContainer context = registerContext(#name, #subname); return context; }
     70#else
     71    #define REGISTER_OUTPUT_SUBCONTEXT(name, subname) \
     72        const OutputContextContainer& subname() { return registerContext(#name, #subname); }
     73#endif
    6474
    6575// tolua_begin
  • code/branches/testing/test/util/output/OutputStreamTest.cc

    r9541 r9542  
    11#include <gtest/gtest.h>
    22#include <gmock/gmock.h>
     3
     4#define DISABLE_OUTPUT_CONTEXT_STATIC_CACHE
     5
    36#include "util/Output.h"
    47#include "util/output/OutputStream.h"
     
    141144        OutputStream stream;
    142145
    143         const OutputContextContainer& context = context::undefined();
     146        const OutputContextContainer& context = context::unittest1();
    144147
    145148        stream.setOutputAttributes(level::verbose, context);
Note: See TracChangeset for help on using the changeset viewer.