// $Id$ // // Copyright (C) 2008 // Fraunhofer Institute for Open Communication Systems (FOKUS) // Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the // Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file \brief Server inline non-template implementation */ #include "Server.ih" // Custom includes #define prefix_ inline ///////////////////////////////cci.p/////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // senf::console::detail::NonblockingSocketSink prefix_ senf::console::detail::NonblockingSocketSink::NonblockingSocketSink(Client & client) : client_ (client) {} prefix_ senf::console::Client & senf::console::detail::NonblockingSocketSink::client() const { return client_; } /////////////////////////////////////////////////////////////////////////// // senf::console::Server prefix_ senf::console::Server & senf::console::Server::name(std::string const & name) { name_ = name; return *this; } prefix_ void senf::console::Server::stop() { // commit suicide instancePtr().reset(0); } /////////////////////////////////////////////////////////////////////////// // senf::console::detail::ClientReader prefix_ senf::console::detail::ClientReader::~ClientReader() {} prefix_ senf::console::Client & senf::console::detail::ClientReader::client() const { return client_; } prefix_ std::string senf::console::detail::ClientReader::promptString() const { return client().promptString(); } prefix_ senf::console::detail::ClientReader::ClientHandle senf::console::detail::ClientReader::handle() const { return client().handle(); } prefix_ std::ostream & senf::console::detail::ClientReader::stream() const { return client().stream(); } prefix_ void senf::console::detail::ClientReader::stopClient() { client().stop(); } prefix_ void senf::console::detail::ClientReader::handleInput(std::string const & input) const { client().handleInput(input); } prefix_ void senf::console::detail::ClientReader::disablePrompt() { v_disablePrompt(); } prefix_ void senf::console::detail::ClientReader::enablePrompt() { v_enablePrompt(); } prefix_ void senf::console::detail::ClientReader::translate(std::string & data) { v_translate(data); } prefix_ senf::console::detail::ClientReader::ClientReader(Client & client) : client_ (client) {} /////////////////////////////////////////////////////////////////////////// // senf::console::Client prefix_ senf::console::Client::~Client() {} prefix_ void senf::console::Client::stop() { // THIS COMMITS SUICIDE. THE INSTANCE IS GONE AFTER removeClient RETURNS server_.removeClient(*this); } prefix_ std::string const & senf::console::Client::name() const { return name_; } prefix_ std::string senf::console::Client::promptString() const { return name_ + ":" + executor_.cwd().path() + "$ "; } prefix_ senf::console::Client & senf::console::Client::get(std::ostream & os) { return dynamic_cast(os)->client(); } prefix_ senf::console::Client::ClientHandle senf::console::Client::handle() const { return handle_; } prefix_ std::ostream & senf::console::Client::stream() { return out_t::member; } ///////////////////////////////cci.e/////////////////////////////////////// #undef prefix_ // Local Variables: // mode: c++ // fill-column: 100 // comment-column: 40 // c-file-style: "senf" // indent-tabs-mode: nil // ispell-local-dictionary: "american" // compile-command: "scons -u test" // End: