2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief Variables internal header */
17 #ifndef IH_SENF_Scheduler_Console_Variables_
18 #define IH_SENF_Scheduler_Console_Variables_ 1
21 #include <boost/function.hpp>
22 #include <boost/type_traits/is_const.hpp>
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
29 template <class Variable> class ConstVariableAttributor;
30 template <class Variable> class VariableAttributor;
36 template <class Variable>
39 typedef Variable const & Signature ();
40 typedef boost::function<Signature> Function;
41 typedef detail::ParsedCommandTraits<Signature> Traits;
42 typedef detail::CreateParsedCommandOverload<Traits> CreateOverload;
43 typedef Variable const & result_type;
45 QueryVariable(Variable const & var);
47 static typename Traits::Overload::ptr create(Variable const & var);
49 Variable const & operator()() const;
51 Variable const & var_;
54 template <class Variable>
57 typedef void Signature (Variable &);
58 typedef boost::function<Signature> Function;
59 typedef detail::ParsedCommandTraits<Signature> Traits;
60 typedef detail::CreateParsedCommandOverload<Traits> CreateOverload;
61 typedef boost::function<void (Variable const &)> OnChangeHandler;
62 typedef void result_type;
64 SetVariable(Variable & var, OnChangeHandler handler = OnChangeHandler());
66 static typename Traits::Overload::ptr create(Variable & var);
68 void operator()(Variable const & value) const;
71 OnChangeHandler handler_;
78 //-/////////////////////////////////////////////////////////////////////////////////////////////////
86 // c-file-style: "senf"
87 // indent-tabs-mode: nil
88 // ispell-local-dictionary: "american"
89 // compile-command: "scons -u test"