Skip to content
Snippets Groups Projects
Commit 164cf006 authored by Daniela Genius's avatar Daniela Genius
Browse files

Stand alone ELN and TDF

parent e007174e
No related branches found
No related tags found
1 merge request!140Master clone
......@@ -62,8 +62,11 @@ import elntranslator.*;
public class TopCellGenerator {
public static ELNSpecification eln;
private final static String GENERATED_PATH1 = "generated_CPP" + File.separator;
private final static String GENERATED_PATH2 = "generated_H" + File.separator;
//private final static String GENERATED_PATH1 = "generated_CPP" + File.separator;
//private final static String GENERATED_PATH2 = "generated_H" + File.separator;
private String GENERATED_PATH1 = "generated_CPP" + File.separator;
private String GENERATED_PATH2 = "generated_H" + File.separator;
public TopCellGenerator(ELNSpecification _eln) {
eln = _eln;
......@@ -93,13 +96,19 @@ public class TopCellGenerator {
return (top);
}
public void saveFile(String path) {
public void saveFile(String path, Boolean standalone) {
ELNTCluster cluster = TopCellGenerator.eln.getCluster();
LinkedList<ELNTConnector> connectorsModule = TopCellGenerator.eln.getAllConnectorsInModule();
LinkedList<ELNTConnector> connectorsCluster = TopCellGenerator.eln.getAllConnectorsInCluster();
String top;
if(standalone){
GENERATED_PATH1 = "";
GENERATED_PATH2 = "";
}
try {
// Save file .cpp
System.err.println(path + GENERATED_PATH1 + cluster.getName() + ".cpp");
......@@ -111,13 +120,19 @@ public class TopCellGenerator {
ex.printStackTrace();
}
// Save files .h
saveFileModule(path, cluster, connectorsModule);
saveFileModule(path, cluster, connectorsModule, standalone);
}
public void saveFileModule(String path, ELNTCluster cluster, List<ELNTConnector> connectors) {
public void saveFileModule(String path, ELNTCluster cluster, List<ELNTConnector> connectors, Boolean standalone) {
LinkedList<ELNTModule> modules = cluster.getModule();
String code;
if(standalone){
GENERATED_PATH1 = "";
GENERATED_PATH2 = "";
}
for (ELNTModule module : modules) {
try {
......@@ -131,4 +146,4 @@ public class TopCellGenerator {
}
}
}
}
\ No newline at end of file
}
......@@ -500,6 +500,8 @@ public class JDialogELNExecutableCodeGeneration extends javax.swing.JFrame imple
// String list;//, data;
// hasError = false;
Boolean standalone = true; //are there any GPIO blocks? Currently ELN is always standalone and has no direct connection to SocLib (via TDF: yes)
try {
if (jp1.getSelectedIndex() == 0) {
jta.append("Generating executable code (ELN version)\n");
......@@ -531,7 +533,7 @@ public class JDialogELNExecutableCodeGeneration extends javax.swing.JFrame imple
pathCode = code2.getText();
System.err.println("ELN TOPCELL : " + elnSpec.getCluster().getName() + "saved in " + code2.getText());
topCellGenerator.saveFile(pathCode);
topCellGenerator.saveFile(pathCode, standalone);
jta.append("Code saved\n");
} catch (Exception e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment