DataSourceTypeInfo.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef DATASOURCE_TYPE_INFO_HPP
00040 #define DATASOURCE_TYPE_INFO_HPP
00041
00042 #include <string>
00043 #include <typeinfo>
00044 #include "rtt-config.h"
00045
00046 namespace RTT
00047 {
00048 class TypeInfo;
00049
00050 namespace detail {
00051
00052 struct RTT_API UnknownType {};
00053
00054 template< class T>
00055 struct DataSourceTypeInfo;
00056
00062 template<>
00063 struct RTT_API DataSourceTypeInfo<UnknownType> {
00064 typedef UnknownType value_type;
00065 typedef DataSourceTypeInfo<UnknownType> value_type_info;
00066
00067 static TypeInfo* TypeInfoObject;
00068
00069 static const std::string noqual;
00070 static const std::string cqual;
00071 static const std::string refqual;
00072 static const std::string crefqual;
00073 static const std::string ptrqual;
00074 static const std::string cptrqual;
00075 static const std::string& getType();
00076 static const std::string& getQualifier();
00077
00078
00079 static TypeInfo* getTypeInfo();
00080 };
00081
00086 template< class T>
00087 struct DataSourceTypeInfo<const T&> {
00088 typedef T value_type;
00089 typedef DataSourceTypeInfo<T> value_type_info;
00090 static const std::string& getType() { return DataSourceTypeInfo< T >::getType(); }
00091 static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::crefqual; }
00092 static const TypeInfo* getTypeInfo() { return DataSourceTypeInfo< T >::getTypeInfo(); }
00093 };
00094
00095 template< class T>
00096 struct DataSourceTypeInfo<T&> {
00097 typedef T value_type;
00098 typedef DataSourceTypeInfo<T> value_type_info;
00099 static const std::string& getType() { return DataSourceTypeInfo< T >::getType(); }
00100 static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::refqual; }
00101 static const TypeInfo* getTypeInfo() { return DataSourceTypeInfo< T >::getTypeInfo(); }
00102 };
00103
00104 template< class T>
00105 struct DataSourceTypeInfo<const T> {
00106 typedef T value_type;
00107 typedef DataSourceTypeInfo<T> value_type_info;
00108 static const std::string& getType() { return DataSourceTypeInfo< T >::getType(); }
00109 static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::cqual; }
00110 static const TypeInfo* getTypeInfo() { return DataSourceTypeInfo< T >::getTypeInfo(); }
00111 };
00112
00113 template< class T>
00114 struct DataSourceTypeInfo<T*> {
00115 typedef T value_type;
00116 typedef DataSourceTypeInfo<T> value_type_info;
00117 static const std::string& getType() { return DataSourceTypeInfo< T >::getType(); }
00118 static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::ptrqual; }
00119 static const TypeInfo* getTypeInfo() { return DataSourceTypeInfo< T >::getTypeInfo(); }
00120 };
00121
00122 template< class T>
00123 struct DataSourceTypeInfo<const T*> {
00124 typedef T value_type;
00125 typedef DataSourceTypeInfo<T> value_type_info;
00126 static const std::string& getType() { return DataSourceTypeInfo< T >::getType(); }
00127 static const std::string& getQualifier() { return DataSourceTypeInfo<UnknownType>::cptrqual; }
00128 static const TypeInfo* getTypeInfo() { return DataSourceTypeInfo< T >::getTypeInfo(); }
00129 };
00130
00137 template< class T>
00138 struct DataSourceTypeInfo {
00139 typedef T value_type;
00140 typedef DataSourceTypeInfo<T> value_type_info;
00141
00146 static TypeInfo* TypeInfoObject;
00147
00151 static const std::string& getType();
00152
00156 static const std::string& getQualifier();
00157
00161 static const TypeInfo* getTypeInfo();
00162 };
00163
00167 template<>
00168 class RTT_API DataSourceTypeInfo<void> {
00169 static const std::string tname;
00170 public:
00171 typedef void value_type;
00172 typedef DataSourceTypeInfo<void> value_type_info;
00173
00178 static TypeInfo* TypeInfoObject;
00179
00183 static const std::string& getType();
00184
00188 static const std::string& getQualifier();
00189
00193 static const TypeInfo* getTypeInfo();
00194 };
00195 }
00196
00197 }
00198
00199 #endif
00200
00201 #include "DataSourceTypeInfo.inl"