[openrtm-commit:01150] r460 - in branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor: . template

openrtm @ openrtm.org openrtm @ openrtm.org
2014年 1月 14日 (火) 00:27:33 JST


Author: win-ei
Date: 2014-01-14 00:27:33 +0900 (Tue, 14 Jan 2014)
New Revision: 460

Added:
   branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/
   branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortContTbl.c.vsl
Log:
Daily work.

Added: branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortContTbl.c.vsl
===================================================================
--- branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortContTbl.c.vsl	                        (rev 0)
+++ branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortContTbl.c.vsl	2014-01-13 15:27:33 UTC (rev 460)
@@ -0,0 +1,110 @@
+// -*- C -*-
+/*!
+ * @file ${rtcParam.name}Comp.c
+ * @brief Standalone component
+#set( $Date$ = "dummy" )
+ * @date \$Date$
+#if( ${rtcParam.docCreator.length()} > 0 )
+ *
+ * @author ${tmpltHelper.convertAuthorDoc(${rtcParam.docCreator})}
+#end
+#if( ${rtcParam.docLicense.length()} > 0 )
+ *
+ * ${tmpltHelper.convertDoc(${rtcParam.docLicense})}
+#end
+ *
+#set( $Id$ = "dummy" )
+ * \$Id$
+ */
+
+import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ModuleInitProc;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.Properties;
+
+/*!
+ * @class ${rtcParam.name}Comp
+ * @brief Standalone component Class
+ *
+ */
+public class ${rtcParam.name}Comp implements ModuleInitProc {
+
+    public void myModuleInit(Manager mgr) {
+      Properties prop = new Properties(${rtcParam.name}.component_conf);
+      mgr.registerFactory(prop, new ${rtcParam.name}(), new ${rtcParam.name}());
+
+      // Create a component
+      RTObject_impl comp = mgr.createComponent("${rtcParam.name}");
+      if( comp==null ) {
+    	  System.err.println("Component create failed.");
+    	  System.exit(0);
+      }
+      
+      // Example
+      // The following procedure is examples how handle RT-Components.
+      // These should not be in this function.
+
+//      // Get the component's object reference
+//      Manager manager = Manager.instance();
+//      RTObject rtobj = null;
+//      try {
+//          rtobj = RTObjectHelper.narrow(manager.getPOA().servant_to_reference(comp));
+//      } catch (ServantNotActive e) {
+//          e.printStackTrace();
+//      } catch (WrongPolicy e) {
+//          e.printStackTrace();
+//      }
+//
+//      // Get the port list of the component
+//      PortListHolder portlist = new PortListHolder();
+//      portlist.value = rtobj.get_ports();
+//
+//      // getting port profiles
+//      System.out.println( "Number of Ports: " );
+//      System.out.println( portlist.value.length );
+//      for( int intIdx=0;intIdx<portlist.value.length;++intIdx ) {
+//          Port port = portlist.value[intIdx];
+//          System.out.println( "Port" + intIdx + " (name): ");
+//          System.out.println( port.get_port_profile().name );
+//        
+//          PortInterfaceProfileListHolder iflist = new PortInterfaceProfileListHolder();
+//          iflist.value = port.get_port_profile().interfaces;
+//          System.out.println( "---interfaces---" );
+//          for( int intIdx2=0;intIdx2<iflist.value.length;++intIdx2 ) {
+//              System.out.println( "I/F name: " );
+//              System.out.println( iflist.value[intIdx2].instance_name  );
+//              System.out.println( "I/F type: " );
+//              System.out.println( iflist.value[intIdx2].type_name );
+//              if( iflist.value[intIdx2].polarity==PortInterfacePolarity.PROVIDED ) {
+//                  System.out.println( "Polarity: PROVIDED" );
+//              } else {
+//                  System.out.println( "Polarity: REQUIRED" );
+//              }
+//          }
+//          System.out.println( "---properties---" );
+//          NVUtil.dump( new NVListHolder(port.get_port_profile().properties) );
+//          System.out.println( "----------------" );
+//      }
+    }
+
+    public static void main(String[] args) {
+        // Initialize manager
+        final Manager manager = Manager.init(args);
+
+        // Set module initialization proceduer
+        // This procedure will be invoked in activateManager() function.
+        ${rtcParam.name}Comp init = new ${rtcParam.name}Comp();
+        manager.setModuleInitProc(init);
+
+        // 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);
+    }
+
+}



More information about the openrtm-commit mailing list