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 Node inline template implementation */
19 #define prefix_ inline
20 //-/////////////////////////////////////////////////////////////////////////////////////////////////
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 // senf::console::DirectoryNode
25 template <class NodeType>
26 prefix_ NodeType & senf::console::DirectoryNode::add(std::string const & name,
27 boost::shared_ptr<NodeType> node)
29 SENF_ASSERT( ! node->parent(), "Node can only be added to tree once" );
35 template <class NodeType>
36 prefix_ NodeType & senf::console::DirectoryNode::
37 add(std::string const & name, NodeType & node,
38 typename boost::enable_if< boost::is_convertible<NodeType &, GenericNode &> >::type *)
40 // This makes objects with implicit conversion operators work (hi, ScopedDirectory ..)
41 add(name, static_cast<GenericNode &>(node).thisptr());
45 template <class Factory>
46 prefix_ typename Factory::result_type senf::console::DirectoryNode::
47 add(std::string const & name, Factory const & factory,
48 typename boost::enable_if< boost::is_convertible<Factory const &, detail::NodeFactory const &> >::type *)
50 return factory.create(*this, name);
53 //-/////////////////////////////////////////////////////////////////////////////////////////////////
61 // c-file-style: "senf"
62 // indent-tabs-mode: nil
63 // ispell-local-dictionary: "american"
64 // compile-command: "scons -u test"