generated from ToolFramework/ToolApplication
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,183 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ main | |
*.root | ||
*# | ||
cmake-* | ||
# removing the backup unity files and so on... | ||
*.bak.* | ||
build-* | ||
install-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
# Definition of ToolChain | ||
# Some hack to build the ToolChain library whose source files exist in the ToolFrameworkCore library | ||
set (TOOLCHAIN_SRC ${ToolFrameworkCore_SRC_DIR}/ToolChain.cpp) | ||
pbuilder_library( | ||
TARGET HKToolChain | ||
SOURCES ${TOOLCHAIN_SRC} | ||
PROJECT_LIBRARIES HKFactory | ||
PUBLIC_EXTERNAL_LIBRARIES ${PUBLIC_EXT_LIBRARIES} # should contain at least ToolFrameworkCore::ToolFrameworkCore and hk-DataModel::DataModel | ||
PRIVATE_EXTERNAL_LIBRARIES ${PRIVATE_EXT_LIBS} | ||
) | ||
# Exporting library | ||
pbuilder_component_install_and_export( | ||
COMPONENT Library | ||
LIBTARGETS HKToolChain | ||
) | ||
# End of hack | ||
|
||
# Find all the local tools to be compiled with hk-ToolApp | ||
MACRO(SUBDIRLIST result curdir) | ||
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) | ||
SET(dirlist "") | ||
FOREACH(child ${children}) | ||
IF(IS_DIRECTORY ${curdir}/${child} | ||
AND NOT "${child}" STREQUAL "template" | ||
AND NOT "${child}" STREQUAL "Factory" | ||
AND NOT "${child}" STREQUAL "InactiveTools" | ||
) | ||
LIST(APPEND dirlist ${child}) | ||
ENDIF() | ||
ENDFOREACH() | ||
SET(${result} ${dirlist}) | ||
ENDMACRO() | ||
|
||
SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
MESSAGE(STATUS "List of tools dir to be added: ${SUBDIRS}") | ||
FOREACH (dir ${SUBDIRS}) | ||
hk_add_tool(${dir}) | ||
list( APPEND PUBLIC_EXT_LIBS ${dir}) | ||
ENDFOREACH () | ||
|
||
|
||
add_subdirectory(Factory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "DummyTool.h" | ||
|
||
DummyTool::DummyTool() : Tool() {} | ||
|
||
bool DummyTool::Initialise(std::string configfile, DataModel& data) { | ||
|
||
if(configfile != "") | ||
m_variables.Initialise(configfile); | ||
// m_variables.Print(); | ||
|
||
m_data = &data; | ||
m_log = m_data->Log; | ||
|
||
if(!m_variables.Get("verbose", m_verbose)) | ||
m_verbose = 1; | ||
|
||
Log("test 1", 1, m_verbose); | ||
|
||
return true; | ||
} | ||
|
||
bool DummyTool::Execute() { | ||
|
||
Log("test 2", 2, m_verbose); | ||
// sleep(2); | ||
return true; | ||
} | ||
|
||
bool DummyTool::Finalise() { | ||
|
||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef DummyTool_H | ||
#define DummyTool_H | ||
|
||
#include <iostream> | ||
#include <string> | ||
|
||
#include "Tool.h" | ||
|
||
/** | ||
* \class DummyTool | ||
* | ||
* This is a simple dummy Tool designed to show operation of a Tool. It also provides a default Tool for the | ||
* Default ToolChain. | ||
* | ||
* $Author: B.Richards $ | ||
* $Date: 2019/05/28 10:44:00 $ | ||
*/ | ||
|
||
class DummyTool : public Tool { | ||
|
||
public: | ||
|
||
DummyTool(); ///< Constructor | ||
bool Initialise(std::string configfile, | ||
DataModel& data); ///< Assigns verbosity from config file and creates a log message. | ||
bool Execute(); ///< Creates a log message. | ||
bool Finalise(); ///< Does nothing | ||
|
||
private: | ||
|
||
int m_verbose; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
file(GLOB_RECURSE SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "Factory.cpp") | ||
|
||
pbuilder_library( | ||
TARGET HKFactory | ||
SOURCES ${SRC} | ||
PROJECT_LIBRARIES ${TOOLS_LIBS} | ||
PUBLIC_EXTERNAL_LIBRARIES ${PUBLIC_EXT_LIBS} ${EXT_TOOLS_LIBS} | ||
PRIVATE_EXTERNAL_LIBRARIES ${PRIVATE_EXT_LIBS} | ||
) | ||
|
||
pbuilder_install_headers(${HEADERS}) | ||
|
||
# Exporting library | ||
pbuilder_component_install_and_export( | ||
COMPONENT Library | ||
LIBTARGETS HKFactory | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include "Factory.h" | ||
|
||
Tool* Factory(std::string tool) { | ||
Tool* ret=0; | ||
|
||
// if (tool=="Type") tool=new Type; | ||
if (tool=="DummyTool") ret=new DummyTool; | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/local/hk/hk-ToolApp/UserTools/ImportedTools/TFToolPack/PythonScript/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# DAQFramework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/local/hk/hk-ToolApp/UserTools/ImportedTools/TFToolPack/SubToolChain/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/local/hk/hk-ToolApp/UserTools/ImportedTools/TFToolPack/ThreadedSubToolChain/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# DAQFramework |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
#!/bin/bash | ||
|
||
if ! command -v dialog &> /dev/null | ||
then | ||
echo "dialog package needed for operation. Please install then re-run script" | ||
exit | ||
fi | ||
|
||
|
||
#cat Factory.cpp | grep -v '/' |grep if| awk '{print $4}' | sed s:';':: > on | ||
num=1 | ||
|
||
#ls */*.cpp | sed s:/:' ': | awk '{print $2}' | sed s:.cpp:: | grep -v Factory | ||
#ls -p | grep -v Factory | grep -v template | grep / | sed s:/::\ | ||
|
||
dialog --backtitle "Options" \ | ||
--radiolist "Select (with spacebar) option:" 0 0 0 \ | ||
1 "Activate/Deactivate Tools" on \ | ||
2 "Restore Backup" off 2>tmpoption | ||
|
||
if [ $? -eq 0 ] | ||
then | ||
|
||
if [ `cat tmpoption` -eq 1 ] | ||
then | ||
|
||
dialog --checklist "Activate or Deactivate Tools with <spacebar>, Enter for OK and ESC for Cancel:" 0 0 0 \ | ||
`for Tool in \`ls */*.cpp | grep -v template/ | sed s:/:' ': | awk '{print $2}' | sed s:.cpp:: | grep -v Factory\` | ||
do | ||
fin=0 | ||
for current in \`cat Factory/Factory.cpp | grep -v '/' |grep if| awk '{print $4}' | sed s:';':: \` | ||
do | ||
if [ $Tool == $current ] | ||
then | ||
fin=1 | ||
echo "$Tool $num on " | ||
fi | ||
done | ||
if [ $fin -eq 0 ] | ||
then | ||
echo "$Tool $num off " | ||
fi | ||
num=$(expr 1 + $num) | ||
done | ||
for Tool in \`ls InactiveTools/*/*.cpp | sed s:/:' ':g | awk '{print $3}' | sed s:.cpp:: \` | ||
do | ||
echo "$Tool $num off " | ||
num=$(expr 1 + $num) | ||
done` 2> tmptools | ||
if [ $? -eq 0 ] | ||
then | ||
dialog --title "Message" --yesno "Backup existing configuration?" 0 0 | ||
if [ $? -eq 0 ] | ||
then | ||
cp Unity.h Unity.bak.`date +%F.%T` | ||
cp Factory/Factory.cpp Factory/Factory.bak.`date +%F.%T` | ||
fi | ||
rm -f Unity.h | ||
for Tool in `cat tmptools` | ||
do | ||
echo "#include <$Tool.h>" >> Unity.h | ||
done | ||
touch Unity.h | ||
echo "#include \"Factory.h\" | ||
Tool* Factory(std::string tool) { | ||
Tool* ret=0; | ||
// if (tool==\"Type\") tool=new Type;" > Factory/Factory.cpp | ||
for Tool in `cat tmptools` | ||
do | ||
echo "if (tool==\"$Tool\") ret=new $Tool;" >> Factory/Factory.cpp | ||
done | ||
echo "return ret; | ||
}" >> Factory/Factory.cpp | ||
for dir in `ls */ | grep / | sed s:'/\:':: | grep -v Factory | grep -v template | grep -v InactiveTools | grep -v ImportedTools` | ||
do | ||
exists=0 | ||
for Tool in `cat tmptools` | ||
do | ||
if [ $Tool == $dir ] | ||
then | ||
exists=1 | ||
fi | ||
done | ||
if [ $exists -eq 0 ] | ||
then | ||
mv $dir InactiveTools/ | ||
fi | ||
done | ||
for dir in `ls InactiveTools/` | ||
do | ||
for Tool in `cat tmptools` | ||
do | ||
if [ $Tool == $dir ] | ||
then | ||
mv InactiveTools/$dir ./ | ||
fi | ||
done | ||
done | ||
fi | ||
rm -f tmptools | ||
else | ||
dialog --radiolist "Select backup with <spacebar>, Enter for OK and ESC for Cancel:" 0 0 0 \ | ||
`for backup in \`ls *.bak.*\` | ||
do | ||
echo $backup . off | ||
done | ||
` 2> tmpbackup | ||
|
||
if [ $? -eq 0 ] | ||
then | ||
|
||
if [ -s tmpbackup ] | ||
then | ||
|
||
dialog --title "Message" --yesno "Backup existing configuration?" 0 0 | ||
if [ $? -eq 0 ] | ||
then | ||
cp Unity.h Unity.bak.`date +%F.%T` | ||
cp Factory/Factory.cpp Factory/Factory.bak.`date +%F.%T` | ||
fi | ||
|
||
cp `cat tmpbackup` Unity.h | ||
cp `cat tmpbackup | sed s:Unity:Factory/Factory:` Factory/Factory.cpp | ||
fi | ||
|
||
fi | ||
|
||
rm -f tmpbackup | ||
|
||
|
||
for dir in `ls */ | grep / | sed s:'/\:':: | grep -v Factory | grep -v template | grep -v InactiveTools | grep -v ImportedTools` | ||
do | ||
exists=0 | ||
for Tool in `cat Factory/Factory.cpp | grep -v '/' |grep if| awk '{print $4}' | sed s:';':: ` | ||
do | ||
if [ $Tool == $dir ] | ||
then | ||
exists=1 | ||
fi | ||
done | ||
|
||
if [ $exists -eq 0 ] | ||
then | ||
mv $dir InactiveTools/ | ||
fi | ||
done | ||
|
||
for dir in `ls InactiveTools/` | ||
do | ||
for Tool in `cat Factory/Factory.cpp | grep -v '/' |grep if| awk '{print $4}' | sed s:';':: ` | ||
do | ||
if [ $Tool == $dir ] | ||
then | ||
mv InactiveTools/$dir ./ | ||
fi | ||
done | ||
|
||
done | ||
|
||
|
||
|
||
fi | ||
|
||
|
||
fi | ||
|
||
rm -f tmpoption | ||
clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <DummyTool.h> |
Oops, something went wrong.