Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 11, 2011, 11:20:39 PM (13 years ago)
Author:
landauf
Message:

A context is now defined by a struct instead of only a mask.

Introduced sub-contexts. Sub-contexts of the same main-context share the same mask, but have a different ID.
Main-contexts are filtered using a bitmask which happens for every line of output and is very fast.
Sub-contexts are filtered using a set which is slow but happens only if a specific sub-context is enabled in the config file which is usually not the case.

The concept of filtering normal output + additional contexts was moved from BaseWriter directly to OutputListener and OutputManager which makes the whole system faster.
BaseWriter now calls registerContext() for each configured output context, which basically allows the usage of more than 64 contexts as long as these contexts are not used before loading the config file. Though by design it's not recommended.

File:
1 edited

Legend:

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

    r8808 r8833  
    3636    {
    3737        this->levelMask_ = level::none;
    38         this->contextMask_ = context::all;
     38        this->additionalContextsLevelMask_ = level::none;
     39        this->additionalContextsMask_ = context::none;
    3940
    4041        OutputManager::getInstance().registerListener(this);
     
    6768    }
    6869
    69     void OutputListener::setContextMask(OutputContext mask)
     70    void OutputListener::setAdditionalContextsLevelMax(OutputLevel max)
    7071    {
    71         this->contextMask_ = mask;
     72        this->setAdditionalContextsLevelRange(static_cast<OutputLevel>(0x1), max);
     73    }
    7274
    73         OutputManager::getInstance().updateCombinedContextMask();
     75    void OutputListener::setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max)
     76    {
     77        int mask = 0;
     78        for (int level = min; level <= max; level = level << 1)
     79            mask |= level;
     80
     81        this->setAdditionalContextsLevelMask(static_cast<OutputLevel>(mask));
     82    }
     83
     84    void OutputListener::setAdditionalContextsLevelMask(OutputLevel mask)
     85    {
     86        this->additionalContextsLevelMask_ = mask;
     87
     88        OutputManager::getInstance().updateCombinedAdditionalContextsLevelMask();
     89    }
     90
     91    void OutputListener::setAdditionalContextsMask(OutputContextMask mask)
     92    {
     93        this->additionalContextsMask_ = mask;
     94
     95        OutputManager::getInstance().updateCombinedAdditionalContextsMask();
    7496    }
    7597}
Note: See TracChangeset for help on using the changeset viewer.