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 ScopedDirectory inline template implementation */
17 //#include "ScopedDirectory.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::console::ScopedDirectory<Owner>
27 template <class Owner>
28 prefix_ senf::console::ScopedDirectory<Owner>::ScopedDirectory(Owner * owner)
31 SENF_ASSERT(owner_, "ScopedDirectory owner is mandatory");
34 template <class Owner>
35 template <class NodeType>
36 prefix_ NodeType & senf::console::ScopedDirectory<Owner>::add(std::string const & name,
37 boost::shared_ptr<NodeType> othernode)
39 return node().add(name, othernode);
42 template <class Owner>
43 template <class NodeType>
44 prefix_ NodeType & senf::console::ScopedDirectory<Owner>::
45 add(std::string const & name, NodeType & othernode,
46 typename boost::enable_if< boost::is_convertible<NodeType &, GenericNode &> >::type *)
48 return node().add(name,othernode);
51 template <class Owner>
52 template <class Factory>
53 prefix_ typename Factory::result_type senf::console::ScopedDirectory<Owner>::
54 add(std::string const & name, Factory const & factory,
55 typename boost::enable_if< boost::is_convertible<Factory*, detail::OwnedNodeFactory*> >::type *)
57 return factory.create(*owner_, name, node());
60 template <class Owner>
61 template <class Factory>
62 prefix_ typename Factory::result_type senf::console::ScopedDirectory<Owner>::
63 add(std::string const & name, Factory const & factory,
64 typename boost::enable_if< boost::is_convertible<Factory*, detail::NodeFactory*> >::type *,
65 typename boost::disable_if< boost::is_convertible<Factory*, detail::OwnedNodeFactory*> >::type *)
67 return node().add(name, factory);
70 //-/////////////////////////////////////////////////////////////////////////////////////////////////
71 // senf::console::ScopedDirectory<void>
74 template <class NodeType>
75 prefix_ NodeType & senf::console::ScopedDirectory<void>::add(std::string const & name,
76 boost::shared_ptr<NodeType> othernode)
78 return node().add(name,othernode);
81 template <class NodeType>
82 prefix_ NodeType & senf::console::ScopedDirectory<void>::
83 add(std::string const & name, NodeType & othernode,
84 typename boost::enable_if< boost::is_convertible<NodeType &, GenericNode &> >::type *)
86 return node().add(name,othernode);
89 template <class Factory>
90 prefix_ typename Factory::result_type senf::console::ScopedDirectory<void>::
91 add(std::string const & name, Factory const & factory,
92 typename boost::enable_if< boost::is_convertible<Factory*, detail::NodeFactory*> >::type *)
94 return node().add(name,factory);
97 //-/////////////////////////////////////////////////////////////////////////////////////////////////
104 // comment-column: 40
105 // c-file-style: "senf"
106 // indent-tabs-mode: nil
107 // ispell-local-dictionary: "american"
108 // compile-command: "scons -u test"