Orocos Real-Time Toolkit  2.9.0
UnMember.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: FMTC do nov 2 13:06:07 CET 2006 UnMember.hpp
3 
4  UnMember.hpp - description
5  -------------------
6  begin : do november 02 2006
7  copyright : (C) 2006 FMTC
8  email : peter.soetens@fmtc.be
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 #ifndef ORO_UN_MEMBER_HPP
40 #define ORO_UN_MEMBER_HPP
41 
42 #include <boost/shared_ptr.hpp>
43 #include <boost/mpl/erase.hpp>
44 #include <boost/mpl/insert.hpp>
45 #include <boost/mpl/begin_end.hpp>
46 #include <boost/mpl/next_prior.hpp>
47 #include <boost/mpl/vector.hpp>
48 #include <boost/mpl/back.hpp>
49 #include <boost/mpl/int.hpp>
50 #include <boost/type_traits.hpp>
51 #include <boost/function_types/function_type.hpp>
52 #include <boost/function_types/components.hpp>
53 #include <boost/function_types/member_function_pointer.hpp>
54 
55 namespace RTT
56 {
57  namespace internal
58  {
65  template<class F>
66  class UnMember
67  {
68  typedef boost::function_types::components<F> member_signature;
69  typedef typename boost::mpl::erase<typename member_signature::types,
70  typename boost::mpl::next<typename boost::mpl::begin<member_signature>::type>::type>::type non_member_signature;
71  public:
72  typedef typename boost::function_types::function_type<non_member_signature>::type type;
73  };
74 
80  template<class F,class Class>
81  class AddMember
82  {
83  typedef boost::function_types::components<F> non_member_signature;
84  typedef typename boost::mpl::insert<non_member_signature,
85  typename boost::mpl::next<typename boost::mpl::begin<non_member_signature>::type>::type,
86  Class>::type with_member_signature;
87  public:
88  typedef typename boost::function_types::member_function_pointer<with_member_signature>::type type;
89  };
90 
96  template<class F>
97  class ArgMember
98  {
99  typedef boost::function_types::components<F> member_signature;
100  // TODO this erase/insert cycle can be removed and just use member_signature in function_type<T>
101  // remove the class from the arg list:
102  typedef typename boost::mpl::erase<typename member_signature::types,
103  typename boost::mpl::next<typename boost::mpl::begin<member_signature>::type>::type>::type non_member_signature;
104  typedef typename boost::shared_ptr<typename boost::remove_const<typename boost::remove_reference<typename boost::mpl::at<typename member_signature::types,boost::mpl::int_<1> >::type>::type>::type> object_pointer;
105  // insert it as first argument.
106  typedef typename boost::mpl::insert<non_member_signature,
107  typename boost::mpl::next<typename boost::mpl::begin<non_member_signature>::type>::type,
108  object_pointer
109 // typename boost::add_pointer<typename boost::remove_const<typename boost::mpl::at<typename member_signature::types,boost::mpl::int_<1> >::type>::type>::type
110 // typename boost::add_pointer<typename boost::mpl::at<typename member_signature::types,boost::mpl::int_<1> >::type>::type
111  >::type arg_signature;
112  public:
113  typedef typename boost::function_types::function_type<arg_signature>::type type;
114  };
115 
119  template<class F>
120  class UnPointer
121  {
122  typedef boost::function_types::components<F> signature;
123  public:
124  typedef typename boost::function_types::function_type<signature>::type type;
125  };
126  }
127 }
128 
129 
130 #endif
boost::function_types::function_type< arg_signature >::type type
Definition: UnMember.hpp:113
The inverse of UnMember.
Convert a function R (X::)(Args) to a plain function signature R(X::,Args)
boost::function_types::function_type< signature >::type type
Definition: UnMember.hpp:124
boost::function_types::function_type< non_member_signature >::type type
Definition: UnMember.hpp:72
boost::function_types::member_function_pointer< with_member_signature >::type type
Definition: UnMember.hpp:88
A complexer variant of UnMember: Convert a member function type to a function type which contains the...
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52