OpenRTM-aist 2.0.2
Loading...
Searching...
No Matches
Typename.h
Go to the documentation of this file.
1// -*- C++ -*-
20#ifndef RTC_TYPENAME_H
21#define RTC_TYPENAME_H
22
23#include <rtm/RTC.h>
24
25#include <iostream>
26
27namespace CORBA_Util
28{
35 template <class T, typename T::_ptr_type (*)(void)>
37 {
38 using type = void;
39 };
40
44 template <class T, class U = void>
46 {
47 static const bool value = false;
48 };
49
56 template <class T>
57 struct has_nil_impl<T, typename has_nil_helper<T, &T::_nil>::type>
58 {
59 static const bool value = true;
60 };
61
69 template <class T>
71 {
72 };
73
81 template <typename T>
83 {
84 static const bool value = has_nil<T>::value;
85 };
86
94 template <bool cond, class T>
95 class typecode;
96
97 template <class T>
98 class typecode<true, T>
99 {
100 public:
101 static const char* id()
102 {
103 CORBA::Any any_var;
104 typename T::_ptr_type tmp_var;
105 tmp_var = T::_nil();
106 any_var <<= tmp_var;
107 return any_var.type()->id();
108 }
109 static const char* name()
110 {
111 CORBA::Any any_var;
112 typename T::_ptr_type tmp_var;
113 tmp_var = T::_nil();
114 any_var <<= tmp_var;
115 return any_var.type()->name();
116 }
117 };
118
119 template <class T>
120 class typecode<false, T>
121 {
122 public:
123 static const char* id()
124 {
125 CORBA::Any any_var;
126 T tmp_var;
127 any_var <<= tmp_var;
128 return any_var.type()->id();
129 }
130 static const char* name()
131 {
132 CORBA::Any any_var;
133 T tmp_var;
134 any_var <<= tmp_var;
135 return any_var.type()->name();
136 }
137 };
138
139
177 template <class T>
178 const char* toTypename()
179 {
180 return typecode<is_corba_object<T>::value, T>::name();
181 }
182
183 template <class T>
184 const char* toTypenameOfStruct()
185 {
187 }
188
189 template <class T>
190 const char* toTypenameOfObject()
191 {
193 }
194
232 template <class T>
233 const char* toRepositoryId()
234 {
235 return typecode<is_corba_object<T>::value, T>::id();
236 }
237
238 template <class T>
240 {
241 return typecode<false, T>::id();
242 }
243
244 template <class T>
246 {
247 return typecode<true, T>::id();
248 }
249
250} // namespace CORBA_Util
251
252template <class T>
253const char* toTypename()
254{
255 std::cerr << "toTypename() is obsolete." << std::endl;
256 std::cerr << "Please use CORBA_Util::toTypename() instead." << std::endl;
258}
259
260#endif // RTC_TYPENAME_H
RTComponent header.
const char * toTypename()
Definition Typename.h:253
static const char * name()
Definition Typename.h:130
static const char * id()
Definition Typename.h:123
static const char * id()
Definition Typename.h:101
static const char * name()
Definition Typename.h:109
typecode class template
Definition Typename.h:95
Definition DataTypeUtil.h:24
const char * toTypename()
Getting CORBA defined type as characters.
Definition Typename.h:178
const char * toRepositoryId()
Getting CORBA defined type as characters.
Definition Typename.h:233
const char * toRepositoryIdOfStruct()
Definition Typename.h:239
const char * toRepositoryIdOfObject()
Definition Typename.h:245
const char * toTypenameOfStruct()
Definition Typename.h:184
const char * toTypenameOfObject()
Definition Typename.h:190
has nil helper
Definition Typename.h:37
void type
Definition Typename.h:38
has nil impl: void case
Definition Typename.h:46
static const bool value
Definition Typename.h:47
has nil traits class template
Definition Typename.h:71
is corba object traits class
Definition Typename.h:83
static const bool value
Definition Typename.h:84