18 #ifndef OutPortCorbaCdrProvider_cpp 19 #define OutPortCorbaCdrProvider_cpp 21 #include <cppunit/ui/text/TestRunner.h> 22 #include <cppunit/TextOutputter.h> 23 #include <cppunit/extensions/TestFactoryRegistry.h> 24 #include <cppunit/extensions/HelperMacros.h> 25 #include <cppunit/TestAssert.h> 27 #include <rtm/idl/BasicDataTypeSkel.h> 28 #include <rtm/idl/DataPortSkel.h> 59 const RTC::TimedLong&
data)
61 std::cout <<
"------------------------------" << std::endl;
62 std::cout <<
"Data Listener: " <<
m_name << std::endl;
63 std::cout <<
"Profile::name: " << info.
name << std::endl;
64 std::cout <<
"------------------------------" << std::endl;
82 std::cout <<
"------------------------------" << std::endl;
83 std::cout <<
"Connector Listener: " <<
m_name << std::endl;
84 std::cout <<
"Profile::name: " << info.
name << std::endl;
85 std::cout <<
"------------------------------" << std::endl;
122 :
public CppUnit::TestFixture
126 CPPUNIT_TEST(test_case0);
127 CPPUNIT_TEST_SUITE_END();
143 m_pORB = CORBA::ORB_init(argc, argv);
144 m_pPOA = PortableServer::POA::_narrow(
145 m_pORB->resolve_initial_references(
"RootPOA"));
146 m_pPOA->the_POAManager()->activate();
230 "dataport.corba_cdr.outport_ior");
231 CPPUNIT_ASSERT(0<=index);
235 "dataport.corba_cdr.outport_ref");
236 CPPUNIT_ASSERT(0<=index);
238 provider->
init(prop);
245 ::OpenRTM::CdrData_var cdr_data;
248 retcode = provider->
get(cdr_data.out());
249 CPPUNIT_ASSERT_EQUAL((::OpenRTM::PortStatus)5, retcode);
260 std::cout <<
"ERROR: Connector creation failed." << std::endl;
265 retcode = provider->
get(cdr_data);
266 CPPUNIT_ASSERT_EQUAL((::OpenRTM::PortStatus)3, retcode);
268 int testdata[8] = { 12,34,56,78,90,23,45,99 };
271 for(
int ic(0);ic<8;++ic)
273 td.data = testdata[ic];
279 retcode = provider->
get(cdr_data);
280 CPPUNIT_ASSERT_EQUAL((::OpenRTM::PortStatus)0, retcode);
285 "dataport.corba_cdr.outport_ior");
288 if (list[index].value >>= ior)
290 CORBA::Object_ptr var = m_pORB->string_to_object(ior);
291 PortableServer::Servant ser = m_pPOA->reference_to_servant(var);
292 m_pPOA->deactivate_object(*m_pPOA->servant_to_id(ser));
307 int main(
int argc,
char* argv[])
320 std::string arg(argv[i]);
321 std::string next_arg;
322 if (i + 1 < argc) next_arg = argv[i + 1];
325 if (arg ==
"--text") { format =
TEXT_OUT;
break; }
338 ofs.open(fname.c_str());
340 if ( arg ==
"--compiler" ) { format =
COMPILER_OUT;
break; }
341 if ( arg ==
"--cerr" ) { target = 1;
break; }
342 if ( arg ==
"--xsl" )
344 if (next_arg ==
"") xsl =
"default.xsl";
347 if ( arg ==
"--namespace" )
351 std::cerr <<
"no namespace specified" << std::endl;
361 CppUnit::TextUi::TestRunner runner;
363 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
365 runner.addTest(CppUnit::TestFactoryRegistry::getRegistry(ns).makeTest());
366 CppUnit::Outputter* outputter = 0;
367 std::ostream* stream = target ? &std::cerr : &std::cout;
371 outputter =
new CppUnit::TextOutputter(&runner.result(),*stream);
374 std::cout <<
"XML_OUT" << std::endl;
375 outputter =
new CppUnit::XmlOutputter(&runner.result(),
377 static_cast<CppUnit::XmlOutputter*
>(outputter)->setStyleSheet(xsl);
380 outputter =
new CppUnit::CompilerOutputter(&runner.result(),*stream);
383 runner.setOutputter(outputter);
388 #endif // OutPortCorbaCdrProvider_cpp
ConnectorListeners class.
int main(int argc, char **argv)
virtual void setConnector(OutPortConnector *connector)
set Connector
OutPortConnector base class.
PortableServer::POA_ptr m_pPOA
void addListener(ConnectorDataListener *listener, bool autoclean)
Add the listener.
std::vector< std::pair< std::string, std::string > > NVList
ConnectorListenerHolder connector_[CONNECTOR_LISTENER_NUM]
ConnectorListenerType listener array The ConnectorListenerType listener is stored.
virtual void tearDown()
Test finalization.
RTC::ConnectorListeners m_listeners
CPPUNIT_TEST_SUITE_REGISTRATION(OutPortCorbaCdrProvider::OutPortCorbaCdrProviderTests)
void addListener(ConnectorListener *listener, bool autoclean)
Add the listener.
static GlobalFactory< AbstractClass, Identifier, Compare, Creator, Destructor > & instance()
Create instance.
virtual ::OpenRTM::PortStatus get(::OpenRTM::CdrData_out data)
[CORBA interface] Get data from the buffer
OutPortCorbaCdrConsumer class.
std::vector< std::string > vstring
const CORBA::Long find_index(const SDOPackage::NVList &nv, const char *name)
Return the index of element specified by name from NVList.
virtual void init(coil::Properties &prop)
Initializing configuration.
ConnectorDataListenerHolder connectorData_[CONNECTOR_DATA_LISTENER_NUM]
ConnectorDataListenerType listener array The ConnectorDataListenerType listener is stored...
virtual void operator()(const RTC::ConnectorInfo &info, const RTC::TimedLong &data)
Virtual Callback method.
ConnectorDataListenerT class.
NameValue and NVList utility functions.
CORBA sequence utility template functions.
std::string name
Connection name.
DataListener(const char *name)
virtual void setListener(ConnectorInfo &info, ConnectorListeners *listeners)
Set the listener.
prop
Organization::get_organization_property ();.
virtual void setBuffer(CdrBufferBase *buffer)
Setting outside buffer's pointer.
OutPortCorbaCdrProviderTests()
Constructor.
Class represents a set of properties.
ConnListener(const char *name)
OutPortPull type connector class.
~OutPortCorbaCdrProviderTests()
Destructor.
SDOPackage::NVList get_m_properties()
OutPortPullConnector class.
virtual ReturnCode write(const DataType &value, long int sec=-1, long int nsec=-1)=0
Write data into the buffer.
virtual void operator()(const RTC::ConnectorInfo &info)
Virtual Callback method.
OutPortCorbaCdrProvider class.
BufferBase abstract class.
virtual void setUp()
Test initialization.
RTC's Port administration class.
OutPortCorbaCdrProvider class.
OutPortCorbaCdrProviderMock(void)
virtual ~OutPortCorbaCdrProviderMock()