OpenRTM-aist
2.1.0
Toggle main menu visibility
読み取り中…
検索中…
一致する文字列を見つけられません
Typename.h
[詳解]
1
// -*- C++ -*-
19
20
#ifndef RTC_TYPENAME_H
21
#define RTC_TYPENAME_H
22
23
#include <
rtm/RTC.h
>
24
25
#include <iostream>
26
27
namespace
CORBA_Util
28
{
35
template
<
class
T,
typename
T::_ptr_type (*)(
void
)>
36
struct
has_nil_helper
37
{
38
using
type
= void;
39
};
40
44
template
<
class
T,
class
U =
void
>
45
struct
has_nil_impl
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>
70
struct
has_nil
:
has_nil_impl
<T>
71
{
72
};
73
81
template
<
typename
T>
82
struct
is_corba_object
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
#ifdef ORB_IS_TAO
127
T tmp_var = T();
128
#else
129
T tmp_var;
130
#endif
131
any_var <<= tmp_var;
132
return
any_var.type()->id();
133
}
134
static
const
char
*
name
()
135
{
136
CORBA::Any any_var;
137
#ifdef ORB_IS_TAO
138
T tmp_var = T();
139
#else
140
T tmp_var;
141
#endif
142
any_var <<= tmp_var;
143
return
any_var.type()->name();
144
}
145
};
146
147
185
template
<
class
T>
186
const
char
*
toTypename
()
187
{
188
return
typecode<is_corba_object<T>::value
, T>::name();
189
}
190
191
template
<
class
T>
192
const
char
*
toTypenameOfStruct
()
193
{
194
return
typecode<false, T>::name
();
195
}
196
197
template
<
class
T>
198
const
char
*
toTypenameOfObject
()
199
{
200
return
typecode<true, T>::name
();
201
}
202
240
template
<
class
T>
241
const
char
*
toRepositoryId
()
242
{
243
return
typecode<is_corba_object<T>::value
, T>::id();
244
}
245
246
template
<
class
T>
247
const
char
*
toRepositoryIdOfStruct
()
248
{
249
return
typecode<false, T>::id
();
250
}
251
252
template
<
class
T>
253
const
char
*
toRepositoryIdOfObject
()
254
{
255
return
typecode<true, T>::id
();
256
}
257
258
}
// namespace CORBA_Util
259
260
template
<
class
T>
261
const
char
*
toTypename
()
262
{
263
std::cerr <<
"toTypename() is obsolete."
<< std::endl;
264
std::cerr <<
"Please use CORBA_Util::toTypename() instead."
<< std::endl;
265
return
CORBA_Util::typecode<CORBA_Util::is_corba_object<T>::value
, T>::name();
266
}
267
268
#endif
// RTC_TYPENAME_H
RTC.h
RTComponent header
toTypename
const char * toTypename()
Definition
Typename.h:261
CORBA_Util::typecode< false, T >::name
static const char * name()
Definition
Typename.h:134
CORBA_Util::typecode< false, T >::id
static const char * id()
Definition
Typename.h:123
CORBA_Util::typecode< true, T >::id
static const char * id()
Definition
Typename.h:101
CORBA_Util::typecode< true, T >::name
static const char * name()
Definition
Typename.h:109
CORBA_Util::typecode
typecode class template
Definition
Typename.h:95
CORBA_Util
Definition
DataTypeUtil.h:24
CORBA_Util::toTypename
const char * toTypename()
CORBA型のタイプ名を文字列で取得する
Definition
Typename.h:186
CORBA_Util::toRepositoryId
const char * toRepositoryId()
CORBA型のリポジトリIDを文字列で取得する
Definition
Typename.h:241
CORBA_Util::toRepositoryIdOfStruct
const char * toRepositoryIdOfStruct()
Definition
Typename.h:247
CORBA_Util::toRepositoryIdOfObject
const char * toRepositoryIdOfObject()
Definition
Typename.h:253
CORBA_Util::toTypenameOfStruct
const char * toTypenameOfStruct()
Definition
Typename.h:192
CORBA_Util::toTypenameOfObject
const char * toTypenameOfObject()
Definition
Typename.h:198
CORBA_Util::has_nil_helper
has nil helper
Definition
Typename.h:37
CORBA_Util::has_nil_helper::type
void type
Definition
Typename.h:38
CORBA_Util::has_nil_impl< T, typename has_nil_helper< T, &T::_nil >::type >::value
static const bool value
Definition
Typename.h:59
CORBA_Util::has_nil_impl
has nil impl: void case
Definition
Typename.h:46
CORBA_Util::has_nil_impl::value
static const bool value
Definition
Typename.h:47
CORBA_Util::has_nil
has nil traits class template
Definition
Typename.h:71
CORBA_Util::is_corba_object
is corba object traits class
Definition
Typename.h:83
CORBA_Util::is_corba_object::value
static const bool value
Definition
Typename.h:84
構築:
1.17.0