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"
30 #define prefix_ inline
31 ///////////////////////////////cti.p///////////////////////////////////////
33 ///////////////////////////////////////////////////////////////////////////
34 // senf::console::ScopedDirectory<Owner>
36 template <class Owner>
37 prefix_ senf::console::ScopedDirectory<Owner>::ScopedDirectory(Owner * owner)
40 SENF_ASSERT(owner_, "ScopedDirectory owner is mandatory");
43 template <class Owner>
44 template <class NodeType>
45 prefix_ NodeType & senf::console::ScopedDirectory<Owner>::add(std::string const & name,
46 boost::shared_ptr<NodeType> othernode)
48 return node().add(name, othernode);
51 template <class Owner>
52 template <class NodeType>
53 prefix_ NodeType & senf::console::ScopedDirectory<Owner>::
54 add(std::string const & name, NodeType & othernode,
55 typename boost::enable_if< boost::is_convertible<NodeType &, GenericNode &> >::type *)
57 return node().add(name,othernode);
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::OwnedNodeFactory*> >::type *)
66 return factory.create(*owner_, name, node());
69 template <class Owner>
70 template <class Factory>
71 prefix_ typename Factory::result_type senf::console::ScopedDirectory<Owner>::
72 add(std::string const & name, Factory const & factory,
73 typename boost::enable_if< boost::is_convertible<Factory*, detail::NodeFactory*> >::type *,
74 typename boost::disable_if< boost::is_convertible<Factory*, detail::OwnedNodeFactory*> >::type *)
76 return node().add(name, factory);
79 ///////////////////////////////////////////////////////////////////////////
80 // senf::console::ScopedDirectory<void>
83 template <class NodeType>
84 prefix_ NodeType & senf::console::ScopedDirectory<void>::add(std::string const & name,
85 boost::shared_ptr<NodeType> othernode)
87 return node().add(name,othernode);
90 template <class NodeType>
91 prefix_ NodeType & senf::console::ScopedDirectory<void>::
92 add(std::string const & name, NodeType & othernode,
93 typename boost::enable_if< boost::is_convertible<NodeType &, GenericNode &> >::type *)
95 return node().add(name,othernode);
98 template <class Factory>
99 prefix_ typename Factory::result_type senf::console::ScopedDirectory<void>::
100 add(std::string const & name, Factory const & factory,
101 typename boost::enable_if< boost::is_convertible<Factory*, detail::NodeFactory*> >::type *)
103 return node().add(name,factory);
106 ///////////////////////////////cti.e///////////////////////////////////////
113 // comment-column: 40
114 // c-file-style: "senf"
115 // indent-tabs-mode: nil
116 // ispell-local-dictionary: "american"
117 // compile-command: "scons -u test"