Imported CSS files

This commit is contained in:
Sakbe
2019-10-21 16:02:55 +01:00
parent 22146b8413
commit 87401e8c95
365 changed files with 1092613 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ColorFontUtil
filepath2 = PVUtil.getString(pvs[0])
table = widget.getTable()
i = 0
j = 0
row = 0
col = 0
mylist = []
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi"+filepath2
try:
file = open(filename, 'r')
for i in range(table.getRowCount()):
for j in range(table.getColumnCount()):
table.setCellText(i, j, "")
i = 0
j = 0
for line in file:
mylist.insert(i, line)
table.setCellText(row, col, mylist[i].strip('\n'))
i = i+1
col = col+1
if i == ( 1*(row+1) ):
row = row+1
col = 0
except:
a = 0
else:
file.close()

View File

@@ -0,0 +1,35 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ColorFontUtil
alg_name2 = PVUtil.getString(pvs[0])
table = widget.getTable()
i = 0
j = 0
row = 0
col = 0
mylist = []
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/"+alg_name2+".par"
try:
file = open(filename, 'r')
for i in range(table.getRowCount()):
for j in range(table.getColumnCount()):
table.setCellText(i, j, "")
i = 0
j = 0
for line in file:
mylist.insert(i, line)
table.setCellText(row, col, mylist[i].strip('\n'))
i = i+1
col = col+1
if i == ( 8*(row+1) ):
row = row+1
col = 0
except:
a = 0
else:
file.close()

View File

@@ -0,0 +1,100 @@
#############################################################
#
# Copyright 2011 EFDA | European Fusion Development Agreement
#
# Licensed under the EUPL, Version 1.1 or - as soon they
# will be approved by the European Commission - subsequent
# versions of the EUPL (the "Licence");
# You may not use this work except in compliance with the
# Licence.
# You may obtain a copy of the Licence at:
#
# http://ec.europa.eu/idabc/eupl
#
# Unless required by applicable law or agreed to in
# writing, software distributed under the Licence is
# distributed on an "AS IS" basis,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied.
# See the Licence for the specific language governing
# permissions and limitations under the Licence.
#
# $Id$
#
#############################################################
#Start-up script for the MARTe
#!/bin/sh
if [ -z "$1" ]; then
echo "Please specify the location of the configuration file"
exit
else
echo "Going to start MARTe with the configuration specified in: " $1
fi
target=`uname`
case ${target} in
Darwin)
TARGET=macosx
;;
SunOS)
TARGET=solaris
;;
*)
TARGET=linux
;;
esac
echo "Target is $TARGET"
BASEDIR=/opt/MARTe
CODE_DIRECTORY=$BASEDIR
LD_LIBRARY_PATH=.:$CODE_DIRECTORY/BaseLib2/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/MARTe/MARTeSupportLib/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/LinuxTimer/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/GenericTimerDriver/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/IOGAMs/StreamingDriver/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PIDGAM/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaterTank/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WaveformGenerator2009/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/WebStatisticGAM/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/DataCollectionGAM/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/GAMs/PlottingGAM/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/CFGUploader/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/SignalHandler/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/MATLABHandler/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CODE_DIRECTORY/Interfaces/HTTP/FlotPlot/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../IOGAMs/ATCAadc/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../IOGAMs/FileReader_ATCAadc/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../GAMs/isttokbiblio/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../GAMs/NewAlgorithmGAM/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/EPICSLib/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/EPICSGAM/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/TCPMessageHandler/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../Interfaces/TCPConfigurationHandler/${TARGET}/
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$EPICS_BASE/lib/$EPICS_HOST_ARCH
if [ ${TARGET} == "macosx" ]; then
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH
else
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH
fi
$CODE_DIRECTORY/MARTe/${TARGET}/MARTe_SysM3.ex $1
#$CODE_DIRECTORY/MARTe/${TARGET}/MARTe_SysM2.ex $1
#$CODE_DIRECTORY/MARTe/${TARGET}/MARTe_SysM.ex $1
#gdb --args $CODE_DIRECTORY/MARTe/linux/MARTe.ex $1

View File

@@ -0,0 +1,30 @@
OBJSX=
#########################################################
# MANDATORY: POINT THIS TO YOUR MARTE CODE DIRECTORY!!! #
#########################################################
CODEDIR=/opt/MARTe
MAKEDEFAULTDIR=$(CODEDIR)/MakeDefaults
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
CFLAGS+= -I.
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level0
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level1
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level2
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level3
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level4
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level5
CFLAGS+= -I$(CODEDIR)/BaseLib2/Level6
CFLAGS+= -I$(CODEDIR)/BaseLib2/LoggerService
all: $(OBJS)\
$(TARGET)/NewAlgorithmGAM$(GAMEXT)
echo $(OBJS)
include depends.$(TARGET)
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)

View File

@@ -0,0 +1,8 @@
TARGET=linux
include Makefile.inc
LIBRARIES += -L$(CODEDIR)/BaseLib2/$(TARGET) -lBaseLib2
LIBRARIES += -L$(CODEDIR)/MARTe/MARTeSupportLib/$(TARGET) -lMARTeSupLib
OPTIM=

View File

@@ -0,0 +1,17 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.swt.widgets.natives.SpreadSheetTable import ITableSelectionChangedListener
from java.util import Arrays
table = widget.getTable()
class SelectionListener(ITableSelectionChangedListener):
def selectionChanged(self, selection):
for row in selection:
par_name = row[1]
par_io = row[4]
pvs[1].setValue(par_name)
pvs[2].setValue(par_io)
table.addSelectionChangedListener(SelectionListener())

View File

@@ -0,0 +1,55 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.swt.widgets.natives.SpreadSheetTable import ITableSelectionChangedListener
from java.util import Arrays
header_file = PVUtil.getString(pvs[1])
config_file = PVUtil.getString(pvs[2])
code_file = PVUtil.getString(pvs[3])
code_dir = PVUtil.getString(pvs[4])
alg_name = PVUtil.getString(pvs[5])
table = widget.getTable()
class SelectionListener(ITableSelectionChangedListener):
def selectionChanged(self, selection):
for row in selection:
alg_name = row[0]
header_file = alg_name+"GAM.h"
config_file = alg_name+"GAM.cfg"
code_file = alg_name+"GAM.cpp"
code_dir = alg_name+"GAM"
pvs[1].setValue(header_file)
pvs[2].setValue(config_file)
pvs[3].setValue(code_file)
pvs[4].setValue(code_dir)
pvs[5].setValue(alg_name)
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+code_dir+"/"+alg_name+"GAM.for"
try:
myfile = open(filename, 'r')
text = myfile.read()
display.getWidget("ExpressTextInputFormula").setPropertyValue("text", text)
except:
display.getWidget("ExpressTextInputFormula").setPropertyValue("text", "")
else:
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+code_dir+"/"+alg_name+"GAM.cod"
try:
myfile = open(filename, 'r')
text = myfile.read()
display.getWidget("contentCodeLabel2").setPropertyValue("text", text)
except:
display.getWidget("contentCodeLabel2").setPropertyValue("text", "")
else:
myfile.close()
widget.executeAction(0)
table.addSelectionChangedListener(SelectionListener())

View File

@@ -0,0 +1,6 @@
#!/bin/sh
cd /home/pricardofc/Documents/MARTe/GAMs/NewAlgorithmGAM
make -f Makefile.linux clean
make -f Makefile.linux

View File

@@ -0,0 +1,47 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ScriptUtil
val = PVUtil.getDouble(pvs[0])
if val == 1:
val = 0
pvs[0].setValue(val)
command_remove="rm -rf /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command_remove,1)
command_create = "mkdir /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command_create,1)
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+".par"
text = display.getWidget("contentParameterLabel2").getPropertyValue("text")
myfile = open(filename, 'w')
myfile.write(text)
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+".sig"
text1 = display.getWidget("contentInputLabel2").getPropertyValue("text")
myfile = open(filename, 'w')
myfile.write('\tinput_signals = {\n')
myfile.write(text1)
myfile.write('\t}\n\n')
text2 = display.getWidget("contentOutputLabel2").getPropertyValue("text")
myfile.write('\toutput_signals = {\n')
myfile.write(text2)
myfile.write('\t}\n')
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+".xml"
text = display.getWidget("contentXmlLabel2").getPropertyValue("text")
myfile = open(filename, 'w')
myfile.write('<?xml version="1.0"?>\n')
myfile.write('<macros>\n')
myfile.write(text)
myfile.write('</macros>\n')
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/ControlAlgorithms.txt"
myfile = open(filename, 'r')
text = myfile.read()
myfile.close()
myfile = open(filename, 'w')
text += display.getWidget("FileNameTextInput2").getPropertyValue("text")+"\n"
myfile.write(text)
myfile.close()
pvs[1].setValue(1)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,195 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ScriptUtil
val = PVUtil.getDouble(pvs[0])
if val == 1:
val = 0
pvs[0].setValue(val)
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM.h"
myfile = open(filename, 'w')
myfile.write('#ifndef _')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text").upper())
myfile.write('GAM_H_\n')
myfile.write('#define\t')
myfile.write('_')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text").upper())
myfile.write('GAM_H_\n\n')
myfile.write('#include "DDBInputInterface.h"\n')
myfile.write('#include "DDBOutputInterface.h"\n')
myfile.write('#include "GAM.h"\n')
myfile.write('#include "File.h"\n')
myfile.write('#include "Matrix.h"\n')
myfile.write('#include "HtmlStream.h"\n')
myfile.write('#include "HttpInterface.h"\n')
myfile.write('#include "CDBExtended.h"\n\n')
myfile.write('OBJECT_DLL(')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM)\n')
myfile.write('class ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM : public GAM, public HttpInterface {\n')
myfile.write('private:\n\n')
myfile.write('\tDDBInputInterface *SignalsInputInterface;\n')
myfile.write('\tDDBOutputInterface *SignalsOutputInterface;\n\n')
myfile.write('\tstruct InputInterfaceStruct {\n')
myfile.write(display.getWidget("contentInLabel2").getPropertyValue("text"))
myfile.write('\t};\n\n')
myfile.write('\tstruct OutputInterfaceStruct {\n')
myfile.write(display.getWidget("contentOutLabel2").getPropertyValue("text"))
myfile.write('\t};\n\n')
myfile.write(display.getWidget("contentVariableLabel2").getPropertyValue("text"))
myfile.write('\tbool view_input_variables;\n')
myfile.write('public:\n')
myfile.write('\t// Default constructor\n\t')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM();\n\n')
myfile.write('\t// Destructor\n')
myfile.write('\tvirtual ~')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM();\n\n')
myfile.write('\t// Initialise the module\n')
myfile.write('\tvirtual bool Initialise(ConfigurationDataBase& cdbData);\n\n')
myfile.write('\t// Execute the module functionalities\n')
myfile.write('\tvirtual bool Execute(GAM_FunctionNumbers functionNumber);\n')
myfile.write('\tvirtual bool ProcessHttpMessage(HttpStream &hStream);\n\n')
myfile.write('\tOBJECT_DLL_STUFF(')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM)\n')
myfile.write('};\n\n')
myfile.write('#endif\n')
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM.cpp"
myfile = open(filename, 'w')
myfile.write('#include "')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM.h"\n\n')
myfile.write('OBJECTLOADREGISTER(')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM, "$Id: $")\n\n')
myfile.write('// ******** Default constructor ***********************************\n')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM(){\n')
myfile.write('\tthis->SignalsInputInterface = NULL;\n')
myfile.write('\tthis->SignalsOutputInterface = NULL;\n')
myfile.write('}\n\n')
myfile.write('// ********* Destructor ********************************************\n')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::~')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM()\n')
myfile.write('{\n')
myfile.write('\t// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;\n')
myfile.write('\t// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;\n')
myfile.write('}\n\n')
myfile.write('//{ ********* Initialise the module ********************************\n')
myfile.write('bool ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::Initialise(ConfigurationDataBase& cdbData){\n')
myfile.write('\tCDBExtended cdb(cdbData);\n\n')
myfile.write('\tif(!AddInputInterface(SignalsInputInterface,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAMInputInterface")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s failed to add input interface",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\t\n')
myfile.write('\tif(!AddOutputInterface(SignalsOutputInterface,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAMInputInterface")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s failed to add output interface",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tif(!cdb->Move("input_signals")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s did not specify input_signals entry",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tint32 nOfSignals = cdb->NumberOfChildren();\n')
myfile.write('\tif(nOfSignals < 1){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError, "'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup. '+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM expects the current time and voltage as inputs ",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tif(!SignalsInputInterface->ObjectLoadSetup(cdb,NULL)){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup Failed DDBInterface %s ",Name(),SignalsInputInterface->InterfaceName());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t} \n')
myfile.write('\tcdb->MoveToFather();\n')
myfile.write('\tif(!cdb->Move("output_signals")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s did not specify output_signals entry",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tif(!SignalsOutputInterface->ObjectLoadSetup(cdb,NULL)){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup Failed DDBInterface %s ",Name(),SignalsOutputInterface->InterfaceName());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tnOfSignals = cdb->NumberOfChildren();\n')
myfile.write('\tif(nOfSignals < 1){\n')
myfile.write('\t\tAssertErrorCondition(Warning,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup. No output of this GAM ",Name());\n')
myfile.write('\t}\n')
myfile.write('\tcdb->MoveToFather();\n')
myfile.write('\treturn True;\n')
myfile.write('}\n\n')
myfile.write('//{ ********* Execute the module functionalities *******************\n')
myfile.write('bool ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::Execute(GAM_FunctionNumbers functionNumber){\n')
myfile.write('\tInputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();\n')
myfile.write('\tthis->SignalsInputInterface->Read();\n')
myfile.write('\tOutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();\n')
myfile.write('\tthis->SignalsOutputInterface->Write();\n')
myfile.write('\treturn True;\n')
myfile.write('}\n\n')
myfile.write('bool ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::ProcessHttpMessage(HttpStream &hStream){\n')
myfile.write('HtmlStream hmStream(hStream);\n')
myfile.write('int i;\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "html>\\n"\n')
myfile.write('\t"<head>\\n"\n')
myfile.write('\t"<title>%s</title>\\n"\n')
myfile.write('\t"</head>\\n"\n')
myfile.write('\t"<body>\\n"\n')
myfile.write('\t"<svg width=\\\"100&#37;\\\" height=\\\"100\\\" style=\\\"background-color: AliceBlue;\\\">\\n\"\n')
myfile.write('\t"<image x=\\\"%d\\\" y=\\\"%d\\\" width=\\\"%d\\\" height=\\\"%d\\\" xlink:href=\\\"%s\\\" />\\n\"\n')
myfile.write('\t"</svg", (char *) this->Name(),0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\\\"font-family:Arial;font-size:46\\\">%s</text><br", (char *) this->Name());\n')
myfile.write('FString submit_view;\n')
myfile.write('submit_view.SetSize(0);\n')
myfile.write('if (hStream.Switch("InputCommands.submit_view")){\n')
myfile.write('\thStream.Seek(0);\n')
myfile.write('\thStream.GetToken(submit_view, "");\n')
myfile.write('\thStream.Switch((uint32)0);\n')
myfile.write('}\n')
myfile.write('if(submit_view.Size() > 0) view_input_variables = True;\n')
myfile.write('FString submit_hide;\n')
myfile.write('submit_hide.SetSize(0);\n')
myfile.write('if (hStream.Switch("InputCommands.submit_hide")){\n')
myfile.write('\thStream.Seek(0);\n')
myfile.write('\thStream.GetToken(submit_hide, "");\n')
myfile.write('\thStream.Switch((uint32)0);\n')
myfile.write('}\n')
myfile.write('if(submit_hide.Size() > 0) view_input_variables = False;\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\\\"multipart/form-data\\\" method=\\\"post\\\"");\n')
myfile.write('if(!view_input_variables){\n')
myfile.write('\thmStream.SSPrintf(HtmlTagStreamMode, "input type=\\\"submit\\\" name=\\\"submit_view\\\" value=\\\"View input variables\\\"");\n')
myfile.write('}\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "/form");\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "/body>\\n</html");\n')
myfile.write('hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");\n')
myfile.write('hStream.WriteReplyHeader(True);\n')
myfile.write('return True;\n')
myfile.write('}\n')
myfile.close()
command001 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/Makefile.inc /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command001,1)
command002 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/Makefile.linux /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command002,1)
command003 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/MARTe3.sh /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command003,1)
command004 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/compile_gam.sh /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command004,1)
command01 = "sed -i 's/NewAlgorithm/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"/g'"+" /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+"Makefile.inc"
ScriptUtil.executeSystemCommand(command01,1)
command02 = "sed -i 's/NewAlgorithm/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"/g'"+" /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+"MARTe3.sh"
ScriptUtil.executeSystemCommand(command02,1)
command03 = "sed -i 's/NewAlgorithm/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"/g'"+" /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+"compile_gam.sh"
ScriptUtil.executeSystemCommand(command03,1)

View File

@@ -0,0 +1,38 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ScriptUtil
val = PVUtil.getDouble(pvs[0])
if val == 1:
val = 0
pvs[0].setValue(val)
command_remove="rm -rf /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command_remove,1)
command_create = "mkdir /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command_create,1)
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+".par"
text = display.getWidget("contentParameterLabel2").getPropertyValue("text")
myfile = open(filename, 'w')
myfile.write(text)
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+".sig"
text1 = display.getWidget("contentInputLabel2").getPropertyValue("text")
myfile = open(filename, 'w')
myfile.write('\tinput_signals = {\n')
myfile.write(text1)
myfile.write('\t}\n\n')
text2 = display.getWidget("contentOutputLabel2").getPropertyValue("text")
myfile.write('\toutput_signals = {\n')
myfile.write(text2)
myfile.write('\t}\n')
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+".xml"
text = display.getWidget("contentXmlLabel2").getPropertyValue("text")
myfile = open(filename, 'w')
myfile.write('<?xml version="1.0"?>\n')
myfile.write('<macros>\n')
myfile.write(text)
myfile.write('</macros>\n')
myfile.close()
pvs[1].setValue(1)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,195 @@
from org.csstudio.opibuilder.scriptUtil import PVUtil
from org.csstudio.opibuilder.scriptUtil import ScriptUtil
val = PVUtil.getDouble(pvs[0])
if val == 1:
val = 0
pvs[0].setValue(val)
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM.h"
myfile = open(filename, 'w')
myfile.write('#ifndef _')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text").upper())
myfile.write('GAM_H_\n')
myfile.write('#define\t')
myfile.write('_')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text").upper())
myfile.write('GAM_H_\n\n')
myfile.write('#include "DDBInputInterface.h"\n')
myfile.write('#include "DDBOutputInterface.h"\n')
myfile.write('#include "GAM.h"\n')
myfile.write('#include "File.h"\n')
myfile.write('#include "Matrix.h"\n')
myfile.write('#include "HtmlStream.h"\n')
myfile.write('#include "HttpInterface.h"\n')
myfile.write('#include "CDBExtended.h"\n\n')
myfile.write('OBJECT_DLL(')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM)\n')
myfile.write('class ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM : public GAM, public HttpInterface {\n')
myfile.write('private:\n\n')
myfile.write('\tDDBInputInterface *SignalsInputInterface;\n')
myfile.write('\tDDBOutputInterface *SignalsOutputInterface;\n\n')
myfile.write('\tstruct InputInterfaceStruct {\n')
myfile.write(display.getWidget("contentInLabel2").getPropertyValue("text"))
myfile.write('\t};\n\n')
myfile.write('\tstruct OutputInterfaceStruct {\n')
myfile.write(display.getWidget("contentOutLabel2").getPropertyValue("text"))
myfile.write('\t};\n\n')
myfile.write(display.getWidget("contentVariableLabel2").getPropertyValue("text"))
myfile.write('\tbool view_input_variables;\n')
myfile.write('public:\n')
myfile.write('\t// Default constructor\n\t')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM();\n\n')
myfile.write('\t// Destructor\n')
myfile.write('\tvirtual ~')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM();\n\n')
myfile.write('\t// Initialise the module\n')
myfile.write('\tvirtual bool Initialise(ConfigurationDataBase& cdbData);\n\n')
myfile.write('\t// Execute the module functionalities\n')
myfile.write('\tvirtual bool Execute(GAM_FunctionNumbers functionNumber);\n')
myfile.write('\tvirtual bool ProcessHttpMessage(HttpStream &hStream);\n\n')
myfile.write('\tOBJECT_DLL_STUFF(')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM)\n')
myfile.write('};\n\n')
myfile.write('#endif\n')
myfile.close()
filename = "/home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM.cpp"
myfile = open(filename, 'w')
myfile.write('#include "')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM.h"\n\n')
myfile.write('OBJECTLOADREGISTER(')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM, "$Id: $")\n\n')
myfile.write('// ******** Default constructor ***********************************\n')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM(){\n')
myfile.write('\tthis->SignalsInputInterface = NULL;\n')
myfile.write('\tthis->SignalsOutputInterface = NULL;\n')
myfile.write('}\n\n')
myfile.write('// ********* Destructor ********************************************\n')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::~')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM()\n')
myfile.write('{\n')
myfile.write('\t// if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;\n')
myfile.write('\t// if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;\n')
myfile.write('}\n\n')
myfile.write('//{ ********* Initialise the module ********************************\n')
myfile.write('bool ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::Initialise(ConfigurationDataBase& cdbData){\n')
myfile.write('\tCDBExtended cdb(cdbData);\n\n')
myfile.write('\tif(!AddInputInterface(SignalsInputInterface,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAMInputInterface")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s failed to add input interface",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\t\n')
myfile.write('\tif(!AddOutputInterface(SignalsOutputInterface,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAMInputInterface")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s failed to add output interface",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tif(!cdb->Move("input_signals")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s did not specify input_signals entry",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tint32 nOfSignals = cdb->NumberOfChildren();\n')
myfile.write('\tif(nOfSignals < 1){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError, "'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup. '+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM expects the current time and voltage as inputs ",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tif(!SignalsInputInterface->ObjectLoadSetup(cdb,NULL)){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup Failed DDBInterface %s ",Name(),SignalsInputInterface->InterfaceName());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t} \n')
myfile.write('\tcdb->MoveToFather();\n')
myfile.write('\tif(!cdb->Move("output_signals")){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s did not specify output_signals entry",Name());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tif(!SignalsOutputInterface->ObjectLoadSetup(cdb,NULL)){\n')
myfile.write('\t\tAssertErrorCondition(InitialisationError,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup Failed DDBInterface %s ",Name(),SignalsOutputInterface->InterfaceName());\n')
myfile.write('\t\treturn False;\n')
myfile.write('\t}\n')
myfile.write('\tnOfSignals = cdb->NumberOfChildren();\n')
myfile.write('\tif(nOfSignals < 1){\n')
myfile.write('\t\tAssertErrorCondition(Warning,"'+display.getWidget("FileNameTextInput2").getPropertyValue("text")+'GAM::Initialise: %s ObjectLoadSetup. No output of this GAM ",Name());\n')
myfile.write('\t}\n')
myfile.write('\tcdb->MoveToFather();\n')
myfile.write('\treturn True;\n')
myfile.write('}\n\n')
myfile.write('//{ ********* Execute the module functionalities *******************\n')
myfile.write('bool ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::Execute(GAM_FunctionNumbers functionNumber){\n')
myfile.write('\tInputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();\n')
myfile.write('\tthis->SignalsInputInterface->Read();\n')
myfile.write('\tOutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();\n')
myfile.write('\tthis->SignalsOutputInterface->Write();\n')
myfile.write('\treturn True;\n')
myfile.write('}\n\n')
myfile.write('bool ')
myfile.write(display.getWidget("FileNameTextInput2").getPropertyValue("text"))
myfile.write('GAM::ProcessHttpMessage(HttpStream &hStream){\n')
myfile.write('HtmlStream hmStream(hStream);\n')
myfile.write('int i;\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "html>\\n"\n')
myfile.write('\t"<head>\\n"\n')
myfile.write('\t"<title>%s</title>\\n"\n')
myfile.write('\t"</head>\\n"\n')
myfile.write('\t"<body>\\n"\n')
myfile.write('\t"<svg width=\\\"100&#37;\\\" height=\\\"100\\\" style=\\\"background-color: AliceBlue;\\\">\\n\"\n')
myfile.write('\t"<image x=\\\"%d\\\" y=\\\"%d\\\" width=\\\"%d\\\" height=\\\"%d\\\" xlink:href=\\\"%s\\\" />\\n\"\n')
myfile.write('\t"</svg", (char *) this->Name(),0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\\\"font-family:Arial;font-size:46\\\">%s</text><br", (char *) this->Name());\n')
myfile.write('FString submit_view;\n')
myfile.write('submit_view.SetSize(0);\n')
myfile.write('if (hStream.Switch("InputCommands.submit_view")){\n')
myfile.write('\thStream.Seek(0);\n')
myfile.write('\thStream.GetToken(submit_view, "");\n')
myfile.write('\thStream.Switch((uint32)0);\n')
myfile.write('}\n')
myfile.write('if(submit_view.Size() > 0) view_input_variables = True;\n')
myfile.write('FString submit_hide;\n')
myfile.write('submit_hide.SetSize(0);\n')
myfile.write('if (hStream.Switch("InputCommands.submit_hide")){\n')
myfile.write('\thStream.Seek(0);\n')
myfile.write('\thStream.GetToken(submit_hide, "");\n')
myfile.write('\thStream.Switch((uint32)0);\n')
myfile.write('}\n')
myfile.write('if(submit_hide.Size() > 0) view_input_variables = False;\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\\\"multipart/form-data\\\" method=\\\"post\\\"");\n')
myfile.write('if(!view_input_variables){\n')
myfile.write('\thmStream.SSPrintf(HtmlTagStreamMode, "input type=\\\"submit\\\" name=\\\"submit_view\\\" value=\\\"View input variables\\\"");\n')
myfile.write('}\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "/form");\n')
myfile.write('hmStream.SSPrintf(HtmlTagStreamMode, "/body>\\n</html");\n')
myfile.write('hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");\n')
myfile.write('hStream.WriteReplyHeader(True);\n')
myfile.write('return True;\n')
myfile.write('}\n')
myfile.close()
command001 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/Makefile.inc /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command001,1)
command002 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/Makefile.linux /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command002,1)
command003 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/MARTe3.sh /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command003,1)
command004 = "cp -f /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/algorithms/compile_gam.sh /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM"
ScriptUtil.executeSystemCommand(command004,1)
command01 = "sed -i 's/NewAlgorithm/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"/g'"+" /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+"Makefile.inc"
ScriptUtil.executeSystemCommand(command01,1)
command02 = "sed -i 's/NewAlgorithm/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"/g'"+" /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+"MARTe3.sh"
ScriptUtil.executeSystemCommand(command02,1)
command03 = "sed -i 's/NewAlgorithm/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"/g'"+" /home/opertok/CSS-Workspaces/sys-mng-opi/CSS/gams/"+display.getWidget("FileNameTextInput2").getPropertyValue("text")+"GAM/"+"compile_gam.sh"
ScriptUtil.executeSystemCommand(command03,1)

View File

@@ -0,0 +1,4 @@
+NewAlgorithm = {
Class = isttokbiblio::NewAlgorithmGAM
New_Algorithm_Signals
}

View File

@@ -0,0 +1,85 @@
#include "NewAlgorithmGAM.h"
OBJECTLOADREGISTER(NewAlgorithmGAM, "$Id: $")
// ******** Default constructor ***********************************
NewAlgorithmGAM::NewAlgorithmGAM(){
this->SignalsInputInterface = NULL;
this->SignalsOutputInterface = NULL;
}
// ********* Destructor ********************************************
NewAlgorithmGAM::~NewAlgorithmGAM()
{
if(this->SignalsInputInterface != NULL) delete[] this->SignalsInputInterface ;
if(this->SignalsOutputInterface != NULL) delete[] this->SignalsOutputInterface;
}
//{ ********* Initialise the module ********************************
bool NewAlgorithmGAM::Initialise(ConfigurationDataBase& cdbData){
CDBExtended cdb(cdbData);
return True;
}
//{ ********* Execute the module functionalities *******************
bool NewAlgorithmGAM::Execute(GAM_FunctionNumbers functionNumber){
InputInterfaceStruct *inputstruct = (InputInterfaceStruct *) this->SignalsInputInterface->Buffer();
this->SignalsInputInterface->Read();
OutputInterfaceStruct *outputstruct = (OutputInterfaceStruct *) this->SignalsOutputInterface->Buffer();
this->SignalsOutputInterface->Write();
return True;
}
bool NewAlgorithmGAM::ProcessHttpMessage(HttpStream &hStream){
HtmlStream hmStream(hStream);
int i;
hmStream.SSPrintf(HtmlTagStreamMode, "html>\n\
<head>\n\
<title>%s</title>\n\
</head>\n\
<body>\n\
<svg width=\"100&#37;\" height=\"100\" style=\"background-color: AliceBlue;\">\n\
<image x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" xlink:href=\"%s\" />\n\
</svg", (char *) this->Name() ,0, 0, 422, 87, "http://www.ipfn.ist.utl.pt/ipfnPortalLayout/themes/ipfn/_img_/logoIPFN_Topo_officialColours.png");
hmStream.SSPrintf(HtmlTagStreamMode, "br><br><text style=\"font-family:Arial;font-size:46\">%s</text><br", (char *) this->Name());
FString submit_view;
submit_view.SetSize(0);
if (hStream.Switch("InputCommands.submit_view")){
hStream.Seek(0);
hStream.GetToken(submit_view, "");
hStream.Switch((uint32)0);
}
if(submit_view.Size() > 0) view_input_variables = True;
FString submit_hide;
submit_hide.SetSize(0);
if (hStream.Switch("InputCommands.submit_hide")){
hStream.Seek(0);
hStream.GetToken(submit_hide, "");
hStream.Switch((uint32)0);
}
if(submit_hide.Size() > 0) view_input_variables = False;
hmStream.SSPrintf(HtmlTagStreamMode, "form enctype=\"multipart/form-data\" method=\"post\"");
if(!view_input_variables){
hmStream.SSPrintf(HtmlTagStreamMode, "input type=\"submit\" name=\"submit_view\" value=\"View input variables\"");
}
hmStream.SSPrintf(HtmlTagStreamMode, "/form");
hmStream.SSPrintf(HtmlTagStreamMode, "/body>\n</html");
hStream.SSPrintf("OutputHttpOtions.Content-Type","text/html;charset=utf-8");
hStream.WriteReplyHeader(True);
return True;
}

View File

@@ -0,0 +1,48 @@
#ifndef _NEWALGORITHM_H
#define _NEWALGORITHM_H
#include "DDBInputInterface.h"
#include "DDBOutputInterface.h"
#include "GAM.h"
#include "File.h"
#include "Matrix.h"
#include "HtmlStream.h"
OBJECT_DLL(NewAlgorithmGAM)
class NewAlgorithmGAM : public GAM, public HttpInterface {
private:
DDBInputInterface *SignalsInputInterface;
DDBOutputInterface *SignalsOutputInterface;
struct InputInterfaceStruct {
};
struct OutputInterfaceStruct {
};
bool view_input_variables;
public:
// Default constructor
NewAlgorithmGAM();
// Destructor
virtual ~NewAlgorithmGAM();
// Initialise the module
virtual bool Initialise(ConfigurationDataBase& cdbData);
// Execute the module functionalities
virtual bool Execute(GAM_FunctionNumbers functionNumber);
virtual bool ProcessHttpMessage(HttpStream &hStream);
OBJECT_DLL_STUFF(NewAlgorithmGAM)
};
#endif