41 op0r(
"op0r"), op0cr(
"op0cr"), op1r(
"op1r"), op1cr(
"op1cr"), op0(
"op0"), op1(
"op1"), op2(
"op2"), op3(
"op3"), op4(
"op4"), op5(
"op5"),
42 opc0r(
"op0r"), opc0cr(
"op0cr"), opc1r(
"op1r"), opc1cr(
"op1cr"), opc0(
"op0"), opc1(
"op1"), opc2(
"op2"), opc3(
"op3"), opc4(
"op4"), opc5(
"op5")
52 BOOST_CHECK( tc.provides()->getOperation(
"op0") );
53 BOOST_CHECK( tc.provides()->getOperation(
"op1") );
54 BOOST_CHECK( tc.provides()->getOperation(
"op2") );
55 BOOST_CHECK( tc.provides()->getOperation(
"op3") );
56 BOOST_CHECK( tc.provides()->getOperation(
"op4") );
57 BOOST_CHECK( tc.provides()->getOperation(
"op5") );
70 const double&
func0cr(
void) {
return ret; }
72 double func1r(
double& a) { a = 2*a;
return a; }
73 double func1cr(
const double& a) {
return a; }
78 double func1(
int i) {
return 2.0; }
79 double func2(
int i,
double d) {
return 3.0; }
80 double func3(
int i,
double d,
bool c) {
return 4.0; }
81 double func4(
int i,
double d,
bool c, std::string s) {
return 5.0; }
82 double func5(
int i,
double d,
bool c, std::string s,
float f) {
return 6.0; }
85 double sig0() {
return sig=-1.0; }
86 double sig1(
int i) {
return (sig=-2.0); }
87 double sig2(
int i,
double d) {
return sig=-3.0; }
88 double sig3(
int i,
double d,
bool c) {
return (sig=-4.0); }
89 double sig4(
int i,
double d,
bool c, std::string s) {
return sig=-5.0; }
90 double sig5(
int i,
double d,
bool c, std::string s,
float f) {
return sig=-6.0; }
130 BOOST_CHECK( op0.getName() ==
"op0" );
132 BOOST_CHECK( op0.ready() ==
false);
141 tc.provides()->addService( s );
150 s->addOperation( op0 );
151 s->addOperation( op1 );
152 s->addOperation( op2 );
153 s->addOperation( op3 );
154 s->addOperation( op4 );
155 s->addOperation( op5 );
159 BOOST_CHECK( m0.
ready() == false );
160 m0 = op0.getImplementation();
161 BOOST_CHECK( m0.ready() );
162 BOOST_CHECK_EQUAL( 1.0, m0.call() );
170 tc.provides()->addService( s );
181 BOOST_CHECK( m0.
ready() == false );
182 m0 = s->getOperation(
"op0");
183 BOOST_CHECK( m0.ready() );
184 BOOST_CHECK_EQUAL( 1.0, m0.call() );
192 tc.provides()->addService( s );
195 BOOST_CHECK( s->getOperation(
"top0") );
196 BOOST_CHECK( s->getOperation(
"top1") );
197 opc0 = s->getOperation(
"top0");
198 opc1 = s->getOperation(
"top1");
199 BOOST_CHECK( opc0.ready() );
200 BOOST_CHECK( opc1.ready() );
201 BOOST_CHECK_EQUAL(opc0(), 1.0);
202 BOOST_CHECK_EQUAL(opc1(1), 2.0);
207 BOOST_CHECK( tc.provides()->getOperation(
"tcop0") );
208 BOOST_CHECK( tc.provides()->getOperation(
"tcop1") );
209 opc0 = tc.provides()->getOperation(
"tcop0");
210 opc1 = tc.provides()->getOperation(
"tcop1");
211 BOOST_CHECK( opc0.ready() );
212 BOOST_CHECK( opc1.ready() );
213 BOOST_CHECK_EQUAL(opc0(), 1.0);
214 BOOST_CHECK_EQUAL(opc1(1), 2.0);
220 BOOST_CHECK( tc.provides()->getOperation(
"tcop0") );
221 BOOST_CHECK( tc.provides()->getOperation(
"tcop1") );
222 opc1 = tc.provides()->getOperation(
"tcop0");
223 opc2 = tc.provides()->getOperation(
"tcop1");
224 BOOST_CHECK( opc1.ready() );
225 BOOST_CHECK( opc2.ready() );
226 BOOST_CHECK_EQUAL(opc1(1), 2.0);
227 BOOST_CHECK_EQUAL(opc2(1,2.0), 3.0);
235 tc.provides()->addService( s );
238 BOOST_CHECK( s->getOperation(
"top0") );
239 BOOST_CHECK( s->getOperation(
"top1") );
240 opc0 = s->getOperation(
"top0");
241 opc1 = s->getOperation(
"top1");
242 BOOST_CHECK( opc0.ready() );
243 BOOST_CHECK( opc1.ready() );
244 BOOST_CHECK_EQUAL(opc0(), 1.0);
245 BOOST_CHECK_EQUAL(opc1(1), 2.0);
250 BOOST_CHECK( tc.getOperation(
"top0") );
251 BOOST_CHECK( tc.getOperation(
"top1") );
252 opc0 = tc.getOperation(
"top0");
253 opc1 = tc.getOperation(
"top1");
254 BOOST_CHECK( opc0.ready() );
255 BOOST_CHECK( opc1.ready() );
256 BOOST_CHECK_EQUAL(opc0(), 1.0);
257 BOOST_CHECK_EQUAL(opc1(1), 2.0);
265 BOOST_CHECK( m0.
ready() == false );
266 m0 = tc.getOperation(
"op0");
267 BOOST_CHECK( m0.ready() );
268 BOOST_CHECK_EQUAL( 1.0, m0.call() );
271 #ifdef ORO_SIGNALLING_OPERATIONS 281 BOOST_CHECK( m0.ready() == false );
282 m0 = op0.getImplementation();
283 BOOST_CHECK( m0.ready() );
288 BOOST_FAIL(
"Should not throw a SendFailure!");
291 BOOST_CHECK_EQUAL( -1.0, sig );
296 BOOST_CHECK_EQUAL( -1.0, sig );
308 BOOST_CHECK( m0.ready() == false );
309 m0 = op0.getImplementation();
310 BOOST_CHECK( m0.ready() );
312 BOOST_CHECK_EQUAL( 1.0, m0.call() );
314 BOOST_CHECK_EQUAL( -1.0, sig );
319 BOOST_CHECK_EQUAL( -1.0, sig );
double func1cr(const double &a)
OperationCaller< const double &(void)> opc0cr
#define BOOST_FIXTURE_TEST_SUITE(suite_name, F)
OperationCaller< double &(void)> opc0r
BOOST_AUTO_TEST_CASE(testOperationCreate)
OperationCaller< double(int, double, bool, std::string)> opc4
#define BOOST_AUTO_TEST_SUITE_END()
Operation< double(int, double, bool, std::string, float)> op5
static double freefunc1(int i)
OperationCaller< double(int, double, bool, std::string, float)> opc5
Operation< double(double &)> op1r
double func2(int i, double d)
OperationCaller< double(int, double, bool)> opc3
double func4(int i, double d, bool c, std::string s)
Operation< double &(const double &)> op1cr
boost::shared_ptr< Service > shared_ptr
OperationCaller< double(double &)> opc1r
static double freefunc0(void)
Operation< const double &(void)> op0cr
double sig4(int i, double d, bool c, std::string s)
Operation< double(int, double, bool)> op3
double sig5(int i, double d, bool c, std::string s, float f)
double func5(int i, double d, bool c, std::string s, float f)
Operation< double(int)> op1
OperationCaller< double &(const double &)> opc1cr
double sig3(int i, double d, bool c)
const double & func0cr(void)
OperationCaller< double(int, double)> opc2
Operation< double(int, double)> op2
Operation< double(int, double, bool, std::string)> op4
OperationCaller< double(int)> opc1
OperationCaller< double(void)> opc0
Operation< double(void)> op0
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
double sig2(int i, double d)
Operation< double &(void)> op0r
The Handle holds the information, and allows manipulation, of a connection between a internal::Signal...
double func3(int i, double d, bool c)