4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 /** \page console_testserver Test Server
25 \dontinclude testServer.cc
27 You can find this code in the \c testServer.cc source file.
33 Here we see the necessary include files. For console support only <tt>senf/Console.hh</tt> needs
34 to be included. This will pull in all necessary definitions.
36 We declare an alias for the senf::console::kw namespace which we will use further down for the
43 The first callback \c echo utilizes \link console_manualparse manual argument
44 parsing\endlink. You should always refer to the iterator types as shown here since this will be
45 safe from future changes.
47 The following \c struct \c TestObject is used to show how member functions and objects are used
52 Important is the definition of the <b>public</b> senf::console::ScopedDirectory member called \c
53 dir. This member can be used later to add the class to the node tree. Here we just register a
54 single function \c vat (with \link console_autoparse automatic argument parsing\endlink) and
55 set some command attributes.
59 The \c shutdownServer callback terminates the server.
63 This happens in two steps: First the \c terminate() call tells the scheduler to leave it's
64 main-loop after shutdownServer returns (which is ultimately called via the console server from
65 the scheduler). Throwing a senf::console::Executor::ExitException is like entering the \c exit
66 built-in command at the console.
71 The \c main routine enables more verbose console logging and adds some directories and callbacks
72 to the tree so we have some stuff to play around with.
74 The following few lines of code instantiate a \c TestObject instance and add this object's
75 directory node to the tree
79 Now we are ready to start the server and enter the Scheduler main-loop
89 // c-file-style: "senf"
90 // indent-tabs-mode: nil
91 // ispell-local-dictionary: "american"
92 // compile-command: "scons -U doc"