[openrtm-commit:01961] r628 - in trunk/rtmtools/jp.go.aist.rtm.rtcbuilder: resource/100/CXX/ConfigSet resource/100/CXX/ConfigSet/configset4 src/jp/go/aist/rtm/rtcbuilder/template/cpp test/jp/go/aist/rtm/rtcbuilder/_test/_100

openrtm @ openrtm.org openrtm @ openrtm.org
2016年 5月 25日 (水) 19:59:08 JST


Author: ga
Date: 2016-05-25 19:59:08 +0900 (Wed, 25 May 2016)
New Revision: 628

Added:
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.cpp
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.h
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/fooComp.cpp
Modified:
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/template/cpp/CXX_RTC.cpp.vsl
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXConfigSetTest.java
Log:
fixed "conf.__type__.***".

Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.cpp
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.cpp	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.cpp	2016-05-25 10:59:08 UTC (rev 628)
@@ -0,0 +1,178 @@
+// -*- C++ -*-
+/*!
+ * @file  foo.cpp
+ * @brief MDesc
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#include "foo.h"
+
+// Module specification
+// <rtc-template block="module_spec">
+static const char* foo_spec[] =
+  {
+    "implementation_id", "foo",
+    "type_name",         "foo",
+    "description",       "MDesc",
+    "version",           "1.0.3",
+    "vendor",            "TA2",
+    "category",          "manip2",
+    "activity_type",     "PERIODIC2",
+    "kind",              "DataFlowComponent",
+    "max_instance",      "3",
+    "language",          "C++",
+    "lang_type",         "compile",
+    // Configuration variables
+    "conf.default.test", "0",
+
+    // Widget
+    "conf.__widget__.test", "slider.0.2",
+    // Constraints
+    "conf.__constraints__.test", "-1.0<x<1.0",
+
+    "conf.__type__.test", "double",
+
+    ""
+  };
+// </rtc-template>
+
+/*!
+ * @brief constructor
+ * @param manager Maneger Object
+ */
+foo::foo(RTC::Manager* manager)
+    // <rtc-template block="initializer">
+  : RTC::DataFlowComponentBase(manager)
+
+    // </rtc-template>
+{
+}
+
+/*!
+ * @brief destructor
+ */
+foo::~foo()
+{
+}
+
+
+
+RTC::ReturnCode_t foo::onInitialize()
+{
+  // Registration: InPort/OutPort/Service
+  // <rtc-template block="registration">
+  // Set InPort buffers
+  
+  // Set OutPort buffer
+  
+  // Set service provider to Ports
+  
+  // Set service consumers to Ports
+  
+  // Set CORBA Service Ports
+  
+  // </rtc-template>
+
+  // <rtc-template block="bind_config">
+  // Bind variables and configuration variable
+  bindParameter("test", m_test, "0");
+  // </rtc-template>
+  
+  return RTC::RTC_OK;
+}
+
+/*
+RTC::ReturnCode_t foo::onFinalize()
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onStartup(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onShutdown(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onActivated(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onDeactivated(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onExecute(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onAborting(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onError(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onReset(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onStateUpdate(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+/*
+RTC::ReturnCode_t foo::onRateChanged(RTC::UniqueId ec_id)
+{
+  return RTC::RTC_OK;
+}
+*/
+
+
+
+extern "C"
+{
+ 
+  void fooInit(RTC::Manager* manager)
+  {
+    coil::Properties profile(foo_spec);
+    manager->registerFactory(profile,
+                             RTC::Create<foo>,
+                             RTC::Delete<foo>);
+  }
+  
+};
+
+

Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.h
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.h	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/foo.h	2016-05-25 10:59:08 UTC (rev 628)
@@ -0,0 +1,283 @@
+// -*- C++ -*-
+/*!
+ * @file  foo.h
+ * @brief MDesc
+ * @date  $Date$
+ *
+ * $Id$
+ */
+
+#ifndef FOO_H
+#define FOO_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">
+
+// </rtc-template>
+
+// Service Consumer stub headers
+// <rtc-template block="consumer_stub_h">
+
+// </rtc-template>
+
+// Service Consumer stub headers
+// <rtc-template block="port_stub_h">
+// </rtc-template>
+
+#include <rtm/Manager.h>
+#include <rtm/DataFlowComponentBase.h>
+#include <rtm/CorbaPort.h>
+#include <rtm/DataInPort.h>
+#include <rtm/DataOutPort.h>
+
+using namespace RTC;
+
+/*!
+ * @class foo
+ * @brief MDesc
+ *
+ */
+class foo
+  : public RTC::DataFlowComponentBase
+{
+ public:
+  /*!
+   * @brief constructor
+   * @param manager Maneger Object
+   */
+  foo(RTC::Manager* manager);
+
+  /*!
+   * @brief destructor
+   */
+  ~foo();
+
+  // <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>
+
+  // Configuration variable declaration
+  // <rtc-template block="config_declare">
+  /*!
+   * 
+   * - Name:  test
+   * - DefaultValue: 0
+   */
+  double m_test;
+
+  // </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-template>
+
+  // Service declaration
+  // <rtc-template block="service_declare">
+  
+  // </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 fooInit(RTC::Manager* manager);
+};
+
+#endif // FOO_H

Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/fooComp.cpp
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/fooComp.cpp	                        (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/resource/100/CXX/ConfigSet/configset4/fooComp.cpp	2016-05-25 10:59:08 UTC (rev 628)
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+/*!
+ * @file fooComp.cpp
+ * @brief Standalone component
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#include <rtm/Manager.h>
+#include <iostream>
+#include <string>
+#include <stdlib.h>
+#include "foo.h"
+
+
+void MyModuleInit(RTC::Manager* manager)
+{
+  fooInit(manager);
+  RTC::RtcBase* comp;
+
+  // Create a component
+  comp = manager->createComponent("foo");
+
+  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;
+}

Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/template/cpp/CXX_RTC.cpp.vsl
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/template/cpp/CXX_RTC.cpp.vsl	2016-05-25 10:23:09 UTC (rev 627)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/src/jp/go/aist/rtm/rtcbuilder/template/cpp/CXX_RTC.cpp.vsl	2016-05-25 10:59:08 UTC (rev 628)
@@ -44,7 +44,7 @@
 #end
 
 #foreach($configParam in ${rtcParam.configParams})
-    "conf.__type__.${configParam.name}", "${configParam.type}#if( ${configParam.step.length()} > 0 )#end",
+    "conf.__type__.${configParam.name}", "${configParam.type}",
 #end
 
 #end

Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXConfigSetTest.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXConfigSetTest.java	2016-05-25 10:23:09 UTC (rev 627)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder/test/jp/go/aist/rtm/rtcbuilder/_test/_100/CXXConfigSetTest.java	2016-05-25 10:59:08 UTC (rev 628)
@@ -77,6 +77,22 @@
 		checkResults(result, resourceDir);
 	}
 
+	public void testConfigSet4() throws Exception{
+		List<ConfigSetParam> configset = new ArrayList<ConfigSetParam>(); 
+		ConfigSetParam param01 = new ConfigSetParam("test", "double", "", "0");
+		param01.setWidget("slider");
+		param01.setStep("0.2");
+		param01.setConstraint("-1.0<x<1.0");
+		configset.add(param01);
+		rtcParam.getConfigParams().addAll(configset);
+
+		Generator generator = new Generator();
+		List<GeneratedResult> result = generator.generateTemplateCode(genParam);
+
+		String resourceDir = rootPath +  "/resource/100/CXX/ConfigSet/configset4/";
+		checkResults(result, resourceDir);
+	}
+	
 	public void testConfigSetType() throws Exception{
 		List<ConfigSetParam> configset = new ArrayList<ConfigSetParam>(); 
 		configset.add(new ConfigSetParam("short_param","short","", "0"));



More information about the openrtm-commit mailing list