Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 31, 2011, 11:42:55 PM (13 years ago)
Author:
landauf
Message:

Removed debugLevel_ from Shell, using correct variable inherited from BaseWriter as config value.
Fixed OutputListener::setLevelMax() which ignored the new output level "message".
Fixed using a boolean called "verbose" instead of the output level with the same name in Loader.
Preventing further problems of this kind by defining OutputLevel as an enum.

Location:
code/branches/output/src/libraries
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/core/Loader.cc

    r8806 r8808  
    9393    @param mask
    9494        A ClassTreeMask, which defines which types of classes are loaded and which aren't.
    95     @param verbose
     95    @param bVerbose
    9696        Whether the loader is verbose (prints its progress in a low output level) or not.
    9797    @return
    9898        Returns true if successful.
    9999    */
    100     bool Loader::load(const ClassTreeMask& mask, bool verbose)
     100    bool Loader::load(const ClassTreeMask& mask, bool bVerbose)
    101101    {
    102102        bool success = true;
    103103        for (std::vector<std::pair<const XMLFile*, ClassTreeMask> >::iterator it = Loader::files_s.begin(); it != Loader::files_s.end(); ++it)
    104             if (!Loader::load(it->first, it->second * mask, verbose))
     104            if (!Loader::load(it->first, it->second * mask, bVerbose))
    105105                success = false;
    106106
     
    124124    @param mask
    125125        A ClassTreeMask, which defines which types of classes are reloaded and which aren't.
    126     @param verbose
     126    @param bVerbose
    127127        Whether the loader is verbose (prints its progress in a low output level) or not.
    128128    @return
    129129        Returns true if successful.
    130130    */
    131     bool Loader::reload(const ClassTreeMask& mask, bool verbose)
     131    bool Loader::reload(const ClassTreeMask& mask, bool bVerbose)
    132132    {
    133133        Loader::unload(mask);
    134         return Loader::load(mask, verbose);
     134        return Loader::load(mask, bVerbose);
    135135    }
    136136
     
    142142    @param mask
    143143        A ClassTreeMask, which defines which types of classes are loaded and which aren't.
    144     @param verbose
     144    @param bVerbose
    145145        Whether the loader is verbose (prints its progress in a low output level) or not.
    146146    @param bRemoveLuaTags
     
    149149        Returns true if successful.
    150150    */
    151     bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool verbose, bool bRemoveLuaTags)
     151    bool Loader::load(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose, bool bRemoveLuaTags)
    152152    {
    153153        if (!file)
     
    187187        try
    188188        {
    189             if(verbose)
     189            if(bVerbose)
    190190            {
    191191                orxout(user_status, context::loader) << "Start loading " << file->getFilename() << "..." << endl;
     
    216216            rootNamespace->XMLPort(rootElement, XMLPort::LoadObject);
    217217
    218             if(verbose)
     218            if(bVerbose)
    219219                orxout(user_status, context::loader) << "Finished loading " << file->getFilename() << '.' << endl;
    220220            else
     
    271271    @param mask
    272272        A ClassTreeMask, which defines which types of classes are reloaded and which aren't.
    273     @param verbose
     273    @param bVerbose
    274274        Whether the loader is verbose (prints its progress in a low output level) or not.
    275275    @return
    276276        Returns true if successful.
    277277    */
    278     bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool verbose)
     278    bool Loader::reload(const XMLFile* file, const ClassTreeMask& mask, bool bVerbose)
    279279    {
    280280        Loader::unload(file, mask);
    281         return Loader::load(file, mask, verbose);
     281        return Loader::load(file, mask, bVerbose);
    282282    }
    283283
     
    339339                orxout(internal_error, context::loader) << "Error in level file" << endl;
    340340                // TODO: error handling
    341                 return false; 
     341                return false;
    342342            }
    343343        }
  • code/branches/output/src/libraries/core/Loader.h

    r8079 r8808  
    5858            static void remove(const XMLFile* file);
    5959
    60             static bool load(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
     60            static bool load(const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);
    6161            static void unload(const ClassTreeMask& mask = ClassTreeMask());
    62             static bool reload(const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
     62            static bool reload(const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);
    6363
    6464            static bool load(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(),
    65                              bool verbose = true, bool bRemoveLuaTags = false);
     65                             bool bVerbose = true, bool bRemoveLuaTags = false);
    6666            static void unload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask());
    67             static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool verbose = true);
     67            static bool reload(const XMLFile* file, const ClassTreeMask& mask = ClassTreeMask(), bool bVerbose = true);
    6868
    6969            static std::string replaceLuaTags(const std::string& text);
  • code/branches/output/src/libraries/core/command/Shell.cc

    r8803 r8808  
    170170        if (isNormal)
    171171        {
    172             ModifyConfigValueExternal(debugLevel_, this->getConfigurableMaxLevelName(), update);
     172            ModifyConfigValueExternal(this->configurableMaxLevel_, this->getConfigurableMaxLevelName(), update);
    173173        }
    174174        else
    175175        {
    176176            OutputLevel level = (value ? DefaultLogLevel::Dev : DefaultLogLevel::User);
    177             ModifyConfigValueExternal(debugLevel_, this->getConfigurableMaxLevelName(), tset, level);
     177            ModifyConfigValueExternal(this->configurableMaxLevel_, this->getConfigurableMaxLevelName(), tset, level);
    178178        }
    179179    }
  • code/branches/output/src/libraries/core/command/Shell.h

    r8805 r8808  
    200200            unsigned int              historyOffset_;       ///< The command history is a circular buffer, this variable defines the current write-offset
    201201            std::vector<std::string>  commandHistory_;      ///< The history of commands that were entered by the user
    202             OutputLevel               debugLevel_;          //!< The maximum level of output that is displayed in the shell (will be passed to OutputListener to filter output)
    203202            static unsigned int       cacheSize_s;          ///< The maximum cache size of the CommandExecutor - this is stored here for better readability of the config file and because CommandExecutor is no OrxonoxClass
    204203    };
  • code/branches/output/src/libraries/util/Output.h

    r8787 r8808  
    3737    // Just for convenience
    3838    using std::endl;
    39     using namespace level;
    4039
    4140    inline OutputStream& orxout(OutputLevel level = level::debug_output, OutputContext context = context::undefined())
  • code/branches/output/src/libraries/util/output/BaseWriter.cc

    r8799 r8808  
    6565    void BaseWriter::changedConfigurableLevels()
    6666    {
    67         OutputLevel max_level = std::max(this->configurableMaxLevel_, this->configurableContextsMaxLevel_);
    68         OutputListener::setLevelMax(max_level);
     67        int max_level = std::max(this->configurableMaxLevel_, this->configurableContextsMaxLevel_);
     68        OutputListener::setLevelMax(static_cast<OutputLevel>(max_level));
    6969    }
    7070
  • code/branches/output/src/libraries/util/output/BaseWriter.h

    r8799 r8808  
    5050            void setLevelMax(OutputLevel max);
    5151
    52             OutputLevel configurableMaxLevel_;
     52            int configurableMaxLevel_;
    5353            inline std::string getConfigurableMaxLevelName() const
    5454                { return "outputLevel" + this->name_; }
    5555
    56             OutputLevel configurableContextsMaxLevel_;
     56            int configurableContextsMaxLevel_;
    5757            inline std::string getConfigurableContextsMaxLevelName() const
    5858                { return "outputContextsLevel" + this->name_; }
  • code/branches/output/src/libraries/util/output/OutputDefinitions.h

    r8807 r8808  
    3838namespace orxonox
    3939{
    40     typedef uint16_t OutputLevel;
    41 
    4240    namespace level
    4341    {
    44         static const OutputLevel all              = 0xFFFF;
    45         static const OutputLevel none             = 0x0000;
     42        enum OutputLevel
     43        {
     44            all              = 0xFFFF,
     45            none             = 0x0000,
    4646
    47         static const OutputLevel message          = 0x0001;
    48         static const OutputLevel debug_output     = 0x0002;
    49         static const OutputLevel user_error       = 0x0004;
    50         static const OutputLevel user_warning     = 0x0008;
    51         static const OutputLevel user_status      = 0x0010;
    52         static const OutputLevel user_info        = 0x0020;
    53         static const OutputLevel internal_error   = 0x0040;
    54         static const OutputLevel internal_warning = 0x0080;
    55         static const OutputLevel internal_status  = 0x0100;
    56         static const OutputLevel internal_info    = 0x0200;
    57         static const OutputLevel verbose          = 0x0400;
    58         static const OutputLevel verbose_more     = 0x0800;
    59         static const OutputLevel verbose_ultra    = 0x1000;
     47            message          = 0x0001,
     48            debug_output     = 0x0002,
     49            user_error       = 0x0004,
     50            user_warning     = 0x0008,
     51            user_status      = 0x0010,
     52            user_info        = 0x0020,
     53            internal_error   = 0x0040,
     54            internal_warning = 0x0080,
     55            internal_status  = 0x0100,
     56            internal_info    = 0x0200,
     57            verbose          = 0x0400,
     58            verbose_more     = 0x0800,
     59            verbose_ultra    = 0x1000
     60        };
    6061    }
     62
     63    using namespace level;
    6164
    6265    typedef uint64_t OutputContext;
  • code/branches/output/src/libraries/util/output/OutputListener.cc

    r8787 r8808  
    4848    void OutputListener::setLevelMax(OutputLevel max)
    4949    {
    50         this->setLevelRange(level::debug_output, max);
     50        this->setLevelRange(static_cast<OutputLevel>(0x1), max);
    5151    }
    5252
    5353    void OutputListener::setLevelRange(OutputLevel min, OutputLevel max)
    5454    {
    55         OutputLevel mask = 0;
    56 
    57         for (OutputLevel level = min; level <= max; level = level << 1)
     55        int mask = 0;
     56        for (int level = min; level <= max; level = level << 1)
    5857            mask |= level;
    5958
    60         this->setLevelMask(mask);
     59        this->setLevelMask(static_cast<OutputLevel>(mask));
    6160    }
    6261
  • code/branches/output/src/libraries/util/output/OutputManager.cc

    r8805 r8808  
    3838    OutputManager::OutputManager()
    3939    {
    40         this->combinedLevelMask_ = 0;
     40        this->combinedLevelMask_ = level::none;
    4141        this->combinedContextMask_ = 0;
    4242    }
     
    9999    void OutputManager::updateCombinedLevelMask()
    100100    {
    101         this->combinedLevelMask_ = 0;
     101        int mask = 0;
    102102        for (size_t i = 0; i < this->listeners_.size(); ++i)
    103             this->combinedLevelMask_ |= this->listeners_[i]->getLevelMask();
     103            mask |= this->listeners_[i]->getLevelMask();
     104        this->combinedLevelMask_ = static_cast<OutputLevel>(mask);
    104105    }
    105106
Note: See TracChangeset for help on using the changeset viewer.