Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8776


Ignore:
Timestamp:
Jul 25, 2011, 1:05:04 PM (13 years ago)
Author:
landauf
Message:

in OutputManager: getInstance now only creates an instance of OutputManager, while getInstanceAndCreateListeners does additional stuff. the latter ins only used in OutputStream to ensure the default listeners (LogWriter, etc) get created. This should avoid circular calls.

Location:
code/branches/output/src/libraries/util/output
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/util/output/LogWriter.cc

    r8774 r8776  
    8383
    8484        if (this->bDefaultPath_)
    85             OutputManager::getInstanceInternal().pushMessage(level::user_info, context::output, "Opening log file " + name);
     85            OutputManager::getInstance().pushMessage(level::user_info, context::output, "Opening log file " + name);
    8686
    8787        this->file_.open(name.c_str(), std::fstream::out);
  • code/branches/output/src/libraries/util/output/OutputListener.cc

    r8765 r8776  
    4040        this->contextMask_ = context::all;
    4141
    42         OutputManager::getInstanceInternal().registerListener(this);
     42        OutputManager::getInstance().registerListener(this);
    4343    }
    4444
    4545    OutputListener::~OutputListener()
    4646    {
    47         OutputManager::getInstanceInternal().unregisterListener(this);
     47        OutputManager::getInstance().unregisterListener(this);
    4848    }
    4949
     
    6767        this->levelMask_ = mask;
    6868
    69         OutputManager::getInstanceInternal().updateCombinedLevelMask();
     69        OutputManager::getInstance().updateCombinedLevelMask();
    7070    }
    7171
     
    7474        this->contextMask_ = mask;
    7575
    76         OutputManager::getInstanceInternal().updateCombinedContextMask();
     76        OutputManager::getInstance().updateCombinedContextMask();
    7777    }
    7878}
  • code/branches/output/src/libraries/util/output/OutputManager.cc

    r8774 r8776  
    6969    /*static*/ OutputManager& OutputManager::getInstance()
    7070    {
    71         static OutputManager& instance = OutputManager::getInstanceInternal();
     71        static OutputManager instance;
     72        return instance;
     73    }
     74
     75    /*static*/ OutputManager& OutputManager::getInstanceAndCreateListeners()
     76    {
     77        static OutputManager& instance = OutputManager::getInstance();
    7278
    7379        static ConsoleOutput consoleOutputInstance;
     
    7581        static LogWriter& logWriterInstance = LogWriter::getInstance(); (void)logWriterInstance;
    7682
    77         return instance;
    78     }
    79 
    80     /*static*/ OutputManager& OutputManager::getInstanceInternal()
    81     {
    82         static OutputManager instance;
    8383        return instance;
    8484    }
  • code/branches/output/src/libraries/util/output/OutputManager.h

    r8774 r8776  
    4848        public:
    4949            static OutputManager& getInstance();
    50             static OutputManager& getInstanceInternal();
     50            static OutputManager& getInstanceAndCreateListeners();
    5151
    5252            void pushMessage(OutputLevel level, OutputContext context, const std::string& message);
  • code/branches/output/src/libraries/util/output/OutputStream.cc

    r8765 r8776  
    4444    void OutputStream::sendMessage()
    4545    {
    46         OutputManager::getInstance().pushMessage(this->level_, this->context_, this->str());
     46        OutputManager::getInstanceAndCreateListeners().pushMessage(this->level_, this->context_, this->str());
    4747        this->str("");
    4848    }
     
    5353        this->context_ = context;
    5454
    55         this->bAcceptsOutput_ = OutputManager::getInstance().acceptsOutput(level, context);
     55        this->bAcceptsOutput_ = OutputManager::getInstanceAndCreateListeners().acceptsOutput(level, context);
    5656    }
    5757}
Note: See TracChangeset for help on using the changeset viewer.