From d6b756304efdcede480edfadcfc3248cef7b1756 Mon Sep 17 00:00:00 2001 From: Marco Clemencic Date: Mon, 24 Sep 2018 10:57:06 +0200 Subject: [PATCH 1/2] Enable ADL for Gaudi::Parsers::parse relieve the requirement of strict ordering of includes --- .../src/Properties/CustomPropertiesAlg.cpp | 5 ++--- GaudiKernel/GaudiKernel/Property.h | 13 +++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp b/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp index 073272387b..4c839792d6 100644 --- a/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp +++ b/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp @@ -1,3 +1,5 @@ +#include "CustomPropertiesAlg.h" + // ---------------------------------------------------------------------------- // Allow to use std::unordered_map as a property // ---------------------------------------------------------------------------- @@ -55,9 +57,6 @@ namespace std } } -// This must be included after the grammar definitions -#include "CustomPropertiesAlg.h" - // ---------------------------------------------------------------------------- // Implementation file for class: CustomPropertiesAlg // diff --git a/GaudiKernel/GaudiKernel/Property.h b/GaudiKernel/GaudiKernel/Property.h index 20b5ab42b5..cf18582e73 100644 --- a/GaudiKernel/GaudiKernel/Property.h +++ b/GaudiKernel/GaudiKernel/Property.h @@ -20,6 +20,15 @@ namespace Gaudi { + namespace Parsers + { + /// Helper class to enable ADL for parsers + struct InputData : std::string { + InputData( const std::string& s ) : std::string{s} {} + using std::string::string; + using std::string::operator=; + }; + } namespace Details { // ============================================================================ @@ -189,8 +198,8 @@ namespace Gaudi protected: void fromStringImpl( TYPE& buffer, const std::string& s ) { - using Gaudi::Parsers::parse; - if ( !parse( buffer, s ).isSuccess() ) { + using Gaudi::Parsers::InputData; + if ( !parse( buffer, InputData{s} ).isSuccess() ) { throw std::invalid_argument( "cannot parse '" + s + "' to " + System::typeinfoName( typeid( TYPE ) ) ); } } -- GitLab From f2be9a527b023a780bfdc11b38a03ffc6323fe36 Mon Sep 17 00:00:00 2001 From: Marco Clemencic Date: Mon, 24 Sep 2018 11:19:30 +0200 Subject: [PATCH 2/2] Reorganization of Gaudi::Parsers code - moved related headers to different hierarchy - Gaudi/Parsers/XYZ.h --- .../src/IncidentSvc/DODBasicMapper.cpp | 2 +- .../ExtendedProperties/ExtendedProperties.cpp | 2 +- .../src/Properties/CustomPropertiesAlg.cpp | 4 +- GaudiGSL/src/Lib/Interpolation.cpp | 2 +- GaudiKernel/CMakeLists.txt | 2 +- GaudiKernel/Gaudi/Parsers/CommonParsers.h | 541 +++++++++++++++ GaudiKernel/Gaudi/Parsers/Factory.h | 60 ++ GaudiKernel/Gaudi/Parsers/Grammars.h | 611 +++++++++++++++++ GaudiKernel/Gaudi/Parsers/InputData.h | 16 + .../GaudiKernel/BoostArrayAsProperty.h | 2 +- GaudiKernel/GaudiKernel/GrammarsV2.h | 615 +----------------- GaudiKernel/GaudiKernel/Parsers.h | 549 +--------------- GaudiKernel/GaudiKernel/ParsersFactory.h | 67 +- GaudiKernel/GaudiKernel/Property.h | 12 +- GaudiKernel/GaudiKernel/SVectorAsProperty.h | 2 +- GaudiKernel/GaudiKernel/StdArrayAsProperty.h | 2 +- GaudiKernel/src/Lib/DataObjID.cpp | 2 +- .../src/Lib/DataObjectHandleProperty.cpp | 2 +- GaudiKernel/src/Lib/ParsersCollections.cpp | 2 +- GaudiKernel/src/Lib/ParsersHistograms.cpp | 4 +- .../src/Lib/ParsersStandardListCommon.h | 4 +- .../src/Lib/ParsersStandardMiscCommon.h | 4 +- GaudiKernel/src/Lib/ParsersStandardSingle.cpp | 4 +- GaudiKernel/src/Lib/ParsersVct.cpp | 2 +- GaudiKernel/src/Lib/StringKey.cpp | 2 +- GaudiKernel/tests/src/parsers.cpp | 2 +- GaudiUtils/src/Lib/HistoParsers.cpp | 2 +- 27 files changed, 1261 insertions(+), 1258 deletions(-) create mode 100644 GaudiKernel/Gaudi/Parsers/CommonParsers.h create mode 100644 GaudiKernel/Gaudi/Parsers/Factory.h create mode 100644 GaudiKernel/Gaudi/Parsers/Grammars.h create mode 100644 GaudiKernel/Gaudi/Parsers/InputData.h diff --git a/GaudiCoreSvc/src/IncidentSvc/DODBasicMapper.cpp b/GaudiCoreSvc/src/IncidentSvc/DODBasicMapper.cpp index 74e3221f3c..49ce30b462 100644 --- a/GaudiCoreSvc/src/IncidentSvc/DODBasicMapper.cpp +++ b/GaudiCoreSvc/src/IncidentSvc/DODBasicMapper.cpp @@ -1,7 +1,7 @@ // Include files #include "GaudiKernel/HashMap.h" -#include "GaudiKernel/Parsers.h" +#include // Local implementation of parsers from HashMap namespace Gaudi { diff --git a/GaudiExamples/src/ExtendedProperties/ExtendedProperties.cpp b/GaudiExamples/src/ExtendedProperties/ExtendedProperties.cpp index 1e2cbfe61e..4586b96a20 100644 --- a/GaudiExamples/src/ExtendedProperties/ExtendedProperties.cpp +++ b/GaudiExamples/src/ExtendedProperties/ExtendedProperties.cpp @@ -15,8 +15,8 @@ // ============================================================================ // Include parsers for creating parser that handles tuple // ============================================================================ -#include "GaudiKernel/ParsersFactory.h" #include "GaudiKernel/StdArrayAsProperty.h" +#include // ============================================================================ // GaudiAlg diff --git a/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp b/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp index 4c839792d6..7c525037f1 100644 --- a/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp +++ b/GaudiExamples/src/Properties/CustomPropertiesAlg.cpp @@ -10,7 +10,7 @@ typedef std::unordered_map MyCustomType; // Define the parser -#include "GaudiKernel/ParsersFactory.h" +#include namespace Gaudi { @@ -21,7 +21,7 @@ namespace Gaudi template struct Grammar_ { // In this case, the type is a mapping type, so it requires the MapGrammar. - // For other grammars see GaudiKernel/GrammarsV2.h + // For other grammars see Gaudi/Parsers/Grammars.h typedef MapGrammar Grammar; }; diff --git a/GaudiGSL/src/Lib/Interpolation.cpp b/GaudiGSL/src/Lib/Interpolation.cpp index f342953465..5552dea082 100644 --- a/GaudiGSL/src/Lib/Interpolation.cpp +++ b/GaudiGSL/src/Lib/Interpolation.cpp @@ -1,5 +1,5 @@ #include "GaudiMath/Interpolation.h" -#include "GaudiKernel/ParsersFactory.h" +#include #include #include diff --git a/GaudiKernel/CMakeLists.txt b/GaudiKernel/CMakeLists.txt index 649aa4d04a..76b96533d8 100644 --- a/GaudiKernel/CMakeLists.txt +++ b/GaudiKernel/CMakeLists.txt @@ -61,7 +61,7 @@ endif() gaudi_add_library(GaudiKernel src/Lib/*.cpp ${extra_sources} LINK_LIBRARIES ${CMAKE_DL_LIBS} Boost ROOT TBB GaudiPluginService ${extra_libraries} INCLUDE_DIRS Boost ROOT TBB - PUBLIC_HEADERS GaudiKernel) + PUBLIC_HEADERS Gaudi GaudiKernel) #---Tests------------------------------------------------------------------- if( CPPUNIT_FOUND ) diff --git a/GaudiKernel/Gaudi/Parsers/CommonParsers.h b/GaudiKernel/Gaudi/Parsers/CommonParsers.h new file mode 100644 index 0000000000..b0f6f58492 --- /dev/null +++ b/GaudiKernel/Gaudi/Parsers/CommonParsers.h @@ -0,0 +1,541 @@ +#pragma once +// ============================================================================ +// Include files +// ============================================================================ +// STD & STL +// ============================================================================ +#include +#include +#include +#include +#include + +// ============================================================================ +#include "GaudiKernel/HistoDef.h" +#include "GaudiKernel/Map.h" +#include "GaudiKernel/StatusCode.h" +// ============================================================================ +#define PARSERS_DECL_FOR_SINGLE( Type ) GAUDI_API StatusCode parse( Type& result, const std::string& input ); + +#define PARSERS_DECL_FOR_PAIR( FirstType, SecondType ) \ + GAUDI_API StatusCode parse( std::pair& result, const std::string& input ); + +#define PARSERS_DECL_FOR_LIST( InnerType ) \ + GAUDI_API StatusCode parse( std::vector& result, const std::string& input ); +// ============================================================================ +/** @file + * The declaration of major parsing functions used e.g + * for (re)implementation of new extended properties see class Property + * These function also could be used in a different, much wider contex. + * all of them have the semantic: + * StatusCode parse ( TYPE& result , const std::string& input ) + * where input is the input string to be parsed, + * and result is the the result of parsing + * + * @code + * + * const std::string input = ... ; + * std::vector result ; + * + * // parse the input + * StatusCode sc = parse ( result , input ) ; + * if ( sc.isFailure() ) + * { + * // error here ... + * } + * std::cout << "vector size " << result.size() << std::endl ; + * + * @endcode + * + * @see Gaudi::Parsers::parse + * @see Property + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-12 + */ +// ============================================================================ +namespace Gaudi +{ + // ========================================================================== + class Histo1DDef; + // ========================================================================== + namespace Parsers + { + // ======================================================================== + /** parse the bool value + * @see Gaudi::Parsers::BoolGrammar + * @param result (output) boolean result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-12 + */ + PARSERS_DECL_FOR_SINGLE( bool ) + // ======================================================================== + /** parse the char value + * + * @see Gaudi::Parsers::CharGrammar + * @param result (output) boolean result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-12 + */ + PARSERS_DECL_FOR_SINGLE( char ) + /// @see Gaudi::Parsers::parser( char&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( unsigned char ) + /// @see Gaudi::Parsers::parser( char&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( signed char ) + // ======================================================================== + /** parse the int value + * + * @see Gaudi::Parsers::IntGrammar + * @param result (output) integer result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_SINGLE( int ) + /// @see Gaudi::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( short ) + /// @see Gaudi::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( unsigned short ) + /// @see Gaudi::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( unsigned int ) + /// @see Gaudi::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( long ) + /// @see Gaudi::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( unsigned long ) + /// @see Gaudi::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( long long ) + /// @see Gaudi::Parsers::parser( int&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( unsigned long long ) + // ======================================================================== + /** parse the double value + * + * @see Gaudi::Parsers::RealGrammar + * @param result (output) double result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_SINGLE( double ) + /// @see Gaudi::Parsers::parser( double&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( float ) + /// @see Gaudi::Parsers::parser( double&, const std::string& ) + PARSERS_DECL_FOR_SINGLE( long double ) + // ======================================================================== + /** parse the std::string value + * + * @see Gaudi::Parsers::StringGrammar + * @param result (output) string result + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_SINGLE( std::string ) + // ======================================================================== + + PARSERS_DECL_FOR_LIST( bool ) + PARSERS_DECL_FOR_LIST( char ) + PARSERS_DECL_FOR_LIST( unsigned char ) + PARSERS_DECL_FOR_LIST( signed char ) + + PARSERS_DECL_FOR_LIST( int ) + PARSERS_DECL_FOR_LIST( short ) + PARSERS_DECL_FOR_LIST( unsigned short ) + PARSERS_DECL_FOR_LIST( unsigned int ) + PARSERS_DECL_FOR_LIST( long ) + PARSERS_DECL_FOR_LIST( unsigned long ) + PARSERS_DECL_FOR_LIST( long long ) + PARSERS_DECL_FOR_LIST( unsigned long long ) + + PARSERS_DECL_FOR_LIST( double ) + PARSERS_DECL_FOR_LIST( float ) + PARSERS_DECL_FOR_LIST( long double ) + + PARSERS_DECL_FOR_LIST( std::string ) + // ======================================================================== + // Advanced parses + // ======================================================================== + /** parse the std::pair\ value + * + * @see Gaudi::Parsers::PairGrammar + * @see Gaudi::Parsers::RealGrammar + * @param result (output) pair of doubles + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_PAIR( double, double ) + // ======================================================================== + /** parse the std::pair\ value + * + * @see Gaudi::Parsers::PairGrammar + * @see Gaudi::Parsers::IntGrammar + * @param result (output) pair of integers + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + PARSERS_DECL_FOR_PAIR( int, int ) + // ======================================================================== + /** parse the std::vector\ \> value + * + * @see Gaudi::Parsers::VectorGrammar + * @see Gaudi::Parsers::PairGrammar + * @see Gaudi::Parsers::RealGrammar + * @param result (output) vector with pairs of doubles + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); + // ======================================================================== + /** parse the std::vector\ \> value + * + * @see Gaudi::Parsers::VectorGrammar + * @see Gaudi::Parsers::PairGrammar + * @see Gaudi::Parsers::IntGrammar + * @param result (output) vector with pairs of int + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); + // ======================================================================== + // vector< vector< TYPE > > + // ======================================================================== + /** parse the std::vector\ \> value + * + * @see Gaudi::Parsers::VectorGrammar + * @see Gaudi::Parsers::StringGrammar + * @param result (output) vector with vectors of strings + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); + // ======================================================================== + /** parse the std::vector\ \> value + * + * @see Gaudi::Parsers::VectorGrammar + * @see Gaudi::Parsers::RealGrammar + * @param result (output) vector with vectors of doubles + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); + // ======================================================================== + // map< TYPE, TYPE > + // ======================================================================== + /** parse the std::map\ value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::IntGrammar + * @param result (output) map with integer key and double value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::IntGrammar + * @see Gaudi::Parsers::RealGrammar + * @param result (output) map with integer key and double value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::StringGrammar + * @param result (output) map with string key and value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::StringGrammar + * @see Gaudi::Parsers::IntGrammar + * @param result (output) map with string key and integer value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::StringGrammar + * @see Gaudi::Parsers::RealGrammar + * @param result (output) map with string key and integer value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ \> + * value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::StringGrammar + * @see Gaudi::Parsers::VectorGrammar + * @param result (output) map with string value and + * vector of strings as value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map>& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ \> value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::StringGrammar + * @see Gaudi::Parsers::VectorGrammar + * @see Gaudi::Parsers::IntGrammar + * @param result (output) map with string value and + * vector of integers as value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map>& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ \> value + * + * @see Gaudi::Parsers::MapGrammar + * @see Gaudi::Parsers::StringGrammar + * @see Gaudi::Parsers::VectorGrammar + * @see Gaudi::Parsers::RealGrammar + * @param result (output) map with string value and + * vector of doubles as value + * @param input (input) the string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-14 + */ + GAUDI_API StatusCode parse( std::map>& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ \> objects + * + * @see Gaudi::Parsers::MapGrammar + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @date 2007-12-06 + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ \> objects + * + * @see Gaudi::Parsers::MapGrammar + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @date 2007-12-06 + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the std::map\ \> objects + * + * @see Gaudi::Parsers::MapGrammar + */ + GAUDI_API StatusCode parse( std::map& result, const std::string& input ); + // ======================================================================== + /** parse the GaudiUtils::Map\ objects + * + * @see Gaudi::Parsers::MapGrammar + */ + template + GAUDI_API StatusCode parse( GaudiUtils::Map& result, const std::string& input ) + { + return parse( (M&)result, input ); + } + // ======================================================================== + /** parse the pair expression (map-component) " 'name' :value" + * + * @code + * + * const std::string input = "'PackageName':GaudiKernel" ; + * std::string name ; + * std::string value ; + * StatusCode sc = Gaudi::Parsers::parse ( name , value , input ) ; + * if ( sc.isFailure() ) { ... } + * std::cout << "\tParsed name is " << name + * << "\tParsed value is " << value << std::endl + * @endcode + * + * @param name (output) the parsed name of the component, defined + * as 'name' or "name" before the column symbol ":", + * the leading and trailing blans are omitted + * @param value (output) the parsed value of the component, + * defined as everything after the column symbol ":" + * till the end of the string + * @param input (input) string to be parsed + * @return status code + * + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @date 2006-05-12 + */ + GAUDI_API StatusCode parse( std::string& name, std::string& value, const std::string& input ); + // ======================================================================== + /** helper function, needed for implementation of "Histogram Property" + * @param histo the histogram description (output) + * @param input the string to be parsed + * @return status code + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @date 2007-09-17 + */ + GAUDI_API StatusCode parse( Gaudi::Histo1DDef& histo, const std::string& input ); + // ======================================================================== + /** helper function, needed for implementation of "Histogram Property" + * @param histos the map of the histogram descriptions (output) + * @param input the string to be parsed + * @return status code + * @author Vanya BELYAEV ibelyaev@physics.syr.edu + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @date 2007-09-17 + */ + GAUDI_API StatusCode parse( std::map& histos, const std::string& input ); + // ======================================================================== + /** helper function, needed for implementation of map of pairs + * It is very useful construction for monitoring to + * represent the value and error or the allowed range for + * some parameter + * @param params the map of pair + * @param input the string to be parsed + * @return status code + * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl + * @author Alexander MAZUROV Alexander.Mazurov@gmail.com + * @date 2009-05-19 + */ + GAUDI_API StatusCode parse( std::map>& params, const std::string& input ); + // ======================================================================== + /** parser function for C-arrays + * @param params C-array + * @param input the string to be parsed + * @return status code + * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl + * @date 2009-09-15 + */ + template + StatusCode parse( T ( &result )[N], const std::string& input ) + { + typedef std::vector _Vct; + // create the temporary vector + _Vct tmp; + StatusCode sc = parse( tmp, input ); + if ( sc.isFailure() ) { + return sc; + } // RETURN + if ( N != tmp.size() ) { + return StatusCode::FAILURE; + } // RETURN + // + std::copy( tmp.begin(), tmp.end(), result ); + // + return StatusCode::SUCCESS; // RETURN + } + // ======================================================================== + /** parser function for C-strings + * @param params C-string + * @param input the string to be parsed + * @return status code + * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl + * @date 2009-09-15 + */ + template + StatusCode parse( char ( &result )[N], const std::string& input ) + { + // clear the string + std::fill_n( result, N, ' ' ); + // create the temporary string + std::string tmp; + StatusCode sc = parse( tmp, input ); + if ( sc.isFailure() ) { + return sc; + } // RETURN + if ( N == tmp.size() ) { + std::copy( tmp.begin(), tmp.end(), result ); + } else if ( N + 2 == tmp.size() && ( '\'' == tmp[0] || '\"' == tmp[0] ) && ( tmp[0] == tmp[tmp.size() - 1] ) ) { + std::copy( tmp.begin() + 1, tmp.end() - 1, result ); + } else { + return StatusCode::FAILURE; + } + // + return StatusCode::SUCCESS; // RETURN + } + // ======================================================================== + } // end of namespace Gaudi::Parsers + // ========================================================================== +} // end of namespace Gaudi diff --git a/GaudiKernel/Gaudi/Parsers/Factory.h b/GaudiKernel/Gaudi/Parsers/Factory.h new file mode 100644 index 0000000000..c86982937f --- /dev/null +++ b/GaudiKernel/Gaudi/Parsers/Factory.h @@ -0,0 +1,60 @@ +#pragma once +// ============================================================================ +// Include files +// ============================================================================ +// STD & STL +// ============================================================================ +#include +#include +#include +// ============================================================================ +// Boost: +// ============================================================================ +#include +#include +// ============================================================================ +// Gaudi +// ============================================================================ +#include +#include +// ============================================================================ +namespace Gaudi +{ + namespace Parsers + { + // ======================================================================== + typedef std::string::const_iterator IteratorT; + // typedef boost::spirit::ascii::space_type Skipper; + typedef SkipperGrammar Skipper; + // ======================================================================== + template + inline StatusCode parse_( ResultT& result, const std::string& input ) + { + Skipper skipper; + typename Grammar_::Grammar g; + IteratorT iter = input.begin(), end = input.end(); + return ( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ? StatusCode::SUCCESS + : StatusCode::FAILURE ); + } + //========================================================================= + template <> + inline StatusCode parse_( std::string& result, const std::string& input ) + { + Skipper skipper; + Grammar_::Grammar g; + IteratorT iter = input.begin(), end = input.end(); + if ( !( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ) ) { + result = input; + } + //@attention always + return StatusCode::SUCCESS; + } + //========================================================================= + template + inline StatusCode parse( ResultT& result, const std::string& input ) + { + return parse_( result, input ); + } + //========================================================================= + } /* Parsers */ +} /* Gaudi */ diff --git a/GaudiKernel/Gaudi/Parsers/Grammars.h b/GaudiKernel/Gaudi/Parsers/Grammars.h new file mode 100644 index 0000000000..c4c104c5f6 --- /dev/null +++ b/GaudiKernel/Gaudi/Parsers/Grammars.h @@ -0,0 +1,611 @@ +#pragma once + +#ifdef __GNUC__ +#pragma GCC system_header +#endif +// ============================================================================ +// Include files +// ============================================================================ +// STD: +//============================================================================== +#include +#include +#include +#include +#include +#include +#include +#include +//============================================================================== +// Boost: +//============================================================================== +#include +#include +#include + +#include +#include + +#include +#include + +#include +//============================================================================== +// Gaudi: +//============================================================================== +#include "GaudiKernel/HashMap.h" +#include "GaudiKernel/HistoDef.h" +#include "GaudiKernel/Point3DTypes.h" +#include "GaudiKernel/Point4DTypes.h" +#include "GaudiKernel/StringKey.h" +#include "GaudiKernel/VectorMap.h" +//============================================================================== +namespace Gaudi +{ + namespace Parsers + { + //============================================================================== + // Namespace aliases: + //============================================================================== + namespace sp = boost::spirit; + namespace ph = boost::phoenix; + namespace qi = sp::qi; + namespace enc = sp::ascii; + namespace rep = sp::repository; + //============================================================================== + // Grammars + //============================================================================== + typedef std::string::const_iterator DefaultIterator; + typedef enc::space_type DefaultSkipper; + //============================================================================== + template + struct Grammar_ { + /* READ THIS IF YOUR COMPILE BREAKS ON THE FOLLOWING LINE + * + * To users: You have to ask developers to implement parser for your type T + * To developer: You have to implement and register Grammar for type T + * + */ + BOOST_MPL_ASSERT_MSG( false, GRAMMAR_FOR_TYPE_DOES_NOT_EXISTS, ( T ) ); + }; + +#define REGISTER_GRAMMAR( ResultType, GrammarName ) \ + template \ + struct Grammar_ { \ + typedef GrammarName Grammar; \ + } + //============================================================================== + template + struct SkipperGrammar : qi::grammar { + SkipperGrammar() : SkipperGrammar::base_type( comments ) + { + comments = enc::space | rep::confix( "/*", "*/" )[*( qi::char_ - "*/" )] | + rep::confix( "//", ( sp::eol | sp::eoi ) )[*( qi::char_ - ( sp::eol | sp::eoi ) )]; + } + qi::rule comments; + }; + //============================================================================== + template + struct StringGrammar : qi::grammar, Skipper> { + //------------------------------------------------------------------------------ + typedef std::string ResultT; + //------------------------------------------------------------------------------ + StringGrammar() : StringGrammar::base_type( str ) + { + begin_quote = enc::char_( "\"'" ); + quote = enc::char_( qi::_r1 ); + + str = qi::lexeme[begin_quote[qi::_a = qi::_1] > + *( ( enc::char_( '\\' ) >> quote( qi::_a ) )[qi::_val += qi::_a] | + ( enc::char_[qi::_val += qi::_1] - quote( qi::_a ) ) ) > quote( qi::_a )]; + } + //------------------------------------------------------------------------------ + qi::rule, Skipper> str; + qi::rule begin_quote; + qi::rule quote; + //------------------------------------------------------------------------------ + }; + REGISTER_GRAMMAR( std::string, StringGrammar ); + REGISTER_GRAMMAR( Gaudi::StringKey, StringGrammar ); + //============================================================================== + template + struct CharGrammar : qi::grammar { + typedef char ResultT; + CharGrammar() : CharGrammar::base_type( ch ) + { + ch = qi::int_parser() | '\'' >> ( qi::char_ - '\'' ) >> '\''; + } + qi::rule ch; + }; + REGISTER_GRAMMAR( char, CharGrammar ); + //============================================================================== + template + struct BoolGrammar : qi::grammar { + typedef bool ResultT; + BoolGrammar() : BoolGrammar::base_type( boolean_literal ) + { + boolean_literal = ( qi::lit( "true" ) | "True" | "TRUE" | "1" )[qi::_val = true] | + ( qi::lit( "false" ) | "False" | "FALSE" | "0" )[qi::_val = false]; + } + qi::rule boolean_literal; + }; + REGISTER_GRAMMAR( bool, BoolGrammar ); + //============================================================================== + template + struct IntGrammar : qi::grammar { + typedef RT ResultT; + IntGrammar() : IntGrammar::base_type( integer ) + { + integer = qi::int_parser()[qi::_val = qi::_1] >> -qi::no_case[qi::char_( 'L' )]; + } + qi::rule integer; + }; + // ---------------------------------------------------------------------------- + // Register IntGrammar: + // ---------------------------------------------------------------------------- + template + struct Grammar_>::type> { + typedef IntGrammar Grammar; + }; + //============================================================================== + template + struct RealGrammar : qi::grammar { + typedef RT ResultT; + RealGrammar() : RealGrammar::base_type( real ) { real = qi::real_parser(); } + qi::rule real; + }; + // ---------------------------------------------------------------------------- + // Register RealGrammar: + // ---------------------------------------------------------------------------- + template + struct Grammar_>::type> { + typedef RealGrammar Grammar; + }; + //============================================================================== + // Grammar for std::tuples + //============================================================================== + template + struct tuple_remove_first_type { + }; + + template + struct tuple_get_first_type { + }; + + template + struct tuple_remove_first_type> { + typedef std::tuple type; + }; + + template + struct tuple_get_first_type> { + typedef T type; + }; + + // ---------------------------------------------------------------------------- + + template + struct TupleInnerGrammar + : qi::grammar::type>, Skipper> { + //--------------------------------------------------------------------------- + typedef TupleT ResultT; + typedef typename tuple_remove_first_type::type TailT; + typedef typename tuple_get_first_type::type HeadT; + //--------------------------------------------------------------------------- + struct Operations { + //---------------------------------------------------------------------- + + void operator()( ResultT& res, HeadT& head, TailT& tail ) const + { + res = std::tuple_cat( std::tuple( head ), tail ); + } + //---------------------------------------------------------------------- + }; + //--------------------------------------------------------------------------- + TupleInnerGrammar() : TupleInnerGrammar::base_type( tup ) + { + tup = grHead[qi::_a = qi::_1] >> ',' >> grLast[op( qi::_val, qi::_a, qi::_1 )]; + } + + TupleInnerGrammar grLast; + typename Grammar_::Grammar grHead; + + qi::rule, Skipper> tup; + ph::function op; + }; + + template + struct TupleInnerGrammar : qi::grammar { + //--------------------------------------------------------------------------- + typedef TupleT ResultT; + // typedef typename ResultT::value_type Tuple1T; + //--------------------------------------------------------------------------- + struct Operations { + //--------------------------------------------------------------------- + void operator()( ResultT& res, const typename std::tuple_element<0, ResultT>::type& val ) const + { + res = ResultT(); + std::get<0>( res ) = val; + } + //---------------------------------------------------------------------- + }; + //--------------------------------------------------------------------------- + TupleInnerGrammar() : TupleInnerGrammar::base_type( tup ) { tup = grFirst[op( qi::_val, qi::_1 )]; } + + typename Grammar_::type, Skipper>::Grammar grFirst; + + qi::rule tup; + ph::function op; + }; + + // ---------------------------------------------------------------------------- + template + struct TupleGrammar : qi::grammar, Skipper> { + typedef TupleT ResultT; + TupleGrammar() : TupleGrammar::base_type( tup ) + { + begin = enc::char_( '[' )[qi::_val = ']'] | enc::char_( '(' )[qi::_val = ')']; + end = enc::char_( qi::_r1 ); + + tup = begin[qi::_a = qi::_1] >> grTuple[qi::_val = qi::_1] >> end( qi::_a ); + } + + qi::rule begin; + qi::rule end; + qi::rule, Skipper> tup; + TupleInnerGrammar grTuple; + }; + + // ----------------------------------------------------------------------------- + // Register TupleGrammar for std::tuple: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef TupleGrammar, sizeof...( Args ), Skipper> Grammar; + }; + //============================================================================== + template + struct VectorGrammar : qi::grammar, Skipper> { + //------------------------------------------------------------------------------ + typedef VectorT ResultT; + //------------------------------------------------------------------------------ + VectorGrammar() : VectorGrammar::base_type( vec ) + { + begin = + enc::char_( '[' )[qi::_val = ']'] | enc::char_( '{' )[qi::_val = '}'] | enc::char_( '(' )[qi::_val = ')']; + end = enc::char_( qi::_r1 ); + list = elementGrammar % ','; + vec = begin[qi::_a = qi::_1] >> -list[qi::_val = qi::_1] >> end( qi::_a ); + } + // ---------------------------------------------------------------------------- + typename Grammar_::Grammar elementGrammar; + qi::rule begin; + qi::rule end; + + qi::rule, Skipper> vec; + qi::rule list; + // ---------------------------------------------------------------------------- + }; + // ---------------------------------------------------------------------------- + // Register VectorGrammar for std::vector: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef VectorGrammar, Skipper> Grammar; + }; + // ---------------------------------------------------------------------------- + // Register VectorGrammar for std::list: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef VectorGrammar, Skipper> Grammar; + }; + // ---------------------------------------------------------------------------- + // Register VectorGrammar for std::set: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef VectorGrammar, Skipper> Grammar; + }; + // ---------------------------------------------------------------------------- + // Register VectorGrammar for std::unordered_set: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef VectorGrammar, Skipper> Grammar; + }; + + //============================================================================== + template + struct PairGrammar : qi::grammar, Skipper> { + //------------------------------------------------------------------------------ + typedef PairT ResultT; + typedef typename PairT::first_type first_type; + typedef typename PairT::second_type second_type; + //------------------------------------------------------------------------------ + struct first { + }; + struct second { + }; + //------------------------------------------------------------------------------ + PairGrammar() : PairGrammar( "," ) {} + PairGrammar( const std::string& delimeter ) : PairGrammar::base_type( pair ) + { + begin = enc::char_( '(' )[qi::_val = ')'] | enc::char_( '[' )[qi::_val = ']']; + end = qi::char_( qi::_r1 ); + pair = begin[qi::_a = qi::_1] >> pair_in[qi::_val = qi::_1] >> end( qi::_a ); + pair_in = key >> qi::lit( delimeter ) >> value; + } + // ---------------------------------------------------------------------------- + typename Grammar_::Grammar key; + typename Grammar_::Grammar value; + qi::rule begin; + qi::rule end; + qi::rule, Skipper> pair; + qi::rule pair_in; + // ph::function op; + // ---------------------------------------------------------------------------- + }; // END PairGrammar + // ---------------------------------------------------------------------------- + // Register PairGrammar: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef PairGrammar, Skipper> Grammar; + }; + // ============================================================================ + template + struct MapGrammar : qi::grammar { + //------------------------------------------------------------------------------ + typedef MapT ResultT; + typedef typename MapT::key_type KeyT; + typedef typename MapT::mapped_type MappedT; + typedef std::pair PairT; + + typedef std::vector VectorPairT; + //------------------------------------------------------------------------------ + struct tag_key { + }; + struct tag_mapped { + }; + struct Operations { + //---------------------------------------------------------------------- + void operator()( ResultT& res, const VectorPairT& vec ) const + { + for ( auto cur = vec.begin(); cur != vec.end(); ++cur ) { + res.insert( *cur ); + } + } + void operator()( PairT& res, const KeyT& key, tag_key ) const { res.first = key; } + void operator()( PairT& res, const MappedT& value, tag_mapped ) const { res.second = value; } + //---------------------------------------------------------------------- + }; + //------------------------------------------------------------------------------ + MapGrammar() : MapGrammar::base_type( map ) + { + pair = key[op( qi::_val, qi::_1, tag_key() )] > ( qi::lit( ':' ) | '=' ) > + value[op( qi::_val, qi::_1, tag_mapped() )]; + list = -( pair % enc::char_( ',' ) ); + map = ( ( '[' >> list >> ']' ) | ( '{' >> list >> '}' ) )[op( qi::_val, qi::_1 )]; + } + // ---------------------------------------------------------------------------- + typename Grammar_::Grammar key; + typename Grammar_::Grammar value; + qi::rule pair; + qi::rule list; + qi::rule map; + ph::function op; + // ---------------------------------------------------------------------------- + }; + // ---------------------------------------------------------------------------- + // Register MapGrammar for std::map: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef MapGrammar, Skipper> Grammar; + }; + // ---------------------------------------------------------------------------- + // Register MapGrammar for std::unordered_map: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef MapGrammar, Skipper> Grammar; + }; + // ---------------------------------------------------------------------------- + // Register MapGrammar for GaudiUtils::VectorMap: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef MapGrammar, Skipper> Grammar; + }; + // ============================================================================ + template + struct Pnt3DGrammar : qi::grammar { + typedef PointT ResultT; + typedef typename PointT::Scalar Scalar; + // ---------------------------------------------------------------------------- + struct Operations { + void operator()( ResultT& res, const Scalar& scalar, const char xyz ) const + { + switch ( xyz ) { + case 'x': + res.SetX( scalar ); + break; + case 'y': + res.SetY( scalar ); + break; + case 'z': + res.SetZ( scalar ); + break; + default: + break; + } + } + }; // Operations + // ---------------------------------------------------------------------------- + Pnt3DGrammar() : Pnt3DGrammar::base_type( point ) + { + point = list | ( '(' >> list >> ')' ) | ( '[' >> list >> ']' ); + list = -( enc::no_case[qi::lit( "x" ) | qi::lit( "px" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'x' )] >> + ',' >> -( enc::no_case[qi::lit( "y" ) | qi::lit( "py" )] >> ':' ) >> + scalar[op( qi::_val, qi::_1, 'y' )] >> ',' >> + -( enc::no_case[qi::lit( "z" ) | qi::lit( "pz" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'z' )]; + } + // ---------------------------------------------------------------------------- + qi::rule point, list; + typename Grammar_::Grammar scalar; + ph::function op; + // ---------------------------------------------------------------------------- + }; // Pnt3DGrammar + // ---------------------------------------------------------------------------- + // Register Pnt3DGrammar for ROOT::Math::PositionVector3D: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef Pnt3DGrammar, Skipper> Grammar; + }; + // ---------------------------------------------------------------------------- + // Register Pnt3DGrammar for ROOT::Math::DisplacementVector3D: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef Pnt3DGrammar, Skipper> Grammar; + }; + // ============================================================================ + template + struct Pnt4DGrammar : qi::grammar { + typedef PointT ResultT; + typedef typename PointT::Scalar ScalarT; + //----------------------------------------------------------------------------- + struct Operations { + + void operator()( ResultT& res, const ScalarT& scalar, const char xyz ) const + { + switch ( xyz ) { + case 'x': + res.SetPx( scalar ); + break; + case 'y': + res.SetPy( scalar ); + break; + case 'z': + res.SetPz( scalar ); + break; + case 'e': + res.SetE( scalar ); + break; + default: + break; + } + } + void operator()( ResultT& res, const ResultT& xyz ) const + { + res.SetPx( xyz.Px() ); + res.SetPy( xyz.Py() ); + res.SetPz( xyz.Pz() ); + } + }; // Operations + // ---------------------------------------------------------------------------- + Pnt4DGrammar() : Pnt4DGrammar::base_type( point4d ) + { + point4d = list4d | ( '(' >> list4d >> ')' ) | ( '[' >> list4d >> ']' ); + list4d = ( point3d[op( qi::_val, qi::_1 )] >> enc::char_( ";," ) >> e[op( qi::_val, qi::_1, 'e' )] ) | + ( e[op( qi::_val, qi::_1, 'e' )] >> enc::char_( ";," ) >> point3d[op( qi::_val, qi::_1 )] ); + e = -( enc::no_case[enc::char_( "te" )] >> ':' ) >> scalar[qi::_val = qi::_1]; + + point3d = list3d | ( '(' >> list3d >> ')' ) | ( '[' >> list3d >> ']' ); + list3d = -( enc::no_case[qi::lit( "x" ) | qi::lit( "px" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'x' )] >> + ',' >> -( enc::no_case[qi::lit( "y" ) | qi::lit( "py" )] >> ':' ) >> + scalar[op( qi::_val, qi::_1, 'y' )] >> ',' >> + -( enc::no_case[qi::lit( "z" ) | qi::lit( "pz" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'z' )]; + } + // ---------------------------------------------------------------------------- + qi::rule point3d, point4d, list3d, list4d; + qi::rule e; + typename Grammar_::Grammar scalar; + ph::function op; + // ---------------------------------------------------------------------------- + }; // Pnt4DGrammar + // ---------------------------------------------------------------------------- + // Register Pnt4DGrammar for ROOT::Math::LorentzVector: + // ---------------------------------------------------------------------------- + template + struct Grammar_, Skipper> { + typedef Pnt4DGrammar, Skipper> Grammar; + }; + // ============================================================================ + template + struct Histo1DGrammar : qi::grammar, Skipper> { + typedef Gaudi::Histo1DDef ResultT; + // ---------------------------------------------------------------------------- + struct Operations { + void operator()( ResultT& res, const std::string& title ) const { res.setTitle( title ); } + void operator()( ResultT& res, const double& val, const char lh ) const + { + switch ( lh ) { + case 'l': + res.setLowEdge( val ); + break; + case 'h': + res.setHighEdge( val ); + break; + default: + break; + } + } + void operator()( ResultT& res, int val ) const { res.setBins( val ); } + void operator()( ResultT& res ) const {} + }; // Operations + // ---------------------------------------------------------------------------- + Histo1DGrammar() : Histo1DGrammar::base_type( hist ) + { + val1 = title[op( qi::_val, qi::_1 )] >> ',' >> qi::double_[op( qi::_val, qi::_1, 'l' )] >> ',' >> + qi::double_[op( qi::_val, qi::_1, 'h' )] >> -( ',' >> qi::int_[op( qi::_val, qi::_1 )] ); + val2 = qi::double_[op( qi::_val, qi::_1, 'l' )] >> ',' >> qi::double_[op( qi::_val, qi::_1, 'h' )] >> ',' >> + title[op( qi::_val, qi::_1 )] >> -( ',' >> qi::int_[op( qi::_val, qi::_1 )] ); + val3 = qi::double_[op( qi::_val, qi::_1, 'l' )] >> ',' >> qi::double_[op( qi::_val, qi::_1, 'h' )] >> + -( ',' >> title[op( qi::_val, qi::_1 )] ) >> -( ',' >> qi::int_[op( qi::_val, qi::_1 )] ); + begin = enc::char_( '[' )[qi::_val = ']'] | enc::char_( '(' )[qi::_val = ')']; + end = enc::char_( qi::_r1 ); + hist = begin[qi::_a = qi::_1] >> ( val1 | val2 | val3 )[qi::_val = qi::_1] >> end( qi::_a ); + } + // ---------------------------------------------------------------------------- + qi::rule, Skipper> hist; + qi::rule val1, val2, val3; + qi::rule begin; + qi::rule end; + StringGrammar title; + ph::function op; + // ---------------------------------------------------------------------------- + }; // Histo1DGrammar + // ---------------------------------------------------------------------------- + REGISTER_GRAMMAR( Gaudi::Histo1DDef, Histo1DGrammar ); + // ============================================================================ + template + struct KeyValueGrammar : qi::grammar(), Skipper> { + //------------------------------------------------------------------------------ + typedef std::pair ResultT; + //------------------------------------------------------------------------------ + struct first { + }; + struct second { + }; + + KeyValueGrammar() : KeyValueGrammar::base_type( pair ) + { + //------------------------------------------------------------------------------ + pair = gstring >> ":" >> +enc::char_; + } + // ---------------------------------------------------------------------------- + StringGrammar gstring; + qi::rule pair; + // ---------------------------------------------------------------------------- + }; // END KeyValueGrammar + // We don't register KeyalueGrammar because it's a special parser + // ============================================================================ + } +} // Gaudi::Parsers diff --git a/GaudiKernel/Gaudi/Parsers/InputData.h b/GaudiKernel/Gaudi/Parsers/InputData.h new file mode 100644 index 0000000000..08816fc164 --- /dev/null +++ b/GaudiKernel/Gaudi/Parsers/InputData.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace Gaudi +{ + namespace Parsers + { + /// Helper class to enable ADL for parsers + struct InputData : std::string { + InputData( const std::string& s ) : std::string{s} {} + using std::string::string; + using std::string::operator=; + }; + } +} diff --git a/GaudiKernel/GaudiKernel/BoostArrayAsProperty.h b/GaudiKernel/GaudiKernel/BoostArrayAsProperty.h index 873d19446c..6a2f02a3cf 100644 --- a/GaudiKernel/GaudiKernel/BoostArrayAsProperty.h +++ b/GaudiKernel/GaudiKernel/BoostArrayAsProperty.h @@ -59,7 +59,7 @@ namespace Gaudi // ============================================================================ // GaudiKernel // ============================================================================ -#include "GaudiKernel/Parsers.h" +#include // ============================================================================ namespace Gaudi { diff --git a/GaudiKernel/GaudiKernel/GrammarsV2.h b/GaudiKernel/GaudiKernel/GrammarsV2.h index f93594b0e4..c6eaa02b4e 100644 --- a/GaudiKernel/GaudiKernel/GrammarsV2.h +++ b/GaudiKernel/GaudiKernel/GrammarsV2.h @@ -1,614 +1,3 @@ -// ============================================================================ -#ifndef GAUDIKERNEL_GRAMMARSV2_H -#define GAUDIKERNEL_GRAMMARSV2_H 1 -#ifdef __GNUC__ -#pragma GCC system_header -#endif -// ============================================================================ -// Include files -// ============================================================================ -// STD: -//============================================================================== -#include -#include -#include -#include -#include -#include -#include -#include -//============================================================================== -// Boost: -//============================================================================== -#include -#include -#include +#pragma once -#include -#include - -#include -#include - -#include -//============================================================================== -// Gaudi: -//============================================================================== -#include "GaudiKernel/HashMap.h" -#include "GaudiKernel/HistoDef.h" -#include "GaudiKernel/Point3DTypes.h" -#include "GaudiKernel/Point4DTypes.h" -#include "GaudiKernel/StringKey.h" -#include "GaudiKernel/VectorMap.h" -//============================================================================== -namespace Gaudi -{ - namespace Parsers - { - //============================================================================== - // Namespace aliases: - //============================================================================== - namespace sp = boost::spirit; - namespace ph = boost::phoenix; - namespace qi = sp::qi; - namespace enc = sp::ascii; - namespace rep = sp::repository; - //============================================================================== - // Grammars - //============================================================================== - typedef std::string::const_iterator DefaultIterator; - typedef enc::space_type DefaultSkipper; - //============================================================================== - template - struct Grammar_ { - /* READ THIS IF YOUR COMPILE BREAKS ON THE FOLLOWING LINE - * - * To users: You have to ask developers to implement parser for your type T - * To developer: You have to implement and register Grammar for type T - * - */ - BOOST_MPL_ASSERT_MSG( false, GRAMMAR_FOR_TYPE_DOES_NOT_EXISTS, ( T ) ); - }; - -#define REGISTER_GRAMMAR( ResultType, GrammarName ) \ - template \ - struct Grammar_ { \ - typedef GrammarName Grammar; \ - } - //============================================================================== - template - struct SkipperGrammar : qi::grammar { - SkipperGrammar() : SkipperGrammar::base_type( comments ) - { - comments = enc::space | rep::confix( "/*", "*/" )[*( qi::char_ - "*/" )] | - rep::confix( "//", ( sp::eol | sp::eoi ) )[*( qi::char_ - ( sp::eol | sp::eoi ) )]; - } - qi::rule comments; - }; - //============================================================================== - template - struct StringGrammar : qi::grammar, Skipper> { - //------------------------------------------------------------------------------ - typedef std::string ResultT; - //------------------------------------------------------------------------------ - StringGrammar() : StringGrammar::base_type( str ) - { - begin_quote = enc::char_( "\"'" ); - quote = enc::char_( qi::_r1 ); - - str = qi::lexeme[begin_quote[qi::_a = qi::_1] > - *( ( enc::char_( '\\' ) >> quote( qi::_a ) )[qi::_val += qi::_a] | - ( enc::char_[qi::_val += qi::_1] - quote( qi::_a ) ) ) > quote( qi::_a )]; - } - //------------------------------------------------------------------------------ - qi::rule, Skipper> str; - qi::rule begin_quote; - qi::rule quote; - //------------------------------------------------------------------------------ - }; - REGISTER_GRAMMAR( std::string, StringGrammar ); - REGISTER_GRAMMAR( Gaudi::StringKey, StringGrammar ); - //============================================================================== - template - struct CharGrammar : qi::grammar { - typedef char ResultT; - CharGrammar() : CharGrammar::base_type( ch ) - { - ch = qi::int_parser() | '\'' >> ( qi::char_ - '\'' ) >> '\''; - } - qi::rule ch; - }; - REGISTER_GRAMMAR( char, CharGrammar ); - //============================================================================== - template - struct BoolGrammar : qi::grammar { - typedef bool ResultT; - BoolGrammar() : BoolGrammar::base_type( boolean_literal ) - { - boolean_literal = ( qi::lit( "true" ) | "True" | "TRUE" | "1" )[qi::_val = true] | - ( qi::lit( "false" ) | "False" | "FALSE" | "0" )[qi::_val = false]; - } - qi::rule boolean_literal; - }; - REGISTER_GRAMMAR( bool, BoolGrammar ); - //============================================================================== - template - struct IntGrammar : qi::grammar { - typedef RT ResultT; - IntGrammar() : IntGrammar::base_type( integer ) - { - integer = qi::int_parser()[qi::_val = qi::_1] >> -qi::no_case[qi::char_( 'L' )]; - } - qi::rule integer; - }; - // ---------------------------------------------------------------------------- - // Register IntGrammar: - // ---------------------------------------------------------------------------- - template - struct Grammar_>::type> { - typedef IntGrammar Grammar; - }; - //============================================================================== - template - struct RealGrammar : qi::grammar { - typedef RT ResultT; - RealGrammar() : RealGrammar::base_type( real ) { real = qi::real_parser(); } - qi::rule real; - }; - // ---------------------------------------------------------------------------- - // Register RealGrammar: - // ---------------------------------------------------------------------------- - template - struct Grammar_>::type> { - typedef RealGrammar Grammar; - }; - //============================================================================== - // Grammar for std::tuples - //============================================================================== - template - struct tuple_remove_first_type { - }; - - template - struct tuple_get_first_type { - }; - - template - struct tuple_remove_first_type> { - typedef std::tuple type; - }; - - template - struct tuple_get_first_type> { - typedef T type; - }; - - // ---------------------------------------------------------------------------- - - template - struct TupleInnerGrammar - : qi::grammar::type>, Skipper> { - //--------------------------------------------------------------------------- - typedef TupleT ResultT; - typedef typename tuple_remove_first_type::type TailT; - typedef typename tuple_get_first_type::type HeadT; - //--------------------------------------------------------------------------- - struct Operations { - //---------------------------------------------------------------------- - - void operator()( ResultT& res, HeadT& head, TailT& tail ) const - { - res = std::tuple_cat( std::tuple( head ), tail ); - } - //---------------------------------------------------------------------- - }; - //--------------------------------------------------------------------------- - TupleInnerGrammar() : TupleInnerGrammar::base_type( tup ) - { - tup = grHead[qi::_a = qi::_1] >> ',' >> grLast[op( qi::_val, qi::_a, qi::_1 )]; - } - - TupleInnerGrammar grLast; - typename Grammar_::Grammar grHead; - - qi::rule, Skipper> tup; - ph::function op; - }; - - template - struct TupleInnerGrammar : qi::grammar { - //--------------------------------------------------------------------------- - typedef TupleT ResultT; - // typedef typename ResultT::value_type Tuple1T; - //--------------------------------------------------------------------------- - struct Operations { - //--------------------------------------------------------------------- - void operator()( ResultT& res, const typename std::tuple_element<0, ResultT>::type& val ) const - { - res = ResultT(); - std::get<0>( res ) = val; - } - //---------------------------------------------------------------------- - }; - //--------------------------------------------------------------------------- - TupleInnerGrammar() : TupleInnerGrammar::base_type( tup ) { tup = grFirst[op( qi::_val, qi::_1 )]; } - - typename Grammar_::type, Skipper>::Grammar grFirst; - - qi::rule tup; - ph::function op; - }; - - // ---------------------------------------------------------------------------- - template - struct TupleGrammar : qi::grammar, Skipper> { - typedef TupleT ResultT; - TupleGrammar() : TupleGrammar::base_type( tup ) - { - begin = enc::char_( '[' )[qi::_val = ']'] | enc::char_( '(' )[qi::_val = ')']; - end = enc::char_( qi::_r1 ); - - tup = begin[qi::_a = qi::_1] >> grTuple[qi::_val = qi::_1] >> end( qi::_a ); - } - - qi::rule begin; - qi::rule end; - qi::rule, Skipper> tup; - TupleInnerGrammar grTuple; - }; - - // ----------------------------------------------------------------------------- - // Register TupleGrammar for std::tuple: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef TupleGrammar, sizeof...( Args ), Skipper> Grammar; - }; - //============================================================================== - template - struct VectorGrammar : qi::grammar, Skipper> { - //------------------------------------------------------------------------------ - typedef VectorT ResultT; - //------------------------------------------------------------------------------ - VectorGrammar() : VectorGrammar::base_type( vec ) - { - begin = - enc::char_( '[' )[qi::_val = ']'] | enc::char_( '{' )[qi::_val = '}'] | enc::char_( '(' )[qi::_val = ')']; - end = enc::char_( qi::_r1 ); - list = elementGrammar % ','; - vec = begin[qi::_a = qi::_1] >> -list[qi::_val = qi::_1] >> end( qi::_a ); - } - // ---------------------------------------------------------------------------- - typename Grammar_::Grammar elementGrammar; - qi::rule begin; - qi::rule end; - - qi::rule, Skipper> vec; - qi::rule list; - // ---------------------------------------------------------------------------- - }; - // ---------------------------------------------------------------------------- - // Register VectorGrammar for std::vector: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef VectorGrammar, Skipper> Grammar; - }; - // ---------------------------------------------------------------------------- - // Register VectorGrammar for std::list: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef VectorGrammar, Skipper> Grammar; - }; - // ---------------------------------------------------------------------------- - // Register VectorGrammar for std::set: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef VectorGrammar, Skipper> Grammar; - }; - // ---------------------------------------------------------------------------- - // Register VectorGrammar for std::unordered_set: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef VectorGrammar, Skipper> Grammar; - }; - - //============================================================================== - template - struct PairGrammar : qi::grammar, Skipper> { - //------------------------------------------------------------------------------ - typedef PairT ResultT; - typedef typename PairT::first_type first_type; - typedef typename PairT::second_type second_type; - //------------------------------------------------------------------------------ - struct first { - }; - struct second { - }; - //------------------------------------------------------------------------------ - PairGrammar() : PairGrammar( "," ) {} - PairGrammar( const std::string& delimeter ) : PairGrammar::base_type( pair ) - { - begin = enc::char_( '(' )[qi::_val = ')'] | enc::char_( '[' )[qi::_val = ']']; - end = qi::char_( qi::_r1 ); - pair = begin[qi::_a = qi::_1] >> pair_in[qi::_val = qi::_1] >> end( qi::_a ); - pair_in = key >> qi::lit( delimeter ) >> value; - } - // ---------------------------------------------------------------------------- - typename Grammar_::Grammar key; - typename Grammar_::Grammar value; - qi::rule begin; - qi::rule end; - qi::rule, Skipper> pair; - qi::rule pair_in; - // ph::function op; - // ---------------------------------------------------------------------------- - }; // END PairGrammar - // ---------------------------------------------------------------------------- - // Register PairGrammar: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef PairGrammar, Skipper> Grammar; - }; - // ============================================================================ - template - struct MapGrammar : qi::grammar { - //------------------------------------------------------------------------------ - typedef MapT ResultT; - typedef typename MapT::key_type KeyT; - typedef typename MapT::mapped_type MappedT; - typedef std::pair PairT; - - typedef std::vector VectorPairT; - //------------------------------------------------------------------------------ - struct tag_key { - }; - struct tag_mapped { - }; - struct Operations { - //---------------------------------------------------------------------- - void operator()( ResultT& res, const VectorPairT& vec ) const - { - for ( auto cur = vec.begin(); cur != vec.end(); ++cur ) { - res.insert( *cur ); - } - } - void operator()( PairT& res, const KeyT& key, tag_key ) const { res.first = key; } - void operator()( PairT& res, const MappedT& value, tag_mapped ) const { res.second = value; } - //---------------------------------------------------------------------- - }; - //------------------------------------------------------------------------------ - MapGrammar() : MapGrammar::base_type( map ) - { - pair = key[op( qi::_val, qi::_1, tag_key() )] > ( qi::lit( ':' ) | '=' ) > - value[op( qi::_val, qi::_1, tag_mapped() )]; - list = -( pair % enc::char_( ',' ) ); - map = ( ( '[' >> list >> ']' ) | ( '{' >> list >> '}' ) )[op( qi::_val, qi::_1 )]; - } - // ---------------------------------------------------------------------------- - typename Grammar_::Grammar key; - typename Grammar_::Grammar value; - qi::rule pair; - qi::rule list; - qi::rule map; - ph::function op; - // ---------------------------------------------------------------------------- - }; - // ---------------------------------------------------------------------------- - // Register MapGrammar for std::map: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef MapGrammar, Skipper> Grammar; - }; - // ---------------------------------------------------------------------------- - // Register MapGrammar for std::unordered_map: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef MapGrammar, Skipper> Grammar; - }; - // ---------------------------------------------------------------------------- - // Register MapGrammar for GaudiUtils::VectorMap: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef MapGrammar, Skipper> Grammar; - }; - // ============================================================================ - template - struct Pnt3DGrammar : qi::grammar { - typedef PointT ResultT; - typedef typename PointT::Scalar Scalar; - // ---------------------------------------------------------------------------- - struct Operations { - void operator()( ResultT& res, const Scalar& scalar, const char xyz ) const - { - switch ( xyz ) { - case 'x': - res.SetX( scalar ); - break; - case 'y': - res.SetY( scalar ); - break; - case 'z': - res.SetZ( scalar ); - break; - default: - break; - } - } - }; // Operations - // ---------------------------------------------------------------------------- - Pnt3DGrammar() : Pnt3DGrammar::base_type( point ) - { - point = list | ( '(' >> list >> ')' ) | ( '[' >> list >> ']' ); - list = -( enc::no_case[qi::lit( "x" ) | qi::lit( "px" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'x' )] >> - ',' >> -( enc::no_case[qi::lit( "y" ) | qi::lit( "py" )] >> ':' ) >> - scalar[op( qi::_val, qi::_1, 'y' )] >> ',' >> - -( enc::no_case[qi::lit( "z" ) | qi::lit( "pz" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'z' )]; - } - // ---------------------------------------------------------------------------- - qi::rule point, list; - typename Grammar_::Grammar scalar; - ph::function op; - // ---------------------------------------------------------------------------- - }; // Pnt3DGrammar - // ---------------------------------------------------------------------------- - // Register Pnt3DGrammar for ROOT::Math::PositionVector3D: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef Pnt3DGrammar, Skipper> Grammar; - }; - // ---------------------------------------------------------------------------- - // Register Pnt3DGrammar for ROOT::Math::DisplacementVector3D: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef Pnt3DGrammar, Skipper> Grammar; - }; - // ============================================================================ - template - struct Pnt4DGrammar : qi::grammar { - typedef PointT ResultT; - typedef typename PointT::Scalar ScalarT; - //----------------------------------------------------------------------------- - struct Operations { - - void operator()( ResultT& res, const ScalarT& scalar, const char xyz ) const - { - switch ( xyz ) { - case 'x': - res.SetPx( scalar ); - break; - case 'y': - res.SetPy( scalar ); - break; - case 'z': - res.SetPz( scalar ); - break; - case 'e': - res.SetE( scalar ); - break; - default: - break; - } - } - void operator()( ResultT& res, const ResultT& xyz ) const - { - res.SetPx( xyz.Px() ); - res.SetPy( xyz.Py() ); - res.SetPz( xyz.Pz() ); - } - }; // Operations - // ---------------------------------------------------------------------------- - Pnt4DGrammar() : Pnt4DGrammar::base_type( point4d ) - { - point4d = list4d | ( '(' >> list4d >> ')' ) | ( '[' >> list4d >> ']' ); - list4d = ( point3d[op( qi::_val, qi::_1 )] >> enc::char_( ";," ) >> e[op( qi::_val, qi::_1, 'e' )] ) | - ( e[op( qi::_val, qi::_1, 'e' )] >> enc::char_( ";," ) >> point3d[op( qi::_val, qi::_1 )] ); - e = -( enc::no_case[enc::char_( "te" )] >> ':' ) >> scalar[qi::_val = qi::_1]; - - point3d = list3d | ( '(' >> list3d >> ')' ) | ( '[' >> list3d >> ']' ); - list3d = -( enc::no_case[qi::lit( "x" ) | qi::lit( "px" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'x' )] >> - ',' >> -( enc::no_case[qi::lit( "y" ) | qi::lit( "py" )] >> ':' ) >> - scalar[op( qi::_val, qi::_1, 'y' )] >> ',' >> - -( enc::no_case[qi::lit( "z" ) | qi::lit( "pz" )] >> ':' ) >> scalar[op( qi::_val, qi::_1, 'z' )]; - } - // ---------------------------------------------------------------------------- - qi::rule point3d, point4d, list3d, list4d; - qi::rule e; - typename Grammar_::Grammar scalar; - ph::function op; - // ---------------------------------------------------------------------------- - }; // Pnt4DGrammar - // ---------------------------------------------------------------------------- - // Register Pnt4DGrammar for ROOT::Math::LorentzVector: - // ---------------------------------------------------------------------------- - template - struct Grammar_, Skipper> { - typedef Pnt4DGrammar, Skipper> Grammar; - }; - // ============================================================================ - template - struct Histo1DGrammar : qi::grammar, Skipper> { - typedef Gaudi::Histo1DDef ResultT; - // ---------------------------------------------------------------------------- - struct Operations { - void operator()( ResultT& res, const std::string& title ) const { res.setTitle( title ); } - void operator()( ResultT& res, const double& val, const char lh ) const - { - switch ( lh ) { - case 'l': - res.setLowEdge( val ); - break; - case 'h': - res.setHighEdge( val ); - break; - default: - break; - } - } - void operator()( ResultT& res, int val ) const { res.setBins( val ); } - void operator()( ResultT& res ) const {} - }; // Operations - // ---------------------------------------------------------------------------- - Histo1DGrammar() : Histo1DGrammar::base_type( hist ) - { - val1 = title[op( qi::_val, qi::_1 )] >> ',' >> qi::double_[op( qi::_val, qi::_1, 'l' )] >> ',' >> - qi::double_[op( qi::_val, qi::_1, 'h' )] >> -( ',' >> qi::int_[op( qi::_val, qi::_1 )] ); - val2 = qi::double_[op( qi::_val, qi::_1, 'l' )] >> ',' >> qi::double_[op( qi::_val, qi::_1, 'h' )] >> ',' >> - title[op( qi::_val, qi::_1 )] >> -( ',' >> qi::int_[op( qi::_val, qi::_1 )] ); - val3 = qi::double_[op( qi::_val, qi::_1, 'l' )] >> ',' >> qi::double_[op( qi::_val, qi::_1, 'h' )] >> - -( ',' >> title[op( qi::_val, qi::_1 )] ) >> -( ',' >> qi::int_[op( qi::_val, qi::_1 )] ); - begin = enc::char_( '[' )[qi::_val = ']'] | enc::char_( '(' )[qi::_val = ')']; - end = enc::char_( qi::_r1 ); - hist = begin[qi::_a = qi::_1] >> ( val1 | val2 | val3 )[qi::_val = qi::_1] >> end( qi::_a ); - } - // ---------------------------------------------------------------------------- - qi::rule, Skipper> hist; - qi::rule val1, val2, val3; - qi::rule begin; - qi::rule end; - StringGrammar title; - ph::function op; - // ---------------------------------------------------------------------------- - }; // Histo1DGrammar - // ---------------------------------------------------------------------------- - REGISTER_GRAMMAR( Gaudi::Histo1DDef, Histo1DGrammar ); - // ============================================================================ - template - struct KeyValueGrammar : qi::grammar(), Skipper> { - //------------------------------------------------------------------------------ - typedef std::pair ResultT; - //------------------------------------------------------------------------------ - struct first { - }; - struct second { - }; - - KeyValueGrammar() : KeyValueGrammar::base_type( pair ) - { - //------------------------------------------------------------------------------ - pair = gstring >> ":" >> +enc::char_; - } - // ---------------------------------------------------------------------------- - StringGrammar gstring; - qi::rule pair; - // ---------------------------------------------------------------------------- - }; // END KeyValueGrammar - // We don't register KeyalueGrammar because it's a special parser - // ============================================================================ - } -} // Gaudi::Parsers -//============================================================================ -#endif +#include diff --git a/GaudiKernel/GaudiKernel/Parsers.h b/GaudiKernel/GaudiKernel/Parsers.h index 01e6694729..bd7c5a92ef 100644 --- a/GaudiKernel/GaudiKernel/Parsers.h +++ b/GaudiKernel/GaudiKernel/Parsers.h @@ -1,548 +1,3 @@ -// ============================================================================ -#ifndef GAUDIPROPERTYPARSERS_PARSERS_H -#define GAUDIPROPERTYPARSERS_PARSERS_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// STD & STL -// ============================================================================ -#include -#include -#include -#include -#include +#pragma once -// ============================================================================ -#include "GaudiKernel/HistoDef.h" -#include "GaudiKernel/Map.h" -#include "GaudiKernel/StatusCode.h" -// ============================================================================ -#define PARSERS_DECL_FOR_SINGLE( Type ) GAUDI_API StatusCode parse( Type& result, const std::string& input ); - -#define PARSERS_DECL_FOR_PAIR( FirstType, SecondType ) \ - GAUDI_API StatusCode parse( std::pair& result, const std::string& input ); - -#define PARSERS_DECL_FOR_LIST( InnerType ) \ - GAUDI_API StatusCode parse( std::vector& result, const std::string& input ); -// ============================================================================ -/** @file - * The declaration of major parsing functions used e.g - * for (re)implementation of new extended properties see class Property - * These function also could be used in a different, much wider contex. - * all of them have the semantic: - * StatusCode parse ( TYPE& result , const std::string& input ) - * where input is the input string to be parsed, - * and result is the the result of parsing - * - * @code - * - * const std::string input = ... ; - * std::vector result ; - * - * // parse the input - * StatusCode sc = parse ( result , input ) ; - * if ( sc.isFailure() ) - * { - * // error here ... - * } - * std::cout << "vector size " << result.size() << std::endl ; - * - * @endcode - * - * @see Gaudi::Parsers::parse - * @see Property - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-12 - */ -// ============================================================================ -namespace Gaudi -{ - // ========================================================================== - class Histo1DDef; - // ========================================================================== - namespace Parsers - { - // ======================================================================== - /** parse the bool value - * @see Gaudi::Parsers::BoolGrammar - * @param result (output) boolean result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-12 - */ - PARSERS_DECL_FOR_SINGLE( bool ) - // ======================================================================== - /** parse the char value - * - * @see Gaudi::Parsers::CharGrammar - * @param result (output) boolean result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-12 - */ - PARSERS_DECL_FOR_SINGLE( char ) - /// @see Gaudi::Parsers::parser(char&,std::string&) - PARSERS_DECL_FOR_SINGLE( unsigned char ) - /// @see Gaudi::Parsers::parser(char&,std::string&) - PARSERS_DECL_FOR_SINGLE( signed char ) - // ======================================================================== - /** parse the int value - * - * @see Gaudi::Parsers::IntGrammar - * @param result (output) integer result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_SINGLE( int ) - /// @see Gaudi::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( short ) - /// @see Gaudi::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( unsigned short ) - /// @see Gaudi::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( unsigned int ) - /// @see Gaudi::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( long ) - /// @see Gaudi::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( unsigned long ) - /// @see Gaudi::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( long long ) - /// @see Gaudi::Parsers::parser( int&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( unsigned long long ) - // ======================================================================== - /** parse the double value - * - * @see Gaudi::Parsers::RealGrammar - * @param result (output) double result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_SINGLE( double ) - /// @see Gaudi::Parsers::parser( double&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( float ) - /// @see Gaudi::Parsers::parser( double&, const std::string& ) - PARSERS_DECL_FOR_SINGLE( long double ) - // ======================================================================== - /** parse the std::string value - * - * @see Gaudi::Parsers::StringGrammar - * @param result (output) string result - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_SINGLE( std::string ) - // ======================================================================== - - PARSERS_DECL_FOR_LIST( bool ) - PARSERS_DECL_FOR_LIST( char ) - PARSERS_DECL_FOR_LIST( unsigned char ) - PARSERS_DECL_FOR_LIST( signed char ) - - PARSERS_DECL_FOR_LIST( int ) - PARSERS_DECL_FOR_LIST( short ) - PARSERS_DECL_FOR_LIST( unsigned short ) - PARSERS_DECL_FOR_LIST( unsigned int ) - PARSERS_DECL_FOR_LIST( long ) - PARSERS_DECL_FOR_LIST( unsigned long ) - PARSERS_DECL_FOR_LIST( long long ) - PARSERS_DECL_FOR_LIST( unsigned long long ) - - PARSERS_DECL_FOR_LIST( double ) - PARSERS_DECL_FOR_LIST( float ) - PARSERS_DECL_FOR_LIST( long double ) - - PARSERS_DECL_FOR_LIST( std::string ) - // ======================================================================== - // Advanced parses - // ======================================================================== - /** parse the std::pair\ value - * - * @see Gaudi::Parsers::PairGrammar - * @see Gaudi::Parsers::RealGrammar - * @param result (output) pair of doubles - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_PAIR( double, double ) - // ======================================================================== - /** parse the std::pair\ value - * - * @see Gaudi::Parsers::PairGrammar - * @see Gaudi::Parsers::IntGrammar - * @param result (output) pair of integers - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - PARSERS_DECL_FOR_PAIR( int, int ) - // ======================================================================== - /** parse the std::vector\ \> value - * - * @see Gaudi::Parsers::VectorGrammar - * @see Gaudi::Parsers::PairGrammar - * @see Gaudi::Parsers::RealGrammar - * @param result (output) vector with pairs of doubles - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); - // ======================================================================== - /** parse the std::vector\ \> value - * - * @see Gaudi::Parsers::VectorGrammar - * @see Gaudi::Parsers::PairGrammar - * @see Gaudi::Parsers::IntGrammar - * @param result (output) vector with pairs of int - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); - // ======================================================================== - // vector< vector< TYPE > > - // ======================================================================== - /** parse the std::vector\ \> value - * - * @see Gaudi::Parsers::VectorGrammar - * @see Gaudi::Parsers::StringGrammar - * @param result (output) vector with vectors of strings - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); - // ======================================================================== - /** parse the std::vector\ \> value - * - * @see Gaudi::Parsers::VectorGrammar - * @see Gaudi::Parsers::RealGrammar - * @param result (output) vector with vectors of doubles - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::vector>& result, const std::string& input ); - // ======================================================================== - // map< TYPE, TYPE > - // ======================================================================== - /** parse the std::map\ value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::IntGrammar - * @param result (output) map with integer key and double value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::IntGrammar - * @see Gaudi::Parsers::RealGrammar - * @param result (output) map with integer key and double value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::StringGrammar - * @param result (output) map with string key and value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::StringGrammar - * @see Gaudi::Parsers::IntGrammar - * @param result (output) map with string key and integer value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::StringGrammar - * @see Gaudi::Parsers::RealGrammar - * @param result (output) map with string key and integer value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ \> - * value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::StringGrammar - * @see Gaudi::Parsers::VectorGrammar - * @param result (output) map with string value and - * vector of strings as value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map>& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ \> value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::StringGrammar - * @see Gaudi::Parsers::VectorGrammar - * @see Gaudi::Parsers::IntGrammar - * @param result (output) map with string value and - * vector of integers as value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map>& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ \> value - * - * @see Gaudi::Parsers::MapGrammar - * @see Gaudi::Parsers::StringGrammar - * @see Gaudi::Parsers::VectorGrammar - * @see Gaudi::Parsers::RealGrammar - * @param result (output) map with string value and - * vector of doubles as value - * @param input (input) the string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-14 - */ - GAUDI_API StatusCode parse( std::map>& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ \> objects - * - * @see Gaudi::Parsers::MapGrammar - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @date 2007-12-06 - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ \> objects - * - * @see Gaudi::Parsers::MapGrammar - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @date 2007-12-06 - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the std::map\ \> objects - * - * @see Gaudi::Parsers::MapGrammar - */ - GAUDI_API StatusCode parse( std::map& result, const std::string& input ); - // ======================================================================== - /** parse the GaudiUtils::Map\ objects - * - * @see Gaudi::Parsers::MapGrammar - */ - template - GAUDI_API StatusCode parse( GaudiUtils::Map& result, const std::string& input ) - { - return parse( (M&)result, input ); - } - // ======================================================================== - /** parse the pair expression (map-component) " 'name' :value" - * - * @code - * - * const std::string input = "'PackageName':GaudiKernel" ; - * std::string name ; - * std::string value ; - * StatusCode sc = Gaudi::Parsers::parse ( name , value , input ) ; - * if ( sc.isFailure() ) { ... } - * std::cout << "\tParsed name is " << name - * << "\tParsed value is " << value << std::endl - * @endcode - * - * @param name (output) the parsed name of the component, defined - * as 'name' or "name" before the column symbol ":", - * the leading and trailing blans are omitted - * @param value (output) the parsed value of the component, - * defined as everything after the column symbol ":" - * till the end of the string - * @param input (input) string to be parsed - * @return status code - * - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @date 2006-05-12 - */ - GAUDI_API StatusCode parse( std::string& name, std::string& value, const std::string& input ); - // ======================================================================== - /** helper function, needed for implementation of "Histogram Property" - * @param histo the histogram description (output) - * @param input the string to be parsed - * @return status code - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @date 2007-09-17 - */ - GAUDI_API StatusCode parse( Gaudi::Histo1DDef& histo, const std::string& input ); - // ======================================================================== - /** helper function, needed for implementation of "Histogram Property" - * @param histos the map of the histogram descriptions (output) - * @param input the string to be parsed - * @return status code - * @author Vanya BELYAEV ibelyaev@physics.syr.edu - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @date 2007-09-17 - */ - GAUDI_API StatusCode parse( std::map& histos, const std::string& input ); - // ======================================================================== - /** helper function, needed for implementation of map of pairs - * It is very useful construction for monitoring to - * represent the value and error or the allowed range for - * some parameter - * @param params the map of pair - * @param input the string to be parsed - * @return status code - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @author Alexander MAZUROV Alexander.Mazurov@gmail.com - * @date 2009-05-19 - */ - GAUDI_API StatusCode parse( std::map>& params, const std::string& input ); - // ======================================================================== - /** parser function for C-arrays - * @param params C-array - * @param input the string to be parsed - * @return status code - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @date 2009-09-15 - */ - template - StatusCode parse( T ( &result )[N], const std::string& input ) - { - typedef std::vector _Vct; - // create the temporary vector - _Vct tmp; - StatusCode sc = parse( tmp, input ); - if ( sc.isFailure() ) { - return sc; - } // RETURN - if ( N != tmp.size() ) { - return StatusCode::FAILURE; - } // RETURN - // - std::copy( tmp.begin(), tmp.end(), result ); - // - return StatusCode::SUCCESS; // RETURN - } - // ======================================================================== - /** parser function for C-strings - * @param params C-string - * @param input the string to be parsed - * @return status code - * @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl - * @date 2009-09-15 - */ - template - StatusCode parse( char ( &result )[N], const std::string& input ) - { - // clear the string - std::fill_n( result, N, ' ' ); - // create the temporary string - std::string tmp; - StatusCode sc = parse( tmp, input ); - if ( sc.isFailure() ) { - return sc; - } // RETURN - if ( N == tmp.size() ) { - std::copy( tmp.begin(), tmp.end(), result ); - } else if ( N + 2 == tmp.size() && ( '\'' == tmp[0] || '\"' == tmp[0] ) && ( tmp[0] == tmp[tmp.size() - 1] ) ) { - std::copy( tmp.begin() + 1, tmp.end() - 1, result ); - } else { - return StatusCode::FAILURE; - } - // - return StatusCode::SUCCESS; // RETURN - } - // ======================================================================== - } // end of namespace Gaudi::Parsers - // ========================================================================== -} // end of namespace Gaudi -// ============================================================================ -// The END -// ============================================================================ -#endif // GAUDIPROPERTYPARSERS_PARSERS_H -// ============================================================================ +#include diff --git a/GaudiKernel/GaudiKernel/ParsersFactory.h b/GaudiKernel/GaudiKernel/ParsersFactory.h index 9aef45037d..c9ccaa1ff9 100644 --- a/GaudiKernel/GaudiKernel/ParsersFactory.h +++ b/GaudiKernel/GaudiKernel/ParsersFactory.h @@ -1,64 +1,3 @@ -// ============================================================================ -#ifndef GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H -#define GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H 1 -// ============================================================================ -// Include files -// ============================================================================ -// STD & STL -// ============================================================================ -#include -#include -#include -// ============================================================================ -// Boost: -// ============================================================================ -#include -#include -// ============================================================================ -// Gaudi -// ============================================================================ -#include "GaudiKernel/GrammarsV2.h" -#include "GaudiKernel/StatusCode.h" -// ============================================================================ -namespace Gaudi -{ - namespace Parsers - { - // ======================================================================== - typedef std::string::const_iterator IteratorT; - // typedef boost::spirit::ascii::space_type Skipper; - typedef SkipperGrammar Skipper; - // ======================================================================== - template - inline StatusCode parse_( ResultT& result, const std::string& input ) - { - Skipper skipper; - typename Grammar_::Grammar g; - IteratorT iter = input.begin(), end = input.end(); - return ( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ? StatusCode::SUCCESS - : StatusCode::FAILURE ); - } - //========================================================================= - template <> - inline StatusCode parse_( std::string& result, const std::string& input ) - { - Skipper skipper; - Grammar_::Grammar g; - IteratorT iter = input.begin(), end = input.end(); - if ( !( qi::phrase_parse( iter, end, g, skipper, result ) && ( iter == end ) ) ) { - result = input; - } - //@attention always - return StatusCode::SUCCESS; - } - //========================================================================= - template - inline StatusCode parse( ResultT& result, const std::string& input ) - { - return parse_( result, input ); - } - //========================================================================= - } /* Parsers */ -} /* Gaudi */ -//============================================================================= -#endif // GAUDIPROPERTYPARSERS_PARSERSGENERATOR_H +#pragma once + +#include diff --git a/GaudiKernel/GaudiKernel/Property.h b/GaudiKernel/GaudiKernel/Property.h index cf18582e73..87d63fc1e3 100644 --- a/GaudiKernel/GaudiKernel/Property.h +++ b/GaudiKernel/GaudiKernel/Property.h @@ -12,23 +12,15 @@ // ============================================================================ #include "GaudiKernel/IProperty.h" #include "GaudiKernel/Kernel.h" -#include "GaudiKernel/Parsers.h" #include "GaudiKernel/PropertyFwd.h" #include "GaudiKernel/SmartIF.h" #include "GaudiKernel/TaggedBool.h" #include "GaudiKernel/ToStream.h" +#include +#include namespace Gaudi { - namespace Parsers - { - /// Helper class to enable ADL for parsers - struct InputData : std::string { - InputData( const std::string& s ) : std::string{s} {} - using std::string::string; - using std::string::operator=; - }; - } namespace Details { // ============================================================================ diff --git a/GaudiKernel/GaudiKernel/SVectorAsProperty.h b/GaudiKernel/GaudiKernel/SVectorAsProperty.h index 57112d0da5..1c06d54475 100644 --- a/GaudiKernel/GaudiKernel/SVectorAsProperty.h +++ b/GaudiKernel/GaudiKernel/SVectorAsProperty.h @@ -10,7 +10,7 @@ // ============================================================================ // GaudiKernel // ============================================================================ -#include "GaudiKernel/Parsers.h" +#include // ============================================================================ // ROOT/SVector // ============================================================================ diff --git a/GaudiKernel/GaudiKernel/StdArrayAsProperty.h b/GaudiKernel/GaudiKernel/StdArrayAsProperty.h index f5c443383a..2b10a5d7d9 100644 --- a/GaudiKernel/GaudiKernel/StdArrayAsProperty.h +++ b/GaudiKernel/GaudiKernel/StdArrayAsProperty.h @@ -45,7 +45,7 @@ namespace Gaudi // ============================================================================ // GaudiKernel // ============================================================================ -#include "GaudiKernel/Parsers.h" +#include // ============================================================================ namespace Gaudi { diff --git a/GaudiKernel/src/Lib/DataObjID.cpp b/GaudiKernel/src/Lib/DataObjID.cpp index aac9c008eb..ff02be010a 100644 --- a/GaudiKernel/src/Lib/DataObjID.cpp +++ b/GaudiKernel/src/Lib/DataObjID.cpp @@ -2,7 +2,7 @@ #include "GaudiKernel/Bootstrap.h" #include "GaudiKernel/IClassIDSvc.h" #include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/ParsersFactory.h" +#include #include #include #include diff --git a/GaudiKernel/src/Lib/DataObjectHandleProperty.cpp b/GaudiKernel/src/Lib/DataObjectHandleProperty.cpp index 6267276c36..c5cebb4c54 100644 --- a/GaudiKernel/src/Lib/DataObjectHandleProperty.cpp +++ b/GaudiKernel/src/Lib/DataObjectHandleProperty.cpp @@ -1,8 +1,8 @@ #include "GaudiKernel/DataObjectHandleProperty.h" #include "GaudiKernel/DataObjectHandleBase.h" -#include "GaudiKernel/Parsers.h" #include "GaudiKernel/System.h" +#include #include diff --git a/GaudiKernel/src/Lib/ParsersCollections.cpp b/GaudiKernel/src/Lib/ParsersCollections.cpp index 07c9cb49d1..e43cb524f4 100644 --- a/GaudiKernel/src/Lib/ParsersCollections.cpp +++ b/GaudiKernel/src/Lib/ParsersCollections.cpp @@ -3,7 +3,7 @@ // ============================================================================ #include "GaudiKernel/VectorMap.h" // ============================================================================ -#include "GaudiKernel/ParsersFactory.h" +#include // ============================================================================ StatusCode Gaudi::Parsers::parse( GaudiUtils::VectorMap& result, const std::string& input ) diff --git a/GaudiKernel/src/Lib/ParsersHistograms.cpp b/GaudiKernel/src/Lib/ParsersHistograms.cpp index 9ec0595606..17af82a110 100644 --- a/GaudiKernel/src/Lib/ParsersHistograms.cpp +++ b/GaudiKernel/src/Lib/ParsersHistograms.cpp @@ -1,9 +1,9 @@ // ============================================================================ // Include files // ============================================================================ -#include "GaudiKernel/Parsers.h" +#include // ============================================================================ -#include "GaudiKernel/ParsersFactory.h" +#include // ============================================================================ StatusCode Gaudi::Parsers::parse( Gaudi::Histo1DDef& result, const std::string& input ) { diff --git a/GaudiKernel/src/Lib/ParsersStandardListCommon.h b/GaudiKernel/src/Lib/ParsersStandardListCommon.h index 7457c1226b..0474f2dd48 100644 --- a/GaudiKernel/src/Lib/ParsersStandardListCommon.h +++ b/GaudiKernel/src/Lib/ParsersStandardListCommon.h @@ -3,8 +3,8 @@ // ============================================================================ // Include files // ============================================================================ -#include "GaudiKernel/Parsers.h" -#include "GaudiKernel/ParsersFactory.h" +#include +#include // ============================================================================ // STD & STL // ============================================================================ diff --git a/GaudiKernel/src/Lib/ParsersStandardMiscCommon.h b/GaudiKernel/src/Lib/ParsersStandardMiscCommon.h index 17cbf68690..7b7f9d16fe 100644 --- a/GaudiKernel/src/Lib/ParsersStandardMiscCommon.h +++ b/GaudiKernel/src/Lib/ParsersStandardMiscCommon.h @@ -3,8 +3,8 @@ // ============================================================================ // Include files // ============================================================================ -#include "GaudiKernel/Parsers.h" -#include "GaudiKernel/ParsersFactory.h" +#include +#include // ============================================================================ // STD & STL // ============================================================================ diff --git a/GaudiKernel/src/Lib/ParsersStandardSingle.cpp b/GaudiKernel/src/Lib/ParsersStandardSingle.cpp index 429afc6375..e514854da6 100644 --- a/GaudiKernel/src/Lib/ParsersStandardSingle.cpp +++ b/GaudiKernel/src/Lib/ParsersStandardSingle.cpp @@ -1,8 +1,8 @@ // ============================================================================ // Include files // ============================================================================ -#include "GaudiKernel/Parsers.h" -#include "GaudiKernel/ParsersFactory.h" +#include +#include // ============================================================================ // STD & STL // ============================================================================ diff --git a/GaudiKernel/src/Lib/ParsersVct.cpp b/GaudiKernel/src/Lib/ParsersVct.cpp index 5b6ff2e50f..5674e90c81 100644 --- a/GaudiKernel/src/Lib/ParsersVct.cpp +++ b/GaudiKernel/src/Lib/ParsersVct.cpp @@ -3,8 +3,8 @@ // ============================================================================ #include "GaudiKernel/VectorsAsProperty.h" // ============================================================================ -#include "GaudiKernel/ParsersFactory.h" #include "GaudiKernel/ToStream.h" +#include // ============================================================================ namespace { diff --git a/GaudiKernel/src/Lib/StringKey.cpp b/GaudiKernel/src/Lib/StringKey.cpp index c9c8028e65..0c296c14ea 100644 --- a/GaudiKernel/src/Lib/StringKey.cpp +++ b/GaudiKernel/src/Lib/StringKey.cpp @@ -4,8 +4,8 @@ // GaudiKernel // ============================================================================ #include "GaudiKernel/StringKey.h" -#include "GaudiKernel/Parsers.h" #include "GaudiKernel/ToStream.h" +#include // ============================================================================ /** @file * Implementation file for class Gaudi::StringKey diff --git a/GaudiKernel/tests/src/parsers.cpp b/GaudiKernel/tests/src/parsers.cpp index d1b703f8c1..c45781270a 100644 --- a/GaudiKernel/tests/src/parsers.cpp +++ b/GaudiKernel/tests/src/parsers.cpp @@ -4,8 +4,8 @@ #include "GaudiKernel/VectorsAsProperty.h" #include -#include "GaudiKernel/ParsersFactory.h" #include "GaudiKernel/ToStream.h" +#include using namespace Gaudi::Parsers; diff --git a/GaudiUtils/src/Lib/HistoParsers.cpp b/GaudiUtils/src/Lib/HistoParsers.cpp index 7a00534125..c960fc7b7c 100644 --- a/GaudiUtils/src/Lib/HistoParsers.cpp +++ b/GaudiUtils/src/Lib/HistoParsers.cpp @@ -23,7 +23,7 @@ // ============================================================================ // GaudiKernel // ============================================================================ -#include "GaudiKernel/ParsersFactory.h" +#include // ============================================================================ // local // ============================================================================ -- GitLab