42 #include "../types/Types.hpp" 43 #include "../FlowStatus.hpp" 44 #include "../ConnPolicy.hpp" 45 #include "../internal/DataSources.hpp" 46 #include "../typekit/Types.hpp" 47 #include "../rtt-fwd.hpp" 48 #include "../internal/mystd.hpp" 49 #include "../types/TemplateConstructor.hpp" 51 #include "../rt_string.hpp" 57 using namespace detail;
63 :
public std::unary_function<int, const std::vector<double>&>
65 typedef const std::vector<double>& (Signature)(
int );
66 mutable boost::shared_ptr< std::vector<double> > ptr;
68 : ptr( new
std::vector<double>() ) {}
69 const std::vector<double>& operator()(
int size )
const 80 struct array_varargs_ctor
82 typedef const std::vector<double>& result_type;
83 typedef double argument_type;
84 result_type operator()(
const std::vector<double>& args )
const 94 typedef NArityDataSource<array_varargs_ctor> ArrayDataSource;
101 :
public TypeConstructor
104 if (args.size() == 0 )
107 for(
unsigned int i=0; i != args.size(); ++i) {
120 :
public std::binary_function<int, double, const std::vector<double>&>
122 typedef const std::vector<double>& (Signature)(
int,
double );
123 mutable boost::shared_ptr< std::vector<double> > ptr;
125 : ptr( new
std::vector<double>() ) {}
126 const std::vector<double>& operator()(
int size,
double value )
const 129 ptr->assign( size, value );
134 double float_to_double(
float val ) {
return double(val);}
135 float double_to_float(
double val ) {
return float(val);}
138 int float_to_int(
float f) {
return int(f); }
139 float int_to_float(
int i) {
return float(i); }
140 int double_to_int(
double f) {
return int(f); }
141 double int_to_double(
int i) {
return double(i); }
142 unsigned int int_to_uint(
int i) {
return (
unsigned int)(i); }
143 int uint_to_int(
unsigned int ui) {
return int(ui); }
147 bool int_to_bool(
int i) {
return i != 0; }
148 int bool_to_int(
bool b) {
return int(b); }
151 :
public std::unary_function<int, const std::string&>
153 mutable boost::shared_ptr< std::string > ptr;
154 typedef const std::string& (Signature)(
int );
156 : ptr( new
std::string() ) {}
157 const std::string& operator()(
int size )
const 165 struct rt_string_ctor_int
166 :
public std::unary_function<int, const RTT::rt_string&>
168 mutable boost::shared_ptr< rt_string > ptr;
169 typedef const rt_string& (Signature)(
int );
172 const rt_string& operator()(
int size )
const 179 struct rt_string_ctor_string
180 :
public std::unary_function<const std::string&, const RTT::rt_string&>
182 mutable boost::shared_ptr< rt_string > ptr;
183 typedef const rt_string& (Signature)( std::string
const& );
184 rt_string_ctor_string()
186 const rt_string& operator()( std::string
const& arg )
const 193 struct string_ctor_rt_string
194 :
public std::unary_function<const rt_string&, const string&>
196 mutable boost::shared_ptr< string > ptr;
197 typedef const string& (Signature)(
rt_string const& );
198 string_ctor_rt_string()
199 : ptr( new string() ) {}
200 const string& operator()(
rt_string const& arg )
const 214 ti->type(
"double")->addConstructor(
newConstructor( &float_to_double,
true ));
215 ti->type(
"double")->addConstructor(
newConstructor( &int_to_double,
true ));
216 ti->type(
"float")->addConstructor(
newConstructor( &int_to_float,
true ));
217 ti->type(
"float")->addConstructor(
newConstructor( &double_to_float,
true ));
218 ti->type(
"int")->addConstructor(
newConstructor( &float_to_int,
false ));
219 ti->type(
"int")->addConstructor(
newConstructor( &double_to_int,
false ));
220 ti->type(
"int")->addConstructor(
newConstructor( &uint_to_int,
true ));
221 ti->type(
"int")->addConstructor(
newConstructor( &bool_to_int,
true ));
222 ti->type(
"uint")->addConstructor(
newConstructor( &int_to_uint,
true ));
223 ti->type(
"string")->addConstructor(
newConstructor( string_ctor() ) );
225 ti->type(
"rt_string")->addConstructor(
newConstructor( rt_string_ctor_int() ) );
226 ti->type(
"rt_string")->addConstructor(
newConstructor( rt_string_ctor_string() ) );
227 ti->type(
"string")->addConstructor(
newConstructor( string_ctor_rt_string() ) );
229 ti->type(
"bool")->addConstructor(
newConstructor( &flow_to_bool,
true ) );
230 ti->type(
"bool")->addConstructor(
newConstructor( &send_to_bool,
true ) );
231 ti->type(
"bool")->addConstructor(
newConstructor( &int_to_bool,
true ) );
std::basic_string< char, std::char_traits< char >, RTT::os::rt_allocator< char > > rt_string
Real-time allocatable, dynamically-sized string.
boost::intrusive_ptr< ArrayDataSource< T > > shared_ptr
FlowStatus
Returns the status of a data flow read.
SendStatus
Returns the status of a send() or collect() invocation.
TypeConstructor * newConstructor(Function *foo, bool automatic=false)
Create a new Constructor.
boost::intrusive_ptr< DataSource< double > > shared_ptr
Returned when the send() succeeded, but the operation has not yet been executed by the receiving comp...
virtual bool loadConstructors()
Implement this method to load Scripting constructors of types, such as in C++.
static shared_ptr Instance()
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
boost::shared_ptr< TypeInfoRepository > shared_ptr