// $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. /** \page console_testserver Test Server \dontinclude testServer.cc You can find this code in the \c testServer.cc source file. \skip Custom \skip #include \until namespace Here we see the necessary include files. For console support only senf/Console.hh needs to be included. This will pull in all necessary definitions. We declare an alias for the senf::console::kw namespace which we will use further down for the keyword arguments. \until echo \until } \until } The first callback \c echo utilizes \link console_manualparse manual argument parsing\endlink. You should always refer to the iterator types as shown here since this will be safe from future changes. The following \c struct \c TestObject is used to show how member functions and objects are used in the console. \until dir Important is the definition of the public senf::console::ScopedDirectory member called \c dir. This member can be used later to add the class to the node tree. Here we just register a single function \c vat (with \link console_autoparse automatic argument parsing\endlink) and set some command attributes. \until }; The \c shutdownServer callback terminates the server. \until } This happens in two steps: First the \c terminate() call tells the scheduler to leave it's main-loop after shutdownServer returns (which is ultimately called via the console server from the scheduler). Throwing a senf::console::Executor::ExitException is like entering the \c exit built-in command at the console. \until Example The \c main routine enables more verbose console logging and adds some directories and callbacks to the tree so we have some stuff to play around with. The following few lines of code instantiate a \c TestObject instance and add this object's directory node to the tree \until Example Now we are ready to start the server and enter the Scheduler main-loop \until } */ // 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 doc" // mode: flyspell // mode: auto-fill // End: