Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 30, 2009, 12:39:51 PM (15 years ago)
Author:
rgrieder
Message:

De-singletonised Shell so that both consoles have their own Shell instance. However they share the history.
Also modified IOConsole to hopefully work with status lines.

Location:
code/branches/console/src/libraries/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/libraries/util/OutputHandler.cc

    r6000 r6004  
    9393            this->outputStream_ = &this->logFile_;
    9494            // Use default level until we get the configValue from the Core
    95             outputHandler.setSoftDebugLevel(this->getOutputListenerName(), OutputLevel::Debug);
     95            this->setSoftDebugLevel(OutputLevel::Debug);
    9696            outputHandler.registerOutputListener(this);
    9797        }
     
    152152            this->outputStream_ = &this->buffer_;
    153153            // We capture as much input as the listener with the highest level
    154             outputHandler.setSoftDebugLevel(this->getOutputListenerName(), OutputHandler::getSoftDebugLevel());
     154            this->setSoftDebugLevel(OutputHandler::getSoftDebugLevel());
    155155            outputHandler.registerOutputListener(this);
    156156        }
    157157
    158158        //! Pushed the just written output to the internal array
    159         void outputChanged()
     159        void outputChanged(int level)
    160160        {
    161161            // Read ostringstream and store it
    162             this->output_.push_back(std::make_pair(OutputHandler::getInstance().getOutputLevel(), this->buffer_.str()));
     162            this->output_.push_back(std::make_pair(level, this->buffer_.str()));
    163163            // Clear content and flags
    164164            this->buffer_.str(std::string());
     
    210210        }
    211211        this->listeners_.push_back(listener);
     212        // Update global soft debug level
     213        this->setSoftDebugLevel(listener->getOutputListenerName(), listener->getSoftDebugLevel());
    212214    }
    213215
  • code/branches/console/src/libraries/util/OutputHandler.h

    r5996 r6004  
    142142            //! Returns the soft debug level for a device by its name   @return The level or -1 if the listener was not found
    143143            int  getSoftDebugLevel(const std::string& name) const;
    144             //! Sets the soft debug level for a listener by its name
     144            //! Sets the soft debug level for a listener by its name   @remarks Only works for registered listeners!
    145145            void setSoftDebugLevel(const std::string& name, int level);
    146146
     
    231231            : outputStream_(NULL)
    232232            , name_(name)
     233            , softDebugLevel_(OutputLevel::Info)
    233234        {}
    234235        virtual ~OutputListener() {}
    235236
    236237        //! Gets called whenever output is put into the stream
    237         virtual void outputChanged() {}
     238        virtual void outputChanged(int level) {}
    238239        //! Returns the name of this output listener
    239240        const std::string& getOutputListenerName() const { return this->name_; }
     241        //! Returns the soft debug level of the listener
     242        int getSoftDebugLevel() const { return this->softDebugLevel_; }
     243        //! Sets the soft debug level of the listener
     244        void setSoftDebugLevel(int level)
     245        {
     246            this->softDebugLevel_ = level;
     247            OutputHandler::getInstance().setSoftDebugLevel(this->name_, level);
     248        }
    240249
    241250    protected:
     
    257266                stream << output;
    258267                stream.flush();
    259                 (*it)->outputChanged();
     268                (*it)->outputChanged(this->outputLevel_);
    260269            }
    261270        }
Note: See TracChangeset for help on using the changeset viewer.