From 30b53d49c13a6f9c9524acb64ed6e96334ffc06f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radovan=20=C4=8Cerven=C3=BD?= <radovan.cerveny@gmail.com> Date: Sun, 14 Feb 2016 20:05:54 +0100 Subject: [PATCH] basic api and structures outline --- ameasure2/src/ameasure.cpp | 23 +++++++++++++++++- .../provisioner/MeasurementProvisioner.cpp | 21 ++++++++++++++++ .../provisioner/MeasurementProvisioner.hpp | 24 +++++++++++++++++++ .../MeasurementProvisionerConfiguration.hpp | 15 ++++++++++++ .../MeasurementProvisionerResults.hpp | 15 ++++++++++++ 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 ameasure2/src/provisioner/MeasurementProvisioner.cpp create mode 100644 ameasure2/src/provisioner/MeasurementProvisioner.hpp create mode 100644 ameasure2/src/provisioner/MeasurementProvisionerConfiguration.hpp create mode 100644 ameasure2/src/provisioner/MeasurementProvisionerResults.hpp diff --git a/ameasure2/src/ameasure.cpp b/ameasure2/src/ameasure.cpp index 646417f0e9..092a51eeb5 100644 --- a/ameasure2/src/ameasure.cpp +++ b/ameasure2/src/ameasure.cpp @@ -3,15 +3,36 @@ */ #include <tclap/CmdLine.h> +#include "factory/XmlDataFactory.hpp" +#include "provisioner/MeasurementProvisioner.hpp" int main ( int argc, char * * argv ) { try { - TCLAP::CmdLine cmd ( "Measurements provisioner and processor binary", ' ', "0.01" ); + TCLAP::CmdLine cmd ( "Measurement provisioner and processor binary", ' ', "0.01" ); + + TCLAP::UnlabeledValueArg < std::string > input ( "input", "provisioning file", false, "-", "file" ); + cmd.add ( input ); cmd.parse ( argc, argv ); + std::deque < sax::Token > tokens; + + if ( input.getValue ( ) == "-" ) + sax::SaxParseInterface::parseStdin ( tokens ); + else + sax::SaxParseInterface::parseFile ( input.getValue ( ), tokens ); + + auto configuration = provisioner::MeasurementProvisioner::parse_configuration ( tokens ); + auto results = provisioner::MeasurementProvisioner::run_configuration ( configuration ); + + std::cout << results << std::endl; + return 0; + + } catch ( const exception::AlibException & exception ) { + alib::XmlDataFactory::toStdout ( exception ); + return 1; } catch ( const TCLAP::ArgException & exception ) { std::cout << exception.error ( ) << std::endl; return 2; diff --git a/ameasure2/src/provisioner/MeasurementProvisioner.cpp b/ameasure2/src/provisioner/MeasurementProvisioner.cpp new file mode 100644 index 0000000000..9b0aba9857 --- /dev/null +++ b/ameasure2/src/provisioner/MeasurementProvisioner.cpp @@ -0,0 +1,21 @@ +/* + * Author: Radovan Cerveny + */ + +#include "MeasurementProvisioner.hpp" + +namespace provisioner { + +MeasurementProvisionerConfiguration MeasurementProvisioner::parse_configuration ( std::deque < sax::Token > ) { + MeasurementProvisionerConfiguration configuration; + + return configuration; +} + +MeasurementProvisionerResults MeasurementProvisioner::run_configuration ( const MeasurementProvisionerConfiguration & ) { + MeasurementProvisionerResults results; + + return results; +} + +} diff --git a/ameasure2/src/provisioner/MeasurementProvisioner.hpp b/ameasure2/src/provisioner/MeasurementProvisioner.hpp new file mode 100644 index 0000000000..28c9c01cc7 --- /dev/null +++ b/ameasure2/src/provisioner/MeasurementProvisioner.hpp @@ -0,0 +1,24 @@ +/* + * Author: Radovan Cerveny + */ + +#ifndef MEASUREMENT_PROVISIONER_HPP_ +#define MEASUREMENT_PROVISIONER_HPP_ + +#include "sax/Token.h" +#include <deque> +#include "MeasurementProvisionerConfiguration.hpp" +#include "MeasurementProvisionerResults.hpp" + +namespace provisioner { + +class MeasurementProvisioner { + +public: + static MeasurementProvisionerConfiguration parse_configuration ( std::deque < sax::Token > ); + static MeasurementProvisionerResults run_configuration ( const MeasurementProvisionerConfiguration & ); +}; + +} + +#endif /* MEASUREMENT_PROVISIONER_HPP_ */ diff --git a/ameasure2/src/provisioner/MeasurementProvisionerConfiguration.hpp b/ameasure2/src/provisioner/MeasurementProvisionerConfiguration.hpp new file mode 100644 index 0000000000..45f2b57ff6 --- /dev/null +++ b/ameasure2/src/provisioner/MeasurementProvisionerConfiguration.hpp @@ -0,0 +1,15 @@ +/* + * Author: Radovan Cerveny + */ + +#ifndef MEASUREMENT_PROVISIONER_CONFIGURATION_HPP_ +#define MEASUREMENT_PROVISIONER_CONFIGURATION_HPP_ + +namespace provisioner { + +struct MeasurementProvisionerConfiguration { +}; + +} + +#endif /* MEASUREMENT_PROVISIONER_CONFIGURATION_HPP_ */ diff --git a/ameasure2/src/provisioner/MeasurementProvisionerResults.hpp b/ameasure2/src/provisioner/MeasurementProvisionerResults.hpp new file mode 100644 index 0000000000..ff9c79eacb --- /dev/null +++ b/ameasure2/src/provisioner/MeasurementProvisionerResults.hpp @@ -0,0 +1,15 @@ +/* + * Author: Radovan Cerveny + */ + +#ifndef MEASUREMENT_PROVISIONER_RESULTS_HPP_ +#define MEASUREMENT_PROVISIONER_RESULTS_HPP_ + +namespace provisioner { + +struct MeasurementProvisionerResults { +}; + +} + +#endif /* MEASUREMENT_PROVISIONER_RESULTS_HPP_ */ -- GitLab