DataSourceTypeInfo.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Sat May 7 12:56:52 CEST 2005 DataSourceTypeInfo.hpp
3 
4  DataSourceTypeInfo.hpp - description
5  -------------------
6  begin : Sat May 07 2005
7  copyright : (C) 2005 Peter Soetens
8  email : peter.soetens@mech.kuleuven.ac.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 DATASOURCE_TYPE_INFO_HPP
40 #define DATASOURCE_TYPE_INFO_HPP
41 
42 #include <string>
43 #include <typeinfo>
44 #include "../types/carray.hpp"
45 #include "../rtt-config.h"
46 #include "../types/rtt-types-fwd.hpp"
47 
48 namespace RTT
49 {
50 
51  namespace internal {
52 
53  struct RTT_API UnknownType {};
54 
55  template< class T>
57 
63  template<>
64  struct RTT_API DataSourceTypeInfo<UnknownType> {
65  typedef UnknownType value_type;
67 
69 
70  static const std::string noqual;
71  static const std::string cqual;
72  static const std::string refqual;
73  static const std::string crefqual;
74  static const std::string ptrqual;
75  static const std::string cptrqual;
76  static const std::string& getType();
77  static const std::string& getTypeName();
78  static const std::string& getQualifier();
79  // we drop the const qualifier in this specialisation, since it is
80  // not registered in the type repository (which returns a non const in type() )
81  static types::TypeInfo* getTypeInfo();
82  };
83 
88  template< class T>
89  struct DataSourceTypeInfo<const T&> {
90  typedef T value_type;
92  static std::string getType() { return getTypeName() + getQualifier(); }
93  static const std::string& getTypeName() { return DataSourceTypeInfo< T >::getTypeName(); }
94  static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::crefqual; }
96  };
97 
98  template< class T>
99  struct DataSourceTypeInfo<T&> {
100  typedef T value_type;
102  static std::string getType() { return getTypeName() + getQualifier(); }
103  static const std::string& getTypeName() { return DataSourceTypeInfo< T >::getTypeName(); }
104  static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::refqual; }
106  };
107 
108  template< class T>
109  struct DataSourceTypeInfo<const T> {
110  typedef T value_type;
112  static std::string getType() { return getTypeName() + getQualifier(); }
113  static const std::string& getTypeName() { return DataSourceTypeInfo< T >::getTypeName(); }
114  static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::cqual; }
116  };
117 
118  template< class T>
119  struct DataSourceTypeInfo<T*> {
120  typedef T value_type;
122  static std::string getType() { return getTypeName() + getQualifier(); }
123  static const std::string& getTypeName() { return DataSourceTypeInfo< T >::getTypeName(); }
124  static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::ptrqual; }
125  static const types::TypeInfo* getTypeInfo();
127  };
128 
129  template< class T>
130  struct DataSourceTypeInfo<const T*> {
131  typedef T value_type;
133  static std::string getType() { return getTypeName() + getQualifier(); }
134  static const std::string& getTypeName() { return DataSourceTypeInfo< T >::getTypeName(); }
135  static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::cptrqual; }
137  };
138 
147  template< class T>
148  struct DataSourceTypeInfo<types::carray<T> > {
151  static std::string getType() { return getTypeName() + "[N]"; }
152  static const std::string& getTypeName() { return DataSourceTypeInfo< T >::getTypeInfo()->getTypeName(); }
153  static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::noqual; }
154  static const types::TypeInfo* getTypeInfo();
156  };
157 
164  template< class T>
165  struct DataSourceTypeInfo {
166  typedef T value_type;
168 
174 
178  static const std::string& getType();
179 
183  static const std::string& getTypeName();
184 
188  static const std::string& getQualifier();
189 
193  static const types::TypeInfo* getTypeInfo();
194  };
195 
199  template<>
200  struct RTT_API DataSourceTypeInfo<void> {
201  static const std::string tname;
202  public:
203  typedef void value_type;
205 
211 
215  static const std::string& getType();
216 
220  static const std::string& getTypeName();
221 
225  static const std::string& getQualifier();
226 
230  static const types::TypeInfo* getTypeInfo();
231  };
232  }
233 
234 }
235 
236 #endif
237 
238 #include "DataSourceTypeInfo.inl"
DataSourceTypeInfo< UnknownType > value_type_info
const std::string & getTypeName() const
Definition: TypeInfo.hpp:83
static const types::TypeInfo * getTypeInfo()
static const types::TypeInfo * getTypeInfo()
static types::TypeInfo * TypeInfoObject
static const std::string & getTypeName()
DataSourceTypeInfo< T > value_type_info
static const types::TypeInfo * getTypeInfo()
static const types::TypeInfo * getTypeInfo()
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:24