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.
24 \brief Variables public header */
27 #define HH_Variables_ 1
30 #include <boost/utility.hpp>
31 #include <boost/type_traits/is_convertible.hpp>
32 #include <boost/ref.hpp>
33 #include "ParsedCommand.hh"
35 #include "Variables.ih"
36 //#include "Variables.mpp"
37 ///////////////////////////////hh.p////////////////////////////////////////
42 class ScopedDirectoryBase;
43 template <class Variable> class VariableAttributor;
45 template <class Variable>
46 VariableAttributor<Variable> senf_console_add_node(
47 DirectoryNode & node, std::string const & name, Variable & var, int,
48 typename boost::disable_if< boost::is_convertible<Variable*, ScopedDirectoryBase*> >::type * = 0);
50 template <class Variable>
51 typename detail::VariableNodeCreator<Variable>::result_type
52 senf_console_add_node(DirectoryNode & node, std::string const & name,
53 boost::reference_wrapper<Variable> var, int);
55 template <class Variable>
56 class ConstVariableAttributor
59 typedef typename detail::QueryVariable<Variable>::Traits::Overload QueryOverload;
60 typedef typename QueryOverload::Formatter Formatter;
61 typedef OverloadedCommandNode node_type;
62 typedef ConstVariableAttributor return_type;
64 ConstVariableAttributor doc(std::string const & doc);
65 ConstVariableAttributor formatter(Formatter formatter);
68 explicit ConstVariableAttributor(QueryOverload & queryOverload);
71 QueryOverload & queryOverload_;
73 friend class detail::VariableNodeCreator<Variable const>;
76 template <class Variable>
77 class VariableAttributor
78 : public ConstVariableAttributor<Variable>
81 typedef typename detail::SetVariable<Variable>::Traits::Overload SetOverload;
82 typedef typename detail::ArgumentInfo<typename SetOverload::arg1_type>::Parser Parser;
83 typedef OverloadedCommandNode node_type;
84 typedef VariableAttributor return_type;
86 typedef typename ConstVariableAttributor<Variable>::Formatter Formatter;
87 typedef typename ConstVariableAttributor<Variable>::QueryOverload QueryOverload;
89 VariableAttributor parser(Parser parser);
90 VariableAttributor typeName(std::string const & name);
92 VariableAttributor doc(std::string const & doc);
93 VariableAttributor formatter(Formatter formatter);
98 VariableAttributor(QueryOverload & queryOverload, SetOverload & setOverload);
100 SetOverload & setOverload_;
102 friend class detail::VariableNodeCreator<Variable>;
106 ///////////////////////////////hh.e////////////////////////////////////////
107 //#include "Variables.cci"
108 //#include "Variables.ct"
109 #include "Variables.cti"
116 // comment-column: 40
117 // c-file-style: "senf"
118 // indent-tabs-mode: nil
119 // ispell-local-dictionary: "american"
120 // compile-command: "scons -u test"