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

    r8808 r8833  
    4545            virtual ~BaseWriter();
    4646
     47            void setLevelMax(OutputLevel max);
     48            void setAdditionalContextsLevelMax(OutputLevel max);
     49
    4750            const std::string& getName() const
    4851                { return this->name_; }
    4952
    50             void setLevelMax(OutputLevel max);
    51 
    5253            int configurableMaxLevel_;
    5354            inline std::string getConfigurableMaxLevelName() const
    54                 { return "outputLevel" + this->name_; }
     55                { return this->name_ + "Level"; }
    5556
    56             int configurableContextsMaxLevel_;
    57             inline std::string getConfigurableContextsMaxLevelName() const
    58                 { return "outputContextsLevel" + this->name_; }
     57            int configurableAdditionalContextsMaxLevel_;
     58            inline std::string getConfigurableAdditionalContextsMaxLevelName() const
     59                { return this->name_ + "AdditionalContextsLevel"; }
    5960
    60             std::vector<std::string> configurableContexts_;
    61             inline std::string getConfigurableContextsName() const
    62                 { return "outputContexts" + this->name_; }
     61            std::vector<std::string> configurableAdditionalContexts_;
     62            inline std::string getConfigurableAdditionalContextsName() const
     63                { return this->name_ + "AdditionalContexts"; }
    6364
    64             void changedConfigurableLevels();
    65             void changedConfigurableContexts();
     65            void changedConfigurableLevel();
     66            void changedConfigurableAdditionalContextsLevel();
     67            void changedConfigurableAdditionalContexts();
    6668
    6769            static inline std::string getConfigurableSectionName()
     
    6971
    7072        protected:
    71             virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines);
     73            virtual void output(OutputLevel level, const OutputContextContainer& context, const std::vector<std::string>& lines);
    7274
    7375        private:
     
    7779            void setLevelMask(OutputLevel mask);
    7880
    79             bool isAdditionalContext(OutputContext context) const;
     81            void setAdditionalContextsLevelRange(OutputLevel min, OutputLevel max);
     82            void setAdditionalContextsLevelMask(OutputLevel mask);
    8083
    8184            std::string name_;
    82             std::set<std::string> configurableContextsSet_;
     85
     86            OutputContextMask subcontextsCheckMask_;
     87            std::set<OutputContextSubID> subcontexts_;
    8388    };
    8489}
Note: See TracChangeset for help on using the changeset viewer.