diff --git a/.gitignore b/.gitignore index 72e36dd..84163e6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,9 @@ *.so .gitignore +.idea build/ build-* install-* __pycache__ +cmake-* \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a5c7a68..fdeb06f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,11 +12,14 @@ MESSAGE("Preparing project ${PROJECT_NAME} version ${PROJECT_VERSION}" ) project(${PROJECT_NAME} VERSION ${PROJECT_VERSION}) include(HKPackageBuilder) hkbuilder_prepare_project() -set( PUBLIC_EXT_LIBS ) hk_check_dependencies() add_subdirectory(DataModel) set(hk-DataModel_LIBRARIES hk-DataModel::DataModel) -hk_finalize_project() \ No newline at end of file +include_directories(DataModel BEFORE) +#hk_add_tool(ReaderTool DataModel) +#hk_add_tool(WriterTool DataModel) + +hk_finalize_project() diff --git a/DataModel/DataModel.cpp b/DataModel/DataModel.cpp index 8f6138c..218bfb9 100644 --- a/DataModel/DataModel.cpp +++ b/DataModel/DataModel.cpp @@ -4,25 +4,25 @@ DataModel::DataModel() { Log = 0; } -/* -TTree* DataModel::GetTTree(std::string name){ +// +//TTree* DataModel::GetTTree(std::string name){ +// +// return m_trees[name]; +// +//} +// +// +//void DataModel::AddTTree(std::string name,TTree *tree){ +// +// m_trees[name]=tree; +// +//} +// +// +//void DataModel::DeleteTTree(std::string name,TTree *tree){ +// +// m_trees.erase(name); +// +//} - return m_trees[name]; -} - - -void DataModel::AddTTree(std::string name,TTree *tree){ - - m_trees[name]=tree; - -} - - -void DataModel::DeleteTTree(std::string name,TTree *tree){ - - m_trees.erase(name); - -} - -*/ diff --git a/DataModel/DataModel.h b/DataModel/DataModel.h index 6a3471f..a975716 100644 --- a/DataModel/DataModel.h +++ b/DataModel/DataModel.h @@ -6,7 +6,7 @@ #include #include "Utilities.h" -// #include "TTree.h" +//#include "TTree.h" #include "BStore.h" #include "Logging.h" @@ -31,9 +31,9 @@ class DataModel { DataModel(); ///< Simple constructor - // TTree* GetTTree(std::string name); - // void AddTTree(std::string name,TTree *tree); - // void DeleteTTree(std::string name,TTree *tree); +// TTree* GetTTree(std::string name); +// void AddTTree(std::string name,TTree *tree); +// void DeleteTTree(std::string name,TTree *tree); Logging* Log; ///< Log class pointer for use in Tools, it can be used to send messages which can have ///< multiple error levels and destination end points @@ -50,7 +50,7 @@ class DataModel { private: - // std::map m_trees; +// std::map m_trees; }; #endif diff --git a/Dockerfile b/Dockerfile index 716e11a..20932b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/hyperk/toolframeworkcore:main +FROM ghcr.io/hyperk/hk-pilot:main COPY . /usr/local/hk/hk-DataModel @@ -6,4 +6,4 @@ RUN --mount=type=ssh mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh WORKDIR /usr/local/hk RUN --mount=type=ssh . /usr/local/hk/hk-pilot/setup.sh &&\ - hkp install -r -e hk-DataModel + hkp install -r hk-DataModel diff --git a/ReaderTool/README.md b/ReaderTool/README.md new file mode 100644 index 0000000..23a43b1 --- /dev/null +++ b/ReaderTool/README.md @@ -0,0 +1 @@ +# ReaderTool diff --git a/ReaderTool/ReaderTool.cpp b/ReaderTool/ReaderTool.cpp new file mode 100644 index 0000000..10c4fa9 --- /dev/null +++ b/ReaderTool/ReaderTool.cpp @@ -0,0 +1,28 @@ +#include "ReaderTool.h" + +ReaderTool::ReaderTool() : Tool() {} + +bool ReaderTool::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; + + return true; +} + +bool ReaderTool::Execute() { + + return true; +} + +bool ReaderTool::Finalise() { + + return true; +} diff --git a/ReaderTool/ReaderTool.h b/ReaderTool/ReaderTool.h new file mode 100644 index 0000000..9fd4887 --- /dev/null +++ b/ReaderTool/ReaderTool.h @@ -0,0 +1,36 @@ +#ifndef ReaderTool_H +#define ReaderTool_H + +#include +#include + +#include "DataModel.h" +#include "Tool.h" + +/** + * \class ReaderTool + * + * This is a blank template for a Tool used by the script to generate a new custom tool. Please fill out the + * description and author information. + * + * $Author: B.Richards $ + * $Date: 2019/05/28 10:44:00 $ + */ + +class ReaderTool : public Tool { + + public: + + ReaderTool(); ///< Simple constructor + bool Initialise(std::string configfile, + DataModel& data); ///< Initialise Function for setting up Tool resources. @param + ///< configfile The path and name of the dynamic configuration file + ///< to read in. @param data A reference to the transient data + ///< class used to pass information between Tools. + bool Execute(); ///< Execute function used to perform Tool purpose. + bool Finalise(); ///< Finalise funciton used to clean up resources. + + private: +}; + +#endif diff --git a/WriterTool/README.md b/WriterTool/README.md new file mode 100644 index 0000000..2a2abfc --- /dev/null +++ b/WriterTool/README.md @@ -0,0 +1 @@ +# WriterTool diff --git a/WriterTool/WriterTool.cpp b/WriterTool/WriterTool.cpp new file mode 100644 index 0000000..8a13e69 --- /dev/null +++ b/WriterTool/WriterTool.cpp @@ -0,0 +1,28 @@ +#include "WriterTool.h" + +WriterTool::WriterTool() : Tool() {} + +bool WriterTool::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; + + return true; +} + +bool WriterTool::Execute() { + + return true; +} + +bool WriterTool::Finalise() { + + return true; +} diff --git a/WriterTool/WriterTool.h b/WriterTool/WriterTool.h new file mode 100644 index 0000000..b8c1ae7 --- /dev/null +++ b/WriterTool/WriterTool.h @@ -0,0 +1,36 @@ +#ifndef WriterTool_H +#define WriterTool_H + +#include +#include + +#include "DataModel.h" +#include "Tool.h" + +/** + * \class WriterTool + * + * This is a blank template for a Tool used by the script to generate a new custom tool. Please fill out the + * description and author information. + * + * $Author: B.Richards $ + * $Date: 2019/05/28 10:44:00 $ + */ + +class WriterTool : public Tool { + + public: + + WriterTool(); ///< Simple constructor + bool Initialise(std::string configfile, + DataModel& data); ///< Initialise Function for setting up Tool resources. @param + ///< configfile The path and name of the dynamic configuration file + ///< to read in. @param data A reference to the transient data + ///< class used to pass information between Tools. + bool Execute(); ///< Execute function used to perform Tool purpose. + bool Finalise(); ///< Finalise funciton used to clean up resources. + + private: +}; + +#endif diff --git a/dependencies.cmake b/dependencies.cmake index 6006ad6..f091858 100644 --- a/dependencies.cmake +++ b/dependencies.cmake @@ -1 +1,2 @@ hk_package(ToolFrameworkCore *) +#hk_package(ROOT *) \ No newline at end of file diff --git a/hk-DataModelConfig.cmake.in b/hk-DataModelConfig.cmake.in new file mode 100644 index 0000000..b0baea1 --- /dev/null +++ b/hk-DataModelConfig.cmake.in @@ -0,0 +1,15 @@ +get_filename_component( @PROJECT_NAME@_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH ) + +# Taken from the hk-pilot CMake files +# Seems like we will need to past this kind of paragraph for any package that directly depends on ROOT +# Dependencies that depends on packages that depends on ROOT shouldn't have to do this, as long as the dependency has this paragraph +MESSAGE(STATUS "Including ROOT headers: @ROOT_INCLUDE_DIRS@") +include_directories(BEFORE @ROOT_INCLUDE_DIRS@) +# Manual way to set the CXX standard if ROOT uses c++17 standard +# Not very gracious... +set(CMAKE_CXX_STANDARD @CMAKE_CXX_STANDARD@) +MESSAGE(STATUS "Using CXX standard @CMAKE_CXX_STANDARD@ because of ROOT") + +include("${@PROJECT_NAME@_CMAKE_DIR}/@PROJECT_NAME@_Library_Targets.cmake") + +list (APPEND @PROJECT_NAME@_LIBRARIES @PROJECT_LIBS@) \ No newline at end of file diff --git a/hkinstall.py b/hkinstall.py index cf47ff9..9f5119d 100644 --- a/hkinstall.py +++ b/hkinstall.py @@ -6,3 +6,9 @@ class hkDataModel(CMake): def __init__(self, path): super().__init__(path) self._package_name = "hk-DataModel" + + def post_install(self): + # Run standard post_install step + super().post_install() + + return self.link_compiled_tools_dir()