[openrtm-commit:01169] r479 - in branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor: template ui/editor
openrtm @ openrtm.org
openrtm @ openrtm.org
2014年 1月 21日 (火) 22:32:12 JST
Author: win-ei
Date: 2014-01-21 22:32:12 +0900 (Tue, 21 Jan 2014)
New Revision: 479
Modified:
branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortCreateTbl.c.vsl
branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java
Log:
Daily work.
Modified: branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortCreateTbl.c.vsl
===================================================================
--- branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortCreateTbl.c.vsl 2014-01-21 12:29:59 UTC (rev 478)
+++ branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/template/DataPortCreateTbl.c.vsl 2014-01-21 13:32:12 UTC (rev 479)
@@ -18,10 +18,9 @@
/* DataPort creation table */
const DataPortCreate_t gsDataPortCreates[DATAPORT_NUM] =
{
+#foreach($port in $ports))
{
- DATAPORT_INDEX_DEMO_ACCELERATION,
+ DATAPORT_INDEX_${port.toUpperCase()},
},
- {
- DATAPORT_INDEX_DEMO_LED,
- }
+#end
};
Modified: branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java
===================================================================
--- branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java 2014-01-21 12:29:59 UTC (rev 478)
+++ branches/work_ForRTMSafety/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/editor/AbstractSystemDiagramEditor.java 2014-01-21 13:32:12 UTC (rev 479)
@@ -9,6 +9,7 @@
import org.eclipse.core.resources.IWorkspaceRoot;
import org.openrtp.namespaces.rts.version02.DataportConnector;
import org.openrtp.namespaces.rts.version02.TargetPort;
+//import org.openrtp.namespaces.rts.version02.Component;
//zxc+>
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -680,9 +681,26 @@
{
System.out.println("Creates table files for RTMSafety");
final String TEMPLATE_PATH = "jp/go/aist/rtm/systemeditor/template";
+ String tablepath = file.getLocation().toOSString();
+ int lastDotPos = tablepath.lastIndexOf('\\');
+ System.out.println("save 475 tablepath.lastIndexOf('.')="+lastDotPos);
+ if (lastDotPos == -1)
+ {
+ ;
+ }
+ else if (lastDotPos == 0)
+ {
+ ;
+ }
+ else
+ {
+ tablepath = tablepath.substring(0, lastDotPos);
+ }
+ System.out.println("save 476 tablepath="+tablepath);
//
//DataPortConctTbl.c
//
+ {
System.out.println("DataPortConctTbl.c");
String template = TEMPLATE_PATH + "/" +"DataPortConctTbl.c.vsl";
ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -702,8 +720,6 @@
Map connsMap = new HashMap();
for(DataportConnector conn : conns)
{
- //contextMap.put("TargetDataPort", conn.getTargetDataPort().getPortName().replace(".", "_"));
- //contextMap.put("SourceDataPort", conn.getSourceDataPort().getPortName().replace(".", "_"));
connsMap.put(conn.getTargetDataPort().getPortName().replace(".", "_"),conn.getSourceDataPort().getPortName().replace(".", "_"));
}
contextMap.put("connectPorts", connsMap);
@@ -722,22 +738,6 @@
System.out.println("save 473 resource.getURI().fileExtension()="+resource.getURI().fileExtension());
System.out.println("save 474 file.getLocation().lastSegment()="+file.getLocation().lastSegment());
System.out.println("save 475 file.getLocation().toOSString())="+file.getLocation().toOSString());
- String tablepath = file.getLocation().toOSString();
- int lastDotPos = tablepath.lastIndexOf('\\');
- System.out.println("save 475 tablepath.lastIndexOf('.')="+lastDotPos);
- if (lastDotPos == -1)
- {
- ;
- }
- else if (lastDotPos == 0)
- {
- ;
- }
- else
- {
- tablepath = tablepath.substring(0, lastDotPos);
- }
- System.out.println("save 476 tablepath="+tablepath);
String dataPortContct = tablepath+"\\DataPortConctTbl.c";
System.out.println("save 476 tablepath="+dataPortContct);
File targetFile = new File(dataPortContct);
@@ -755,10 +755,36 @@
System.out.println("save 700");
System.out.println(gr.getCode());
System.out.println("save 800");
+ }
//
+ //DataPortCreateTbl.c.vsl
//
- //
-
+ {
+ String template = TEMPLATE_PATH + "/" +"DataPortCreateTbl.c.vsl";
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStream ins = cl.getResourceAsStream(template);
+ String dataPortContct = tablepath+"\\DataPortCreateTbl.c";
+ Map<String, Object> contextMap = new HashMap<String, Object>();
+ contextMap.put("template", TEMPLATE_PATH);
+ List<org.openrtp.namespaces.rts.version02.Component> componetns = profile.getComponents();
+ ArrayList complist = new ArrayList();
+ for(org.openrtp.namespaces.rts.version02.Component comp :componetns)
+ {
+ if(!comp.getDataPorts().isEmpty())
+ {
+ complist.add(comp.getInstanceName());
+ }
+ }
+ contextMap.put("ports", complist);
+ GeneratedResult gr = TemplateUtil.createGeneratedResult(ins, contextMap, dataPortContct);
+ File targetFile = new File(dataPortContct);
+ FileWriter filewriter = new FileWriter(targetFile);
+ BufferedWriter bw = new BufferedWriter(filewriter);
+ PrintWriter pw = new PrintWriter(bw);
+ pw.println(gr.getCode());
+ pw.close();
+ System.out.println(gr.getCode());
+ }
}
}
More information about the openrtm-commit
mailing list