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.h

    r8794 r8833  
    4848            void setLevelMask(OutputLevel mask);
    4949
     50            void setAdditionalContextsLevelMax(OutputLevel max);
     51            void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max);
     52            void setAdditionalContextsLevelMask(OutputLevel mask);
     53
     54            void setAdditionalContextsMask(OutputContextMask mask);
     55
    5056            inline OutputLevel getLevelMask() const
    5157                { return this->levelMask_; }
     58            inline OutputLevel getAdditionalContextsLevelMask() const
     59                { return this->additionalContextsLevelMask_; }
     60            inline OutputContextMask getAdditionalContextsMask() const
     61                { return this->additionalContextsMask_; }
    5262
    53             void setContextMask(OutputContext mask);
     63            inline bool acceptsOutput(OutputLevel level, const OutputContextContainer& context) const
     64            {
     65                return (this->levelMask_ & level) ||
     66                       ((this->additionalContextsLevelMask_ & level) && (this->additionalContextsMask_ & context.mask)); }
    5467
    55             inline OutputContext getContextMask() const
    56                 { return this->contextMask_; }
    57 
    58             inline bool acceptsOutput(OutputLevel level, OutputContext context) const
    59                 { return ((this->levelMask_ & level) && (this->contextMask_ & context)); }
    60 
    61             inline void unfilteredOutput(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)
     68            inline void unfilteredOutput(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines)
    6269                { if (this->acceptsOutput(level, context)) this->output(level, context, lines); }
    6370
    6471        protected:
    65             virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines) = 0;
     72            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines) = 0;
    6673
    6774        private:
    68             OutputLevel   levelMask_;
    69             OutputContext contextMask_;
     75            OutputLevel       levelMask_;
     76            OutputLevel       additionalContextsLevelMask_;
     77            OutputContextMask additionalContextsMask_;
    7078    };
    7179}
Note: See TracChangeset for help on using the changeset viewer.