[openrtm-commit:03123] r792 - in trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python: manager template/python

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 1月 23日 (火) 22:46:17 JST


Author: ga
Date: 2018-01-23 22:46:17 +0900 (Tue, 23 Jan 2018)
New Revision: 792

Removed:
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_SVC_idl.py.vsl
Modified:
   trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonGenerateManager.java
Log:
Added function to output test RTC. #4433

Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonGenerateManager.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonGenerateManager.java	2018-01-23 13:41:03 UTC (rev 791)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonGenerateManager.java	2018-01-23 13:46:17 UTC (rev 792)
@@ -112,7 +112,6 @@
 		gr = generatePythonSource(contextMap);
 		result.add(gr);
 
-//		if ( 0<allIdlFileParams.size() || 0<rtcParam.getIdlPathes().size()) {
 		if ( 0<allIdlFileParams.size() ) {
 			gr = generateIDLCompileBat(contextMap);
 			result.add(gr);
@@ -127,6 +126,14 @@
 			gr = generateSVCIDLExampleSource(contextMap);
 			result.add(gr);
 		}
+		//////////
+		gr = generatePythonTestSource(contextMap);
+		result.add(gr);
+		for (IdlFileParam idlFileParam : rtcParam.getConsumerIdlPathes()) {
+			contextMap.put("idlFileParam", idlFileParam);
+			gr = generateTestSVCIDLExampleSource(contextMap);
+			result.add(gr);
+		}
 
 		return result;
 	}
@@ -140,14 +147,6 @@
 		return generate(infile, outfile, contextMap);
 	}
 
-	public GeneratedResult generateSVCIDLSource(Map<String, Object> contextMap) {
-		IdlFileParam idlParam = (IdlFileParam) contextMap.get("idlFileParam");
-		String outfile = TemplateHelper.getFilenameNoExt(idlParam.getIdlPath())
-				+ "_idl.py";
-		String infile = "python/Py_SVC_idl.py.vsl";
-		return generate(infile, outfile, contextMap);
-	}
-
 	public GeneratedResult generateSVCIDLExampleSource(
 			Map<String, Object> contextMap) {
 		IdlFileParam idlParam = (IdlFileParam) contextMap.get("idlFileParam");
@@ -181,7 +180,22 @@
 		result.setEncode("Shift_JIS");
 		return result;
 	}
+	//////////
+	public GeneratedResult generatePythonTestSource(Map<String, Object> contextMap) {
+		RtcParam rtcParam = (RtcParam) contextMap.get("rtcParam");
+		String outfile = "test/" + rtcParam.getName() + "Test.py";
+		String infile = "python/test/Py_Test_RTC.py.vsl";
+		return generate(infile, outfile, contextMap);
+	}
 	
+	public GeneratedResult generateTestSVCIDLExampleSource(
+			Map<String, Object> contextMap) {
+		IdlFileParam idlParam = (IdlFileParam) contextMap.get("idlFileParam");
+		String outfile = "test/" + idlParam.getIdlFileNoExt() + "_idl_example.py";
+		String infile = "python/Py_SVC_idl_example.py.vsl";
+		return generate(infile, outfile, contextMap);
+	}
+	//////////
 	public GeneratedResult generate(String infile, String outfile,
 			Map<String, Object> contextMap) {
 		try {

Deleted: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_SVC_idl.py.vsl
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_SVC_idl.py.vsl	2018-01-23 13:41:03 UTC (rev 791)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_SVC_idl.py.vsl	2018-01-23 13:46:17 UTC (rev 792)
@@ -1,103 +0,0 @@
-# Python stubs generated by omniidl from ${tmpltHelper.getFilenameNoExt(${idlFileParam.idlPath})}.idl
-
-import omniORB, _omnipy
-from omniORB import CORBA, PortableServer
-_0_CORBA = CORBA
-
-_omnipy.checkVersion(2,0, __file__)
-
-try:
-    _omniORB_StructBase = omniORB.StructBase
-except AttributeError:
-    class _omniORB_StructBase: pass
-
-
-#
-# Start of module "_GlobalIDL"
-#
-__name__ = "_GlobalIDL"
-_0__GlobalIDL = omniORB.openModule("_GlobalIDL", r"${tmpltHelper.getFilenameNoExt(${idlFileParam.idlPath})}.idl")
-_0__GlobalIDL__POA = omniORB.openModule("_GlobalIDL__POA", r"${tmpltHelper.getFilenameNoExt(${idlFileParam.idlPath})}.idl")
-
-
-#foreach($serviceClassParam in ${idlFileParam.serviceClassParams})
-#if($velocityCount == 1 )
-#foreach($typeDefParam in ${serviceClassParam.typeDefList})
-# typedef ... ${typeDefParam.targetDef}
-class ${typeDefParam.targetDef}:
-    _NP_RepositoryId = "IDL:${typeDefParam.targetDef}:1.0"
-    def __init__(self, *args, **kw):
-        raise RuntimeError("Cannot construct objects of this type.")
-_0__GlobalIDL.${typeDefParam.targetDef} = ${typeDefParam.targetDef}
-_0__GlobalIDL._d_${typeDefParam.targetDef}  = (omniORB.tcInternal.tv_sequence, ${pyConv.convCORBA2PythonTypeDef(${typeDefParam.targetDef},${serviceClassParam})}, 0)
-_0__GlobalIDL._ad_${typeDefParam.targetDef} = (omniORB.tcInternal.tv_alias, ${typeDefParam.targetDef}._NP_RepositoryId, "${typeDefParam.targetDef}", (omniORB.tcInternal.tv_sequence, ${pyConv.convCORBA2PythonTypeDef(${typeDefParam.targetDef},${serviceClassParam})}, 0))
-_0__GlobalIDL._tc_${typeDefParam.targetDef} = omniORB.tcInternal.createTypeCode(_0__GlobalIDL._ad_${typeDefParam.targetDef})
-omniORB.registerType(${typeDefParam.targetDef}._NP_RepositoryId, _0__GlobalIDL._ad_${typeDefParam.targetDef}, _0__GlobalIDL._tc_${typeDefParam.targetDef})
-del ${typeDefParam.targetDef}
-
-#end
-#end
-#end
-#foreach($serviceClassParam in ${idlFileParam.serviceClassParams})
-# interface ${serviceClassParam.name}
-_0__GlobalIDL._d_${serviceClassParam.name} = (omniORB.tcInternal.tv_objref, "IDL:${serviceClassParam.name}:1.0", "${serviceClassParam.name}")
-omniORB.typeMapping["IDL:${serviceClassParam.name}:1.0"] = _0__GlobalIDL._d_${serviceClassParam.name}
-_0__GlobalIDL.${serviceClassParam.name} = omniORB.newEmptyClass()
-class ${serviceClassParam.name} :
-    _NP_RepositoryId = _0__GlobalIDL._d_${serviceClassParam.name}[1]
-
-    def __init__(self, *args, **kw):
-        raise RuntimeError("Cannot construct objects of this type.")
-
-    _nil = CORBA.Object._nil
-
-
-_0__GlobalIDL.${serviceClassParam.name} = ${serviceClassParam.name}
-_0__GlobalIDL._tc_${serviceClassParam.name} = omniORB.tcInternal.createTypeCode(_0__GlobalIDL._d_${serviceClassParam.name})
-omniORB.registerType(${serviceClassParam.name}._NP_RepositoryId, _0__GlobalIDL._d_${serviceClassParam.name}, _0__GlobalIDL._tc_${serviceClassParam.name})
-
-# ${serviceClassParam.name} operations and attributes
-#foreach($serviceMethodParam in ${serviceClassParam.methods})
-${serviceClassParam.name}._d_${serviceMethodParam.name} = (${pyConv.selectInParamType(${serviceMethodParam},${serviceClassParam})}), (${pyConv.selectOutParamType(${serviceMethodParam},${serviceClassParam})}), None)
-#end
-
-# ${serviceClassParam.name} object reference
-class _objref_${serviceClassParam.name} (CORBA.Object):
-    _NP_RepositoryId = ${serviceClassParam.name}._NP_RepositoryId
-
-    def __init__(self):
-        CORBA.Object.__init__(self)
-
-#foreach($serviceMethodParam in ${serviceClassParam.methods})
-    def ${serviceMethodParam.name}(self, *args):
-        return _omnipy.invoke(self, "${serviceMethodParam.name}", _0__GlobalIDL.${serviceClassParam.name}._d_${serviceMethodParam.name}, args)
-
-#end
-    __methods__ = [#foreach($serviceMethodParam in ${serviceClassParam.methods})#if($velocityCount > 1), #end"${serviceMethodParam.name}"#end] + CORBA.Object.__methods__
-
-omniORB.registerObjref(${serviceClassParam.name}._NP_RepositoryId, _objref_${serviceClassParam.name})
-_0__GlobalIDL._objref_${serviceClassParam.name} = _objref_${serviceClassParam.name}
-del ${serviceClassParam.name}, _objref_${serviceClassParam.name}
-
-# ${serviceClassParam.name} skeleton
-__name__ = "_GlobalIDL__POA"
-class ${serviceClassParam.name} (PortableServer.Servant):
-    _NP_RepositoryId = _0__GlobalIDL.${serviceClassParam.name}._NP_RepositoryId
-
-
-    _omni_op_d = {#foreach($serviceMethodParam in ${serviceClassParam.methods})#if($velocityCount > 1), #end"${serviceMethodParam.name}": _0__GlobalIDL.${serviceClassParam.name}._d_${serviceMethodParam.name}#end}
-
-${serviceClassParam.name}._omni_skeleton = ${serviceClassParam.name}
-_0__GlobalIDL__POA.${serviceClassParam.name} = ${serviceClassParam.name}
-del ${serviceClassParam.name}
-__name__ = "_GlobalIDL"
-
-#end
-#
-# End of module "_GlobalIDL"
-#
-__name__ = "${tmpltHelper.getFilenameNoExt(${idlFileParam.idlPath})}_idl"
-
-_exported_modules = ( "_GlobalIDL", )
-
-# The end.



More information about the openrtm-commit mailing list