Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9547


Ignore:
Timestamp:
Mar 12, 2013, 10:05:25 PM (12 years ago)
Author:
landauf
Message:

return pointers instead of references because they could be null

Location:
code/branches/testing
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • code/branches/testing/src/libraries/core/Core.cc

    r9538 r9547  
    181181
    182182        // Set the correct log path and rewrite the log file with the correct log levels
    183         OutputManager::getInstance().getLogWriter().setLogDirectory(PathConfig::getLogPathString());
     183        OutputManager::getInstance().getLogWriter()->setLogDirectory(PathConfig::getLogPathString());
    184184
    185185#if !defined(ORXONOX_PLATFORM_APPLE) && !defined(ORXONOX_USE_WINMAIN)
     
    259259    void Core::setConfigValues()
    260260    {
    261         SetConfigValueExternal(OutputManager::getInstance().getLogWriter().configurableMaxLevel_,
    262                                OutputManager::getInstance().getLogWriter().getConfigurableSectionName(),
    263                                OutputManager::getInstance().getLogWriter().getConfigurableMaxLevelName(),
    264                                OutputManager::getInstance().getLogWriter().configurableMaxLevel_)
     261        SetConfigValueExternal(OutputManager::getInstance().getLogWriter()->configurableMaxLevel_,
     262                               OutputManager::getInstance().getLogWriter()->getConfigurableSectionName(),
     263                               OutputManager::getInstance().getLogWriter()->getConfigurableMaxLevelName(),
     264                               OutputManager::getInstance().getLogWriter()->configurableMaxLevel_)
    265265            .description("The maximum level of output shown in the log file")
    266             .callback(static_cast<BaseWriter*>(&OutputManager::getInstance().getLogWriter()), &BaseWriter::changedConfigurableLevel);
    267         SetConfigValueExternal(OutputManager::getInstance().getLogWriter().configurableAdditionalContextsMaxLevel_,
    268                                OutputManager::getInstance().getLogWriter().getConfigurableSectionName(),
    269                                OutputManager::getInstance().getLogWriter().getConfigurableAdditionalContextsMaxLevelName(),
    270                                OutputManager::getInstance().getLogWriter().configurableAdditionalContextsMaxLevel_)
     266            .callback(static_cast<BaseWriter*>(OutputManager::getInstance().getLogWriter()), &BaseWriter::changedConfigurableLevel);
     267        SetConfigValueExternal(OutputManager::getInstance().getLogWriter()->configurableAdditionalContextsMaxLevel_,
     268                               OutputManager::getInstance().getLogWriter()->getConfigurableSectionName(),
     269                               OutputManager::getInstance().getLogWriter()->getConfigurableAdditionalContextsMaxLevelName(),
     270                               OutputManager::getInstance().getLogWriter()->configurableAdditionalContextsMaxLevel_)
    271271            .description("The maximum level of output shown in the log file for additional contexts")
    272             .callback(static_cast<BaseWriter*>(&OutputManager::getInstance().getLogWriter()), &BaseWriter::changedConfigurableAdditionalContextsLevel);
    273         SetConfigValueExternal(OutputManager::getInstance().getLogWriter().configurableAdditionalContexts_,
    274                                OutputManager::getInstance().getLogWriter().getConfigurableSectionName(),
    275                                OutputManager::getInstance().getLogWriter().getConfigurableAdditionalContextsName(),
    276                                OutputManager::getInstance().getLogWriter().configurableAdditionalContexts_)
     272            .callback(static_cast<BaseWriter*>(OutputManager::getInstance().getLogWriter()), &BaseWriter::changedConfigurableAdditionalContextsLevel);
     273        SetConfigValueExternal(OutputManager::getInstance().getLogWriter()->configurableAdditionalContexts_,
     274                               OutputManager::getInstance().getLogWriter()->getConfigurableSectionName(),
     275                               OutputManager::getInstance().getLogWriter()->getConfigurableAdditionalContextsName(),
     276                               OutputManager::getInstance().getLogWriter()->configurableAdditionalContexts_)
    277277            .description("Additional output contexts shown in the log file")
    278             .callback(static_cast<BaseWriter*>(&OutputManager::getInstance().getLogWriter()), &BaseWriter::changedConfigurableAdditionalContexts);
     278            .callback(static_cast<BaseWriter*>(OutputManager::getInstance().getLogWriter()), &BaseWriter::changedConfigurableAdditionalContexts);
    279279
    280280        SetConfigValue(bDevMode_, PathConfig::buildDirectoryRun())
  • code/branches/testing/src/libraries/core/command/Shell.cc

    r9536 r9547  
    8888
    8989        // Get the previous output and add it to the Shell
    90         OutputManager::getInstance().getMemoryWriter().resendOutput(this);
     90        OutputManager::getInstance().getMemoryWriter()->resendOutput(this);
    9191    }
    9292
  • code/branches/testing/src/libraries/util/output/LogWriter.cc

    r9544 r9547  
    168168
    169169        // request old output from MemoryWriter
    170         if (&OutputManager::getInstance().getMemoryWriter())
    171             OutputManager::getInstance().getMemoryWriter().resendOutput(this);
     170        if (OutputManager::getInstance().getMemoryWriter())
     171            OutputManager::getInstance().getMemoryWriter()->resendOutput(this);
    172172    }
    173173
  • code/branches/testing/src/libraries/util/output/OutputManager.h

    r9543 r9547  
    7272            static OutputManager& getInstanceAndCreateListeners();
    7373
    74             inline MemoryWriter& getMemoryWriter()   { return *this->memoryWriterInstance_; }
    75             inline ConsoleWriter& getConsoleWriter() { return *this->consoleWriterInstance_; }
    76             inline LogWriter& getLogWriter()         { return *this->logWriterInstance_; }
     74            inline MemoryWriter* getMemoryWriter()   { return this->memoryWriterInstance_; }
     75            inline ConsoleWriter* getConsoleWriter() { return this->consoleWriterInstance_; }
     76            inline LogWriter* getLogWriter()         { return this->logWriterInstance_; }
    7777
    7878            virtual void pushMessage(OutputLevel level, const OutputContextContainer& context, const std::string& message);
  • code/branches/testing/src/orxonox/overlays/InGameConsole.cc

    r9536 r9547  
    9696        // Output buffering is not anymore needed. Not the best solution to do
    9797        // this here, but there isn't much of another way.
    98         OutputManager::getInstance().getMemoryWriter().disable();
     98        OutputManager::getInstance().getMemoryWriter()->disable();
    9999    }
    100100
  • code/branches/testing/test/util/output/ConsoleWriterTest.cc

    r9545 r9547  
    6666    {
    6767        OutputManager::getInstanceAndCreateListeners();
    68         EXPECT_EQ(std::cout, OutputManager::getInstance().getConsoleWriter().getOutputStream());
     68        EXPECT_EQ(std::cout, OutputManager::getInstance().getConsoleWriter()->getOutputStream());
    6969    }
    7070}
  • code/branches/testing/test/util/output/OutputManagerTest.cc

    r9545 r9547  
    5454    TEST(OutputManagerTest, GetInstanceDoesNotCreateDefaultListeners)
    5555    {
    56         EXPECT_TRUE(NULL == &OutputManager::getInstance().getMemoryWriter());
    57         EXPECT_TRUE(NULL == &OutputManager::getInstance().getConsoleWriter());
    58         EXPECT_TRUE(NULL == &OutputManager::getInstance().getLogWriter());
     56        EXPECT_TRUE(NULL == OutputManager::getInstance().getMemoryWriter());
     57        EXPECT_TRUE(NULL == OutputManager::getInstance().getConsoleWriter());
     58        EXPECT_TRUE(NULL == OutputManager::getInstance().getLogWriter());
    5959    }
    6060
     
    6262    TEST(OutputManagerTest, GetInstanceAndCreateListenersCreatesDefaultListeners)
    6363    {
    64         EXPECT_TRUE(NULL != &OutputManager::getInstanceAndCreateListeners().getMemoryWriter());
    65         EXPECT_TRUE(NULL != &OutputManager::getInstanceAndCreateListeners().getConsoleWriter());
    66         EXPECT_TRUE(NULL != &OutputManager::getInstanceAndCreateListeners().getLogWriter());
     64        EXPECT_TRUE(NULL != OutputManager::getInstanceAndCreateListeners().getMemoryWriter());
     65        EXPECT_TRUE(NULL != OutputManager::getInstanceAndCreateListeners().getConsoleWriter());
     66        EXPECT_TRUE(NULL != OutputManager::getInstanceAndCreateListeners().getLogWriter());
    6767    }
    6868
     
    7070    TEST(OutputManagerTest, GetInstanceAndCreateListenersDoesNotCreateDefaultListenersTwice)
    7171    {
    72         MemoryWriter* memoryWriter = &OutputManager::getInstanceAndCreateListeners().getMemoryWriter();
    73         ConsoleWriter* consoleWriter = &OutputManager::getInstanceAndCreateListeners().getConsoleWriter();
    74         LogWriter* logWriter = &OutputManager::getInstanceAndCreateListeners().getLogWriter();
    75 
    76         EXPECT_TRUE(memoryWriter == &OutputManager::getInstanceAndCreateListeners().getMemoryWriter());
    77         EXPECT_TRUE(consoleWriter == &OutputManager::getInstanceAndCreateListeners().getConsoleWriter());
    78         EXPECT_TRUE(logWriter == &OutputManager::getInstanceAndCreateListeners().getLogWriter());
     72        MemoryWriter* memoryWriter = OutputManager::getInstanceAndCreateListeners().getMemoryWriter();
     73        ConsoleWriter* consoleWriter = OutputManager::getInstanceAndCreateListeners().getConsoleWriter();
     74        LogWriter* logWriter = OutputManager::getInstanceAndCreateListeners().getLogWriter();
     75
     76        EXPECT_TRUE(memoryWriter == OutputManager::getInstanceAndCreateListeners().getMemoryWriter());
     77        EXPECT_TRUE(consoleWriter == OutputManager::getInstanceAndCreateListeners().getConsoleWriter());
     78        EXPECT_TRUE(logWriter == OutputManager::getInstanceAndCreateListeners().getLogWriter());
    7979    }
    8080
  • code/branches/testing/test/util/output/OutputStreamTest.cc

    r9545 r9547  
    6464    {
    6565        // disable MemoryWriter because otherwise we would always accept all output
    66         OutputManager::getInstance().getMemoryWriter().disable();
     66        OutputManager::getInstance().getMemoryWriter()->disable();
    6767
    6868        {
     
    140140    {
    141141        // disable MemoryWriter because otherwise we would always accept all output
    142         OutputManager::getInstanceAndCreateListeners().getMemoryWriter().disable();
     142        OutputManager::getInstanceAndCreateListeners().getMemoryWriter()->disable();
    143143
    144144        OutputStream stream;
Note: See TracChangeset for help on using the changeset viewer.