Skip to content

Commit 1bcc48a

Browse files
authored
Merge pull request #23 from FAIRDataPipeline/dev
Dev
2 parents fa62b6c + 9175149 commit 1bcc48a

35 files changed

+886
-322
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ INCLUDE( external/jsoncpp.cmake )
6161
INCLUDE( external/digestpp.cmake )
6262
INCLUDE( external/curl.cmake )
6363
INCLUDE( external/yaml_cpp.cmake )
64-
INCLUDE( external/spdlog.cmake )
6564
INCLUDE( external/toml11.cmake )
6665
INCLUDE( external/ghc.cmake )
6766

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ $ cmake --build build --config=Release
3333
## Outline
3434
The main class the user will interact with is `DataPipeline` which has only the required methods such as `link_read` etc. This class has a member which is a pointer to an underlying `DataPipelineImpl_` class which performs the various procedures required to handle the data. A logger has been used to give as much feedback to the user as possible, the verbosity being handled by a log level argument.
3535

36+
### Logging
37+
The environment variable `FDP_LOG_LEVEL=[TRACE:DEBUG:INFO:WARN:ERROR:CRITICAL:OFF]` can be set to specify the logging output level.
3638

3739
## Unit Tests
3840
The unit tests use the local registry, this needs to be running prior to running the tests see: [the CLI documentation](https://github.com/FAIRDataPipeline/FAIR-CLI#registry)

external/digestpp.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SET( DIGESTCPP_COMMIT "34ff2eeae397ed744d972d86b5a20f603b029fbd" )
77
# So tell the compiler to exclude min and max macros in windows
88
IF(WIN32)
99
add_definitions(-DNOMINMAX)
10+
add_definitions(-DNOGDI)
1011
ENDIF()
1112

1213
MESSAGE( STATUS "[DigestCPP]" )

external/jsoncpp.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ MESSAGE( STATUS "[JsonCPP]" )
44
MESSAGE( STATUS "\tJsonCpp Will be installed." )
55
MESSAGE( STATUS "\tURL: ${JSONCPP_URL}" )
66

7+
SET (JSONCPP_WITH_TESTS OFF CACHE INTERNAL "Don't Build cpp tests")
8+
79
include(FetchContent)
810
FetchContent_Declare(
911
JsonCpp

external/spdlog.cmake

Lines changed: 0 additions & 13 deletions
This file was deleted.

include/fdp/exceptions.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <stdexcept>
55
#include <string>
66

7-
namespace FDP {
7+
namespace FairDataPipeline {
88
class config_parsing_error : public std::runtime_error {
99
public:
1010
config_parsing_error(const std::string& message)
@@ -37,6 +37,6 @@ public:
3737
write_error(const std::string& message) : std::runtime_error(message) {}
3838
};
3939

40-
}; // namespace FDP
40+
}; // namespace FairDataPipeline
4141

4242
#endif

include/fdp/fdp.hxx

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#ifndef __FDP__
22
#define __FDP__
33

4-
#include "spdlog/spdlog.h"
5-
#include <ghc/filesystem.hpp>
4+
#include "utilities/logging.hxx"
65

7-
//#include "fdp/registry/datapipeline.hxx"
6+
#include <ghc/filesystem.hpp>
87

9-
namespace FDP {
8+
namespace FairDataPipeline {
109
/**
1110
* @brief DataPipeline Class:
1211
* A PIMPL Class for interacting the the FAIR Data Pipeline
@@ -15,31 +14,29 @@ namespace FDP {
1514
class DataPipeline {
1615

1716
public:
17+
typedef std::shared_ptr< DataPipeline > sptr;
1818
/**
1919
* @brief Construct a new Data Pipeline (PIMPL)
2020
*
2121
* @param config_file_path
2222
* @param script_file_path
2323
* @param token
24-
* @param log_level
2524
*/
26-
explicit DataPipeline(
25+
static sptr construct(
2726
const std::string &config_file_path,
2827
const std::string &script_file_path,
29-
std::string token = "",
30-
spdlog::level::level_enum log_level = spdlog::level::info);
28+
std::string token = "" );
29+
3130

3231
/**
3332
* @brief Destroy the Data Pipeline object
3433
*
3534
*/
3635
~DataPipeline();
3736

38-
DataPipeline(DataPipeline &&rhs) noexcept;
39-
DataPipeline &operator=(DataPipeline &&rhs) noexcept;
37+
//DataPipeline(DataPipeline &&rhs) noexcept;
38+
//DataPipeline &operator=(DataPipeline &&rhs) noexcept;
4039

41-
DataPipeline(const DataPipeline &rhs);
42-
DataPipeline &operator=(const DataPipeline &rhs);
4340

4441
/**
4542
* @brief Return a path to a given data product
@@ -68,10 +65,19 @@ namespace FDP {
6865
void finalise();
6966

7067
private:
68+
explicit DataPipeline(
69+
const std::string &config_file_path,
70+
const std::string &script_file_path,
71+
std::string token = ""
72+
);
73+
74+
DataPipeline(const DataPipeline &rhs) = delete;
75+
76+
DataPipeline &operator=(const DataPipeline &rhs) = delete;
77+
7178
class impl;
7279

7380
std::shared_ptr< DataPipeline::impl > pimpl_;
7481
};
75-
}; // namespace FDP
76-
82+
}; // namespace FairDataPipeline
7783
#endif

include/fdp/objects/api_object.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "fdp/utilities/logging.hxx"
99

10-
namespace FDP {
10+
namespace FairDataPipeline {
1111
/**
1212
* @brief Class for API objects
1313
*
@@ -49,7 +49,7 @@ namespace FDP {
4949
* @return int object id e.g. if the uri is http://127.0.0.1/object/1
5050
* the object id will be 1
5151
*/
52-
int get_id();
52+
int get_id() const ;
5353
/**
5454
* @brief Get the object type from the uri
5555
*
@@ -58,7 +58,7 @@ namespace FDP {
5858
*/
5959
static int get_id_from_string(std::string url);
6060

61-
std::string get_type();
61+
std::string get_type() const ;
6262
/**
6363
* @brief Get the object uri
6464
*

include/fdp/objects/config.hxx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@
2525
#include "fdp/objects/api_object.hxx"
2626
#include "fdp/objects/io_object.hxx"
2727

28-
namespace FDP {
28+
namespace FairDataPipeline {
2929
/**
3030
* @brief class for interacting with confifurations
3131
*
3232
*/
3333
class Config {
34+
public:
35+
typedef std::shared_ptr< Config > sptr;
36+
37+
typedef std::map< std::string, IOObject > map_type;
38+
3439
private:
3540
const ghc::filesystem::path config_file_path_;
3641
const ghc::filesystem::path config_dir_;
@@ -59,11 +64,11 @@ namespace FDP {
5964

6065
ApiObject::sptr code_run_;
6166

62-
std::map<std::string, IOObject> writes_;
63-
std::map<std::string, IOObject> reads_;
67+
map_type writes_;
68+
map_type reads_;
6469

65-
std::map<std::string, IOObject> outputs_;
66-
std::map<std::string, IOObject> inputs_;
70+
map_type outputs_;
71+
map_type inputs_;
6772

6873
RESTAPI rest_api_location_ = RESTAPI::LOCAL;
6974

@@ -87,7 +92,6 @@ namespace FDP {
8792

8893

8994
public:
90-
typedef std::shared_ptr< Config > sptr;
9195

9296
static Config::sptr construct(const ghc::filesystem::path &config_file_path,
9397
const ghc::filesystem::path &script_file_path,
@@ -225,15 +229,15 @@ namespace FDP {
225229
* @param data_product
226230
* @return ghc::filesystem::path
227231
*/
228-
ghc::filesystem::path link_write(std::string &data_product);
232+
ghc::filesystem::path link_write( const std::string &data_product);
229233

230234
/**
231235
* @brief Return the filepath to a given data product
232236
*
233237
* @param data_product
234238
* @return ghc::filesystem::path
235239
*/
236-
ghc::filesystem::path link_read(std::string &data_product);
240+
ghc::filesystem::path link_read(const std::string& data_product);
237241

238242
/**
239243
* @brief Finalise the pipeline

include/fdp/objects/io_object.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "fdp/utilities/logging.hxx"
99
#include "fdp/objects/api_object.hxx"
1010

11-
namespace FDP {
11+
namespace FairDataPipeline {
1212
/**
1313
* @brief Class for API objects
1414
*
@@ -123,7 +123,7 @@ namespace FDP {
123123
*
124124
* @return const std::string&
125125
*/
126-
const std::string& get_use_namespace() {return use_namespace_;}
126+
const std::string& get_use_namespace() const {return use_namespace_;}
127127

128128
/**
129129
* @brief Get the path of the data product
@@ -144,7 +144,7 @@ namespace FDP {
144144
*
145145
* @return std::string
146146
*/
147-
const std::string& get_component_description() {return component_description_;}
147+
const std::string& get_component_description() const {return component_description_;}
148148

149149
/**
150150
* @brief Check whether the data product is public

0 commit comments

Comments
 (0)