00001 /*************************************************************************** 00002 tag: The SourceWorks Tue Sep 7 00:54:57 CEST 2010 corba_test.hpp 00003 00004 corba_test.hpp - description 00005 ------------------- 00006 begin : Tue September 07 2010 00007 copyright : (C) 2010 The SourceWorks 00008 email : peter@thesourceworks.com 00009 00010 *************************************************************************** 00011 * * 00012 * This program is free software; you can redistribute it and/or modify * 00013 * it under the terms of the GNU General Public License as published by * 00014 * the Free Software Foundation; either version 2 of the License, or * 00015 * (at your option) any later version. * 00016 * * 00017 ***************************************************************************/ 00018 00019 00020 #ifndef CORBA_TEST_H 00021 #define CORBA_TEST_H 00022 00023 #include <transports/corba/corba.h> 00024 #include <rtt/InputPort.hpp> 00025 #include <rtt/OutputPort.hpp> 00026 #include <rtt/TaskContext.hpp> 00027 #include <transports/corba/TaskContextServer.hpp> 00028 #include <transports/corba/TaskContextProxy.hpp> 00029 #include <string> 00030 00031 using namespace RTT; 00032 using namespace RTT::detail; 00033 00034 class CorbaTest 00035 { 00036 public: 00037 CorbaTest() { this->setUp(); } 00038 ~CorbaTest() { this->tearDown(); } 00039 00040 TaskContext* tc; 00041 TaskContext* t2; 00042 TaskContext* tp; 00043 corba::TaskContextServer* ts; 00044 TaskContext* tp2; 00045 corba::TaskContextServer* ts2; 00046 Service* createOperationCallerFactory(); 00047 00048 base::PortInterface* signalled_port; 00049 void new_data_listener(base::PortInterface* port); 00050 00051 // Ports 00052 InputPort<double>* mi1; 00053 OutputPort<double>* mo1; 00054 InputPort<double>* mi2; 00055 OutputPort<double>* mo2; 00056 00057 // ref/const-ref tests: 00058 double ret; 00059 double& m0r() { return ret; } 00060 const double& m0cr() { return ret; } 00061 00062 // test const std::string& argument for command_ds 00063 bool comstr(const std::string& cs) { return !cs.empty(); } 00064 00065 double m1r(double& a) { a = 2*a; return a; } 00066 double m1cr(const double& a) { return a; } 00067 00068 // plain argument tests: 00069 double m0() { return -1.0; } 00070 double m1(int i) { return -2.0; } 00071 double m2(int i, double d) { return -3.0; } 00072 double m3(int i, double d, bool c) { return -4.0; } 00073 double m4(int i, double d, bool c, std::string s) { return -5.0; } 00074 00075 // void(void) function test: 00076 void vm0(void) { ; } 00077 00078 bool assertBool( bool ); 00079 00080 void setupCorba(); 00081 void cleanupCorba(); 00082 00083 void setUp(); 00084 void tearDown(); 00085 00086 void testRemoteOperationCallerC(); 00087 void testRemoteOperationCaller(); 00088 void testAnyOperationCaller(); 00089 00090 void testDataFlowInterface(); 00091 00092 void testPortConnections(); 00093 void testPortProxying(); 00094 00095 void testHalfs(); 00096 00097 // helper test functions 00098 void testPortDataConnection(); 00099 void testPortBufferConnection(); 00100 void testPortDisconnected(); 00101 }; 00102 00103 #endif