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 ScopedDirectory inline template implementation */
26 //#include "ScopedDirectory.ih"
29 #include <boost/bind.hpp>
31 #define prefix_ inline
32 ///////////////////////////////cti.p///////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////
35 // senf::console::ScopedDirectory<Owner>
37 template <class Owner>
38 prefix_ senf::console::ScopedDirectory<Owner>::ScopedDirectory(Owner * owner)
44 template <class Owner>
45 template <class NodeType>
46 prefix_ NodeType & senf::console::ScopedDirectory<Owner>::add(std::string const & name,
47 boost::shared_ptr<NodeType> othernode)
49 return node().add(name, othernode);
52 template <class Owner>
53 template <class NodeType>
54 prefix_ NodeType & senf::console::ScopedDirectory<Owner>::
55 add(std::string const & name, NodeType & othernode,
56 typename boost::enable_if< boost::is_convertible<NodeType &, GenericNode &> >::type *)
58 return node().add(name,othernode);
61 template <class Owner>
62 template <class Factory>
63 prefix_ typename Factory::result_type senf::console::ScopedDirectory<Owner>::
64 add(std::string const & name, Factory const & factory,
65 typename boost::enable_if< boost::is_convertible<Factory*, detail::OwnedNodeFactory*> >::type *)
67 return factory.create(*owner_, name, node());
70 template <class Owner>
71 template <class Factory>
72 prefix_ typename Factory::result_type senf::console::ScopedDirectory<Owner>::
73 add(std::string const & name, Factory const & factory,
74 typename boost::enable_if< boost::is_convertible<Factory*, detail::NodeFactory*> >::type *,
75 typename boost::disable_if< boost::is_convertible<Factory*, detail::OwnedNodeFactory*> >::type *)
77 return node().add(name, factory);
80 ///////////////////////////////////////////////////////////////////////////
81 // senf::console::ScopedDirectory<void>
84 template <class NodeType>
85 prefix_ NodeType & senf::console::ScopedDirectory<void>::add(std::string const & name,
86 boost::shared_ptr<NodeType> othernode)
88 return node().add(name,othernode);
91 template <class NodeType>
92 prefix_ NodeType & senf::console::ScopedDirectory<void>::
93 add(std::string const & name, NodeType & othernode,
94 typename boost::enable_if< boost::is_convertible<NodeType &, GenericNode &> >::type *)
96 return node().add(name,othernode);
99 template <class Factory>
100 prefix_ typename Factory::result_type senf::console::ScopedDirectory<void>::
101 add(std::string const & name, Factory const & factory,
102 typename boost::enable_if< boost::is_convertible<Factory*, detail::NodeFactory*> >::type *)
104 return node().add(name,factory);
107 ///////////////////////////////cti.e///////////////////////////////////////
114 // comment-column: 40
115 // c-file-style: "senf"
116 // indent-tabs-mode: nil
117 // ispell-local-dictionary: "american"
118 // compile-command: "scons -u test"