/* server/console.cc This file is part of the Osirion project and is distributed under the terms and conditions of the GNU General Public License version 2 */ #include "server/console.h" #include "core/core.h" #include namespace server { namespace console { //--- private definition ------------------------------------------ /// server console implementation class Console : public sys::ConsoleInterface { public: /// stream to send normal messages too virtual std::ostream & messagestream(); /// stream to send warning messages too virtual std::ostream & warningstream(); /// stream to send warning messages too virtual std::ostream & errorstream(); /// stream to send debug messages too virtual std::ostream & debugstream(); unsigned long ping; }; // private console object Console console; //--- engine functions -------------------------------------------- extern "C" void func_con_ping(std::stringstream &args) { con_print << "Ping!" << std::endl; console.ping++; } //--- public ------------------------------------------------------ void init() { con_print << "Initializing console..." << std::endl; // register our engine functions core::Func::add("con_ping", (core::FuncPtr) func_con_ping); } void shutdown() { con_print << "Shutting down console..." << std::endl; // unregister our engine functions core::Func::remove("con_ping"); } //--- private ----------------------------------------------------- std::ostream & Console::messagestream() { return std::cout; } std::ostream & Console::warningstream() { return std::cerr; } std::ostream & Console::errorstream() { return std::cerr; } std::ostream & Console::debugstream() { return std::cout; } } // namespace console } // namespace server