Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Reader and Writer tools (for testing) #3

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
*.so
.gitignore

.idea
build/
build-*
install-*
__pycache__
cmake-*
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
include_directories(DataModel BEFORE)
#hk_add_tool(ReaderTool DataModel)
#hk_add_tool(WriterTool DataModel)

hk_finalize_project()
40 changes: 20 additions & 20 deletions DataModel/DataModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}

*/
10 changes: 5 additions & 5 deletions DataModel/DataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <vector>
#include "Utilities.h"

// #include "TTree.h"
//#include "TTree.h"

#include "BStore.h"
#include "Logging.h"
Expand All @@ -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
Expand All @@ -50,7 +50,7 @@ class DataModel {

private:

// std::map<std::string,TTree*> m_trees;
// std::map<std::string,TTree*> m_trees;
};

#endif
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM ghcr.io/hyperk/toolframeworkcore:main
FROM ghcr.io/hyperk/hk-pilot:main

COPY . /usr/local/hk/hk-DataModel

RUN --mount=type=ssh mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts

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
1 change: 1 addition & 0 deletions ReaderTool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ReaderTool
28 changes: 28 additions & 0 deletions ReaderTool/ReaderTool.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
36 changes: 36 additions & 0 deletions ReaderTool/ReaderTool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef ReaderTool_H
#define ReaderTool_H

#include <iostream>
#include <string>

#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
1 change: 1 addition & 0 deletions WriterTool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# WriterTool
28 changes: 28 additions & 0 deletions WriterTool/WriterTool.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
36 changes: 36 additions & 0 deletions WriterTool/WriterTool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef WriterTool_H
#define WriterTool_H

#include <iostream>
#include <string>

#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
1 change: 1 addition & 0 deletions dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
hk_package(ToolFrameworkCore *)
#hk_package(ROOT *)
15 changes: 15 additions & 0 deletions hk-DataModelConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -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@)
6 changes: 6 additions & 0 deletions hkinstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Loading