[openrtm-commit:00833] r313 - in trunk/rtmtools/jp.go.aist.rtm.rtcbuilder: META-INF resource/100/CXX resource/100/CXX/idlstruct src/jp/go/aist/rtm/rtcbuilder src/jp/go/aist/rtm/rtcbuilder/generator src/jp/go/aist/rtm/rtcbuilder/generator/param/idl src/jp/go/aist/rtm/rtcbuilder/manager test/jp/go/aist/rtm/rtcbuilder/_test/_100
openrtm @ openrtm.org
openrtm @ openrtm.org
2012年 5月 30日 (水) 02:13:44 JST
Author: sakamoto
Date: 2012-05-30 02:13:44 +0900 (Wed, 30 May 2012)
New Revision: 313
Added:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.cpp
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.h
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModuleComp.cpp
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net.idl
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.cpp
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.h
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net_data.idl
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXIDLStructTest.java
Modified:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/META-INF/MANIFEST.MF
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/IDLParamConverter.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/ServiceMethodParam.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/TypeDefParam.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/manager/CXXConverter.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/AllTestsCXX.java
Log:
Modify IDL Parser for struct
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/META-INF/MANIFEST.MF
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/META-INF/MANIFEST.MF 2012-05-25 18:02:02 UTC (rev 312)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/META-INF/MANIFEST.MF 2012-05-29 17:13:44 UTC (rev 313)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: jp.go.aist.rtm.rtcbuilder; singleton:=true
-Bundle-Version: 1.1.0.rc3v20120209
+Bundle-Version: 1.1.0.rc3v20120528
Bundle-ClassPath: .,
lib/velocity-1.6.3-dep.jar
Bundle-Vendor: %providerName
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.cpp
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.cpp (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.cpp 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,166 @@
+// -*- C++ -*-
+/*!
+ * @file TestModule.cpp
+ * @brief ModuleDescription
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#include "TestModule.h"
+
+// Module specification
+// <rtc-template block="module_spec">
+static const char* testmodule_spec[] =
+ {
+ "implementation_id", "TestModule",
+ "type_name", "TestModule",
+ "description", "ModuleDescription",
+ "version", "1.0.0",
+ "vendor", "ysuga_net",
+ "category", "Category",
+ "activity_type", "PERIODIC",
+ "kind", "DataFlowComponent",
+ "max_instance", "1",
+ "language", "C++",
+ "lang_type", "compile",
+ ""
+ };
+// </rtc-template>
+
+/*!
+ * @brief constructor
+ * @param manager Maneger Object
+ */
+TestModule::TestModule(RTC::Manager* manager)
+ // <rtc-template block="initializer">
+ : RTC::DataFlowComponentBase(manager),
+ m_svcPortPort("svcPort")
+
+ // </rtc-template>
+{
+}
+
+/*!
+ * @brief destructor
+ */
+TestModule::~TestModule()
+{
+}
+
+
+
+RTC::ReturnCode_t TestModule::onInitialize()
+{
+ // Registration: InPort/OutPort/Service
+ // <rtc-template block="registration">
+ // Set InPort buffers
+
+ // Set OutPort buffer
+
+ // Set service provider to Ports
+ m_svcPortPort.registerProvider("inf0", "ysuga_net::Hoge", m_inf0);
+
+ // Set service consumers to Ports
+
+ // Set CORBA Service Ports
+ addPort(m_svcPortPort);
+
+ // </rtc-template>
+
+ return RTC::RTC_OK;
+}
+
+/*
+RTC::ReturnCode_t TestModule::onFinalize()
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onStartup(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onShutdown(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onActivated(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onDeactivated(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onExecute(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onAborting(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onError(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onReset(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onStateUpdate(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t TestModule::onRateChanged(RTC::UniqueId ec_id)
+{
+ return RTC::RTC_OK;
+}
+*/
+
+
+
+extern "C"
+{
+
+ void TestModuleInit(RTC::Manager* manager)
+ {
+ coil::Properties profile(testmodule_spec);
+ manager->registerFactory(profile,
+ RTC::Create<TestModule>,
+ RTC::Delete<TestModule>);
+ }
+
+};
+
+
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.h
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.h (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModule.h 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,274 @@
+// -*- C++ -*-
+/*!
+ * @file TestModule.h
+ * @brief ModuleDescription
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#ifndef TESTMODULE_H
+#define TESTMODULE_H
+
+#include <rtm/Manager.h>
+#include <rtm/DataFlowComponentBase.h>
+#include <rtm/CorbaPort.h>
+#include <rtm/DataInPort.h>
+#include <rtm/DataOutPort.h>
+#include <rtm/idl/BasicDataTypeSkel.h>
+#include <rtm/idl/ExtendedDataTypesSkel.h>
+#include <rtm/idl/InterfaceDataTypesSkel.h>
+
+// Service implementation headers
+// <rtc-template block="service_impl_h">
+#include "module_ysuga_netSVC_impl.h"
+
+// </rtc-template>
+
+// Service Consumer stub headers
+// <rtc-template block="consumer_stub_h">
+
+// </rtc-template>
+
+using namespace RTC;
+
+/*!
+ * @class TestModule
+ * @brief ModuleDescription
+ *
+ */
+class TestModule
+ : public RTC::DataFlowComponentBase
+{
+ public:
+ /*!
+ * @brief constructor
+ * @param manager Maneger Object
+ */
+ TestModule(RTC::Manager* manager);
+
+ /*!
+ * @brief destructor
+ */
+ ~TestModule();
+
+ // <rtc-template block="public_attribute">
+
+ // </rtc-template>
+
+ // <rtc-template block="public_operation">
+
+ // </rtc-template>
+
+ /***
+ *
+ * The initialize action (on CREATED->ALIVE transition)
+ * formaer rtc_init_entry()
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ virtual RTC::ReturnCode_t onInitialize();
+
+ /***
+ *
+ * The finalize action (on ALIVE->END transition)
+ * formaer rtc_exiting_entry()
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onFinalize();
+
+ /***
+ *
+ * The startup action when ExecutionContext startup
+ * former rtc_starting_entry()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The shutdown action when ExecutionContext stop
+ * former rtc_stopping_entry()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The activated action (Active state entry action)
+ * former rtc_active_entry()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The deactivated action (Active state exit action)
+ * former rtc_active_exit()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The execution action that is invoked periodically
+ * former rtc_active_do()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The aborting action when main logic error occurred.
+ * former rtc_aborting_entry()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The error action in ERROR state
+ * former rtc_error_do()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The reset action that is invoked resetting
+ * This is same but different the former rtc_init_entry()
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The state update action that is invoked after onExecute() action
+ * no corresponding operation exists in OpenRTm-aist-0.2.0
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
+
+ /***
+ *
+ * The action that is invoked when execution context's rate is changed
+ * no corresponding operation exists in OpenRTm-aist-0.2.0
+ *
+ * @param ec_id target ExecutionContext Id
+ *
+ * @return RTC::ReturnCode_t
+ *
+ *
+ */
+ // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
+
+
+ protected:
+ // <rtc-template block="protected_attribute">
+
+ // </rtc-template>
+
+ // <rtc-template block="protected_operation">
+
+ // </rtc-template>
+
+ // DataInPort declaration
+ // <rtc-template block="inport_declare">
+
+ // </rtc-template>
+
+
+ // DataOutPort declaration
+ // <rtc-template block="outport_declare">
+
+ // </rtc-template>
+
+ // CORBA Port declaration
+ // <rtc-template block="corbaport_declare">
+ /*!
+ */
+ RTC::CorbaPort m_svcPortPort;
+
+ // </rtc-template>
+
+ // Service declaration
+ // <rtc-template block="service_declare">
+ /*!
+ */
+ HogeSVC_impl m_inf0;
+
+ // </rtc-template>
+
+ // Consumer declaration
+ // <rtc-template block="consumer_declare">
+
+ // </rtc-template>
+
+ private:
+ // <rtc-template block="private_attribute">
+
+ // </rtc-template>
+
+ // <rtc-template block="private_operation">
+
+ // </rtc-template>
+
+};
+
+
+extern "C"
+{
+ DLL_EXPORT void TestModuleInit(RTC::Manager* manager);
+};
+
+#endif // TESTMODULE_H
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModuleComp.cpp
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModuleComp.cpp (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/TestModuleComp.cpp 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+/*!
+ * @file TestModuleComp.cpp
+ * @brief Standalone component
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#include <rtm/Manager.h>
+#include <iostream>
+#include <string>
+#include <stdlib.h>
+#include "TestModule.h"
+
+
+void MyModuleInit(RTC::Manager* manager)
+{
+ TestModuleInit(manager);
+ RTC::RtcBase* comp;
+
+ // Create a component
+ comp = manager->createComponent("TestModule");
+
+ if (comp==NULL)
+ {
+ std::cerr << "Component create failed." << std::endl;
+ abort();
+ }
+
+ // Example
+ // The following procedure is examples how handle RT-Components.
+ // These should not be in this function.
+
+ // Get the component's object reference
+// RTC::RTObject_var rtobj;
+// rtobj = RTC::RTObject::_narrow(manager->getPOA()->servant_to_reference(comp));
+
+ // Get the port list of the component
+// PortServiceList* portlist;
+// portlist = rtobj->get_ports();
+
+ // getting port profiles
+// std::cout << "Number of Ports: ";
+// std::cout << portlist->length() << std::endl << std::endl;
+// for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
+// {
+// PortService_ptr port;
+// port = (*portlist)[i];
+// std::cout << "Port" << i << " (name): ";
+// std::cout << port->get_port_profile()->name << std::endl;
+//
+// RTC::PortInterfaceProfileList iflist;
+// iflist = port->get_port_profile()->interfaces;
+// std::cout << "---interfaces---" << std::endl;
+// for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
+// {
+// std::cout << "I/F name: ";
+// std::cout << iflist[i].instance_name << std::endl;
+// std::cout << "I/F type: ";
+// std::cout << iflist[i].type_name << std::endl;
+// const char* pol;
+// pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
+// std::cout << "Polarity: " << pol << std::endl;
+// }
+// std::cout << "---properties---" << std::endl;
+// NVUtil::dump(port->get_port_profile()->properties);
+// std::cout << "----------------" << std::endl << std::endl;
+// }
+
+ return;
+}
+
+int main (int argc, char** argv)
+{
+ RTC::Manager* manager;
+ manager = RTC::Manager::init(argc, argv);
+
+ // Initialize manager
+ manager->init(argc, argv);
+
+ // Set module initialization proceduer
+ // This procedure will be invoked in activateManager() function.
+ manager->setModuleInitProc(MyModuleInit);
+
+ // Activate manager and register to naming service
+ manager->activateManager();
+
+ // run the manager in blocking mode
+ // runManager(false) is the default.
+ manager->runManager();
+
+ // If you want to run the manager in non-blocking mode, do like this
+ // manager->runManager(true);
+
+ return 0;
+}
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net.idl
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net.idl (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net.idl 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,8 @@
+#include "module_ysuga_net_data.idl"
+
+module ysuga_net {
+
+ interface Hoge {
+ RETVAL foo();
+ };
+};
\ No newline at end of file
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.cpp
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.cpp (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.cpp 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,43 @@
+// -*-C++-*-
+/*!
+ * @file module_ysuga_netSVC_impl.cpp
+ * @brief Service implementation code of module_ysuga_net.idl
+ *
+ */
+
+#include "module_ysuga_netSVC_impl.h"
+
+/*
+ * Example implementational code for IDL interface ysuga_net::Hoge
+ */
+HogeSVC_impl::HogeSVC_impl()
+{
+ // Please add extra constructor code here.
+}
+
+
+HogeSVC_impl::~HogeSVC_impl()
+{
+ // Please add extra destructor code here.
+}
+
+
+/*
+ * Methods corresponding to IDL attributes and operations
+ */
+ysuga_net::RETVAL* HogeSVC_impl::foo()
+{
+ ysuga_net::RETVAL* result;
+ // Please insert your code here and remove the following warning pragma
+#ifndef WIN32
+ #warning "Code missing in function <ysuga_net::RETVAL* HogeSVC_impl::foo()>"
+#endif
+ return result;
+}
+
+
+
+// End of example implementational code
+
+
+
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.h
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.h (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_netSVC_impl.h 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,47 @@
+// -*-C++-*-
+/*!
+ * @file module_ysuga_netSVC_impl.h
+ * @brief Service implementation header of module_ysuga_net.idl
+ *
+ */
+
+#include "module_ysuga_net_dataSkel.h"
+
+#include "module_ysuga_netSkel.h"
+
+#ifndef MODULE_YSUGA_NETSVC_IMPL_H
+#define MODULE_YSUGA_NETSVC_IMPL_H
+
+/*!
+ * @class HogeSVC_impl
+ * Example class implementing IDL interface ysuga_net::Hoge
+ */
+class HogeSVC_impl
+ : public virtual POA_ysuga_net::Hoge,
+ public virtual PortableServer::RefCountServantBase
+{
+ private:
+ // Make sure all instances are built on the heap by making the
+ // destructor non-public
+ //virtual ~HogeSVC_impl();
+
+ public:
+ /*!
+ * @brief standard constructor
+ */
+ HogeSVC_impl();
+ /*!
+ * @brief destructor
+ */
+ virtual ~HogeSVC_impl();
+
+ // attributes and operations
+ ysuga_net::RETVAL* foo();
+
+};
+
+
+
+#endif // MODULE_YSUGA_NETSVC_IMPL_H
+
+
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net_data.idl
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net_data.idl (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/idlstruct/module_ysuga_net_data.idl 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,7 @@
+module ysuga_net {
+ struct RETVAL {
+ long id;
+ string msg;
+ };
+
+};
\ No newline at end of file
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java 2012-05-25 18:02:02 UTC (rev 312)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/Generator.java 2012-05-29 17:13:44 UTC (rev 313)
@@ -47,7 +47,6 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.IDialogConstants;
/**
@@ -363,6 +362,7 @@
if(target.getType().equals(tdparam.getTargetDef())) {
target.setSequence(tdparam.isSequence());
target.setString(tdparam.isString());
+ target.setChildString(tdparam.isChildString());
target.setArray(tdparam.isArray());
target.setStruct(tdparam.isStruct() || tdparam.isEnum());
break;
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/IDLParamConverter.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/IDLParamConverter.java 2012-05-25 18:02:02 UTC (rev 312)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/IDLParamConverter.java 2012-05-29 17:13:44 UTC (rev 313)
@@ -192,6 +192,9 @@
@Override
public void visit(simple_type_spec n) {
tdparam.getChildType().add(node2String(n));
+ if(node2String(n).toLowerCase().equals("string") ) {
+ tdparam.setChildString(true);
+ }
}
});
result.add(tdparam);
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/ServiceMethodParam.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/ServiceMethodParam.java 2012-05-25 18:02:02 UTC (rev 312)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/ServiceMethodParam.java 2012-05-29 17:13:44 UTC (rev 313)
@@ -17,6 +17,7 @@
private boolean isArray;
private boolean isStruct;
private boolean isString;
+ private boolean isChildString;
private List<ServiceArgumentParam> arguments = new ArrayList<ServiceArgumentParam>();
@@ -83,4 +84,11 @@
public void setString(boolean isString) {
this.isString = isString;
}
+
+ public boolean isChildString() {
+ return isChildString;
+ }
+ public void setChildString(boolean isChildString) {
+ this.isChildString = isChildString;
+ }
}
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/TypeDefParam.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/TypeDefParam.java 2012-05-25 18:02:02 UTC (rev 312)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/generator/param/idl/TypeDefParam.java 2012-05-29 17:13:44 UTC (rev 313)
@@ -18,6 +18,7 @@
private boolean isArray;
private boolean isStruct;
private boolean isEnum;
+ private boolean isChildString;
private List<String> childType;
public TypeDefParam() {
@@ -29,6 +30,7 @@
isArray = false;
isStruct = false;
isEnum = false;
+ isChildString = false;
childType = new ArrayList<String>();
}
@@ -88,6 +90,13 @@
this.isEnum = isEnum;
}
+ public boolean isChildString() {
+ return isChildString;
+ }
+ public void setChildString(boolean isChildString) {
+ this.isChildString = isChildString;
+ }
+
public List<String> getChildType() {
return childType;
}
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/manager/CXXConverter.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/manager/CXXConverter.java 2012-05-25 18:02:02 UTC (rev 312)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/manager/CXXConverter.java 2012-05-29 17:13:44 UTC (rev 313)
@@ -150,7 +150,7 @@
if( !typeDef.getType().contains("::") ) {
if(typeDef.isArray()) {
result = result + "_slice*";
- } else if(typeDef.isSequence() || typeDef.isString()) {
+ } else if(typeDef.isSequence() || typeDef.isString() || typeDef.isChildString()) {
result = result + "*";
}
}
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/AllTestsCXX.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/AllTestsCXX.java 2012-05-25 18:02:02 UTC (rev 312)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/AllTestsCXX.java 2012-05-29 17:13:44 UTC (rev 313)
@@ -29,6 +29,7 @@
suite.addTestSuite(CXXBaseClass.class);
suite.addTestSuite(CXXLibraryTest.class);
suite.addTestSuite(CXXConfigSetTest.class);
+ suite.addTestSuite(CXXIDLStructTest.class);
//$JUnit-END$
return suite;
}
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXIDLStructTest.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXIDLStructTest.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXIDLStructTest.java 2012-05-29 17:13:44 UTC (rev 313)
@@ -0,0 +1,68 @@
+package jp.go.aist.rtm.rtcbuilder._test._100;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import jp.go.aist.rtm.rtcbuilder.Generator;
+import jp.go.aist.rtm.rtcbuilder.IRtcBuilderConstants;
+import jp.go.aist.rtm.rtcbuilder._test.TestBase;
+import jp.go.aist.rtm.rtcbuilder.generator.GeneratedResult;
+import jp.go.aist.rtm.rtcbuilder.generator.param.DataPortParam;
+import jp.go.aist.rtm.rtcbuilder.generator.param.GeneratorParam;
+import jp.go.aist.rtm.rtcbuilder.generator.param.RtcParam;
+import jp.go.aist.rtm.rtcbuilder.generator.param.ServicePortInterfaceParam;
+import jp.go.aist.rtm.rtcbuilder.generator.param.ServicePortParam;
+
+public class CXXIDLStructTest extends TestBase {
+
+ RtcParam rtcParam;
+ GeneratorParam genParam;
+
+ protected void setUp() throws Exception {
+ genParam = new GeneratorParam();
+ rtcParam = new RtcParam(genParam, true);
+ rtcParam.setOutputProject(rootPath + "/resource/work");
+ rtcParam.setLanguage(IRtcBuilderConstants.LANG_CPP);
+ rtcParam.setLanguageArg(IRtcBuilderConstants.LANG_CPP_ARG);
+ rtcParam.setRtmVersion("1.0.0");
+ rtcParam.setIsTest(true);
+ rtcParam.setEnableOldBuildEnv(true);
+ genParam.getRtcParams().add(rtcParam);
+ }
+
+ public void testIDLStruct() throws Exception {
+ rtcParam.setName("TestModule");
+ rtcParam.setDescription("ModuleDescription");
+ rtcParam.setVersion("1.0.0");
+ rtcParam.setVender("ysuga_net");
+ rtcParam.setCategory("Category");
+ rtcParam.setComponentType("STATIC");
+ rtcParam.setActivityType("PERIODIC");
+ rtcParam.setMaxInstance(1);
+ rtcParam.setComponentKind("DataFlowComponent");
+
+ ServicePortParam service1 = new ServicePortParam("svcPort", 0);
+ List<ServicePortInterfaceParam> srvinterts = new ArrayList<ServicePortInterfaceParam>();
+ ServicePortInterfaceParam int1 = new ServicePortInterfaceParam(
+ service1, "inf0", "inf0", "", rootPath + "/resource/100/CXX/idlstruct/module_ysuga_net.idl",
+ "ysuga_net::Hoge", rootPath + "/resource/100/CXX/idlstruct/", 0);
+ srvinterts.add(int1);
+ service1.getServicePortInterfaces().addAll(srvinterts);
+ List<ServicePortParam> srvports = new ArrayList<ServicePortParam>();
+ srvports.add(service1);
+
+ rtcParam.getServicePorts().addAll(srvports);
+
+ Generator generator = new Generator();
+ List<GeneratedResult> result = generator.generateTemplateCode(genParam);
+
+ String resourceDir = rootPath + "/resource/100/CXX/idlstruct/";
+
+ assertEquals(17, result.size());
+ checkCode(result, resourceDir, "TestModuleComp.cpp");
+ checkCode(result, resourceDir, "TestModule.h");
+ checkCode(result, resourceDir, "TestModule.cpp");
+ checkCode(result, resourceDir, "module_ysuga_netSVC_impl.h");
+ checkCode(result, resourceDir, "module_ysuga_netSVC_impl.cpp");
+ }
+}
More information about the openrtm-commit
mailing list