Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Variables.hh

Go to the documentation of this file.
00001 // $Id: Variables.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2008
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #ifndef HH_SENF_Scheduler_Console_Variables_
00027 #define HH_SENF_Scheduler_Console_Variables_ 1
00028 
00029 // Custom includes
00030 #include <boost/utility.hpp>
00031 #include <boost/type_traits/is_convertible.hpp>
00032 #include <boost/ref.hpp>
00033 #include "Node.hh"
00034 
00035 #include "Variables.ih"
00036 //#include "Variables.mpp"
00037 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00038 
00039 namespace senf {
00040 namespace console {
00041 
00042     class ScopedDirectoryBase;
00043     template <class Variable> class VariableAttributor;
00044 
00045 namespace factory {
00046 
00047 #ifndef DOXYGEN
00048 
00049     template <class Variable>
00050     class ConstVariableFactory
00051         : public detail::NodeFactory
00052     {
00053     public:
00054         typedef typename detail::QueryVariable<Variable>::Traits::Overload QueryOverload;
00055         typedef typename QueryOverload::Formatter Formatter;
00056         typedef OverloadedCommandNode node_type;
00057         typedef OverloadedCommandNode & result_type;
00058 
00059         ConstVariableFactory doc(std::string const & doc);
00060         ConstVariableFactory shortdoc(std::string const & doc);
00061         ConstVariableFactory formatter(Formatter formatter);
00062 
00063         OverloadedCommandNode & create(DirectoryNode & dir, std::string const & name) const;
00064 
00065         explicit ConstVariableFactory(Variable const & var);
00066 
00067     private:
00068         typename QueryOverload::ptr queryOverload_;
00069         boost::optional<std::string> doc_;
00070         boost::optional<std::string> shortdoc_;
00071     };
00072 
00073 #endif
00074 
00108 #ifdef DOXYGEN
00109     class Variable
00110 #else
00111     template <class Variable>
00112     class VariableFactory
00113         : public ConstVariableFactory<Variable>
00114 #endif
00115     {
00116     public:
00117         typedef typename detail::SetVariable<Variable>::Traits::Overload SetOverload;
00118         typedef typename detail::ArgumentInfo<typename SetOverload::arg1_type>::Parser Parser;
00119         typedef typename detail::SetVariable<Variable>::OnChangeHandler OnChangeHandler;
00120 
00121         typedef typename ConstVariableFactory<Variable>::Formatter Formatter;
00122         typedef typename ConstVariableFactory<Variable>::QueryOverload QueryOverload;
00123 
00124         VariableFactory doc(std::string const & doc); 
00125         VariableFactory shortdoc(std::string const & doc); 
00126         VariableFactory formatter(Formatter formatter); 
00127 
00134         VariableFactory parser(Parser parser); 
00135 
00146         VariableFactory typeName(std::string const & name); 
00147         VariableFactory onChange(OnChangeHandler handler); 
00148 
00157         explicit VariableFactory(Variable & var); 
00158 
00159     protected:
00160 
00161     private:
00162         OverloadedCommandNode & create(DirectoryNode & dir, std::string const & name) const;
00163 
00164         typename SetOverload::ptr setOverload_;
00165         Variable & var_;
00166 
00167         friend class senf::console::DirectoryNode;
00168     };
00169 
00170 #ifndef DOXYGEN
00171 
00172     template <class Var>
00173     VariableFactory<Var> Variable(Var & var);
00174 
00175     template <class Var>
00176     VariableFactory<Var> Variable(boost::reference_wrapper<Var> var);
00177 
00178     template <class Var>
00179     ConstVariableFactory<Var> Variable(Var const & var);
00180 
00181     template <class Var>
00182     ConstVariableFactory<Var> Variable(boost::reference_wrapper<Var const> var);
00183 
00184 #endif
00185 
00186 }}}
00187 
00188 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00189 //#include "Variables.cci"
00190 //#include "Variables.ct"
00191 #include "Variables.cti"
00192 #endif
00193 
00194 
00195 // Local Variables:
00196 // mode: c++
00197 // fill-column: 100
00198 // comment-column: 40
00199 // c-file-style: "senf"
00200 // indent-tabs-mode: nil
00201 // ispell-local-dictionary: "american"
00202 // compile-command: "scons -u test"
00203 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research