Console: Documentation fixes
[senf.git] / Console / Example.dox
1 // $Id$
2 //
3 // Copyright (C) 2008 
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
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.
12 //
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.
17 //
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.
22
23 /** \page console_testserver Test Server
24
25     \dontinclude testServer.cc
26
27     You can find this code in the \c testServer.cc source file.
28
29     \skip Custom
30     \skip #include
31     \until namespace
32
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.
35
36     We declare an alias for the senf::console::kw namespace which we will use further down for the
37     keyword arguments.
38
39     \until echo
40     \until }
41     \until }
42
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.
46
47     The following \c struct \c TestObject is used to show how member functions and objects are used
48     in the console.
49
50     \until dir
51
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.
56
57     \until };
58
59     The \c shutdownServer callback terminates the server.
60
61     \until }
62
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.
67     
68     \until Example
69
70     The \c main routine enables more verbose console logging and adds some directories and callbacks
71     to the tree so we have some stuff to play around with.
72
73     The following few lines of code instantiate a \c TestObject instance and add this object's
74     directory node to the tree
75
76     \until Example
77     
78     Now we are ready to start the server and enter the Scheduler main-loop
79
80     \until }
81  */
82
83 \f
84 // Local Variables:
85 // mode: c++
86 // fill-column: 100
87 // comment-column: 40
88 // c-file-style: "senf"
89 // indent-tabs-mode: nil
90 // ispell-local-dictionary: "american"
91 // compile-command: "scons -U doc"
92 // mode: flyspell
93 // mode: auto-fill
94 // End: