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 ObjectDirectory inline template implementation */
26 //#include "ObjectDirectory.ih"
29 #include <boost/bind.hpp>
31 #define prefix_ inline
32 ///////////////////////////////cti.p///////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////
35 // senf::console::OwnerNodeCreateTraits<Owner,Object>::Creator
37 template <class Owner, class Object>
38 prefix_ typename senf::console::OwnerNodeCreateTraits<Owner,Object>::NodeType &
39 senf::console::OwnerNodeCreateTraits<Owner,Object>::Creator::create(DirectoryNode & node,
41 std::string const & name,
44 return senf_console_add_node(node, owner, name, ob);
47 ///////////////////////////////////////////////////////////////////////////
48 // senf::console::ObjectDirectory<Owner>
50 template <class Owner>
51 prefix_ senf::console::ObjectDirectory<Owner>::ObjectDirectory(Owner * owner)
52 : node_ (DirectoryNode::create().release()), owner_ (owner)
55 template <class Owner>
56 prefix_ senf::console::ObjectDirectory<Owner>::~ObjectDirectory()
61 template <class Owner>
62 template <class Object>
63 prefix_ typename senf::console::OwnerNodeCreateTraits<Owner, Object>::NodeType &
64 senf::console::ObjectDirectory<Owner>::add(std::string const & name, Object const & ob)
66 return OwnerNodeCreateTraits<Owner, Object>::Creator::create(*node_, *owner_, name, ob);
69 template <class Owner>
70 prefix_ senf::console::DirectoryNode & senf::console::ObjectDirectory<Owner>::node()
76 template <class Owner, class Function>
77 prefix_ senf::console::SimpleCommandNode & senf::console::
78 senf_console_add_node(DirectoryNode & node, Owner & , std::string const & name,
81 return node.add(name,fn);
84 template <class Owner>
85 prefix_ senf::console::SimpleCommandNode & senf::console::
86 senf_console_add_node(DirectoryNode & node, Owner & owner, std::string const & name,
87 void (Owner::*fn)(std::ostream & output,
88 CommandNode::Arguments const & arguments))
90 return node.add(name, boost::bind(fn,boost::ref(owner),_1,_2));
94 prefix_ senf::console::DirectoryNode & senf::console::
95 senf_console_add_node(DirectoryNode & dir, std::string const & name, Node const & node, int,
96 typename boost::enable_if< boost::is_convertible<Node*, ObjectDirectoryBase*> >::type *)
98 return dir.add(name, node.node().thisptr());
101 ///////////////////////////////cti.e///////////////////////////////////////
108 // comment-column: 40
109 // c-file-style: "senf"
110 // indent-tabs-mode: nil
111 // ispell-local-dictionary: "american"
112 // compile-command: "scons -u test"