5#ifndef _ExpressionParserUser_H_
6#define _ExpressionParserUser_H_
15#include "GaudiKernel/StatusCode.h"
16#include "GaudiKernel/DataHandle.h"
29 template <
unsigned short NUM_PARSER>
34 std::array< std::unique_ptr<ExpressionParsing::ExpressionParser>, NUM_PARSER >
36 const std::vector< std::string> &selection_string,
37 unsigned short num_parser);
41 std::vector<std::string>
getVariables(
const std::array<std::unique_ptr<ExpressionParsing::ExpressionParser>,NUM_PARSER> &parser);
49 std::unique_ptr<ExpressionParsing::ExpressionParser>
51 const std::string &selection_string,
52 unsigned short num_parser);
56 std::vector<std::string>
getVariables(
const std::unique_ptr<ExpressionParsing::ExpressionParser> &parser);
61 template <
unsigned short NUM_PARSER>
62 using ParserHelper =
typename std::conditional< NUM_PARSER == 1, class SingleParserHelper, class MultiParserHelper<NUM_PARSER> >
::type;
65 template <
unsigned short NUM_PARSER>
66 using SelectionArg =
typename std::conditional< NUM_PARSER == 1, std::string, std::vector< std::string > >
::type;
70template <
class T_Base,
unsigned short const NUM_PARSER>
76 template <
typename...Args>
84 const std::vector<const DataObjID*> &output_data_in,
85 std::vector<Gaudi::DataHandle *> &new_input_handles,
86 std::vector<Gaudi::DataHandle *> &new_output_handles)
override;
98 typename std::conditional< NUM_PARSER == 1,
99 std::unique_ptr<ExpressionParsing::ExpressionParser>,
100 std::array< std::unique_ptr<ExpressionParsing::ExpressionParser>, NUM_PARSER> >
::type m_parser;
105template <
class T_Base,
unsigned short const NUM_PARSER = 1>
109 template <
typename...Args>
virtual bool renounceInput(const DataObjID &output_data_id) override
ExpressionParserUserBase(Args...args)
std::unique_ptr< ExpressionParsing::IProxyLoader > m_proxyLoaders
StatusCode finalizeParser()
ExpressionParsing::SGxAODProxyLoader * m_xAODProxyLoader
The expression parser.
std::conditional< NUM_PARSER==1, std::unique_ptr< ExpressionParsing::ExpressionParser >, std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > >::type m_parser
std::vector< std::string > m_renounce
virtual ~ExpressionParserUserBase()=default
StatusCode _initializeParser(const ExpressionParsing::SelectionArg< NUM_PARSER > &selection_string, ExpressionParsing::AppendLoaderFunc pre_xaod_loader=ExpressionParsing::NoLoaderFunc, ExpressionParsing::AppendLoaderFunc post_xaod_loader=ExpressionParsing::NoLoaderFunc)
virtual bool updateDataNeeds(const std::vector< const DataObjID * > &input_data_in, const std::vector< const DataObjID * > &output_data_in, std::vector< Gaudi::DataHandle * > &new_input_handles, std::vector< Gaudi::DataHandle * > &new_output_handles) override
Inform a dynamic data consumer about all consumed or produced data.
ExpressionParserUser(Args &&...args)
StatusCode initializeParser(const ExpressionParsing::SelectionArg< NUM_PARSER > &selection_string)
Helper class to handle an array expression parsers to be used in the generic code.
static std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > createParser(ExpressionParsing::IProxyLoader &proxy_loader, const std::vector< std::string > &selection_string, unsigned short num_parser)
create an expression parser for each of the given expression strings
static std::vector< std::string > getVariables(const std::array< std::unique_ptr< ExpressionParsing::ExpressionParser >, NUM_PARSER > &parser)
get the union of all variables used by the given list of expression parsers.
Auxiliary class to access content of xAOD objects referred to by variables of an expressions handled ...
Helper class to handle a single expression parser to be used in the generic code.
static std::unique_ptr< ExpressionParsing::ExpressionParser > createParser(ExpressionParsing::IProxyLoader &proxy_loader, const std::string &selection_string, unsigned short num_parser)
Create a single expression parser for the given expression.
static std::vector< std::string > getVariables(const std::unique_ptr< ExpressionParsing::ExpressionParser > &parser)
Get the variables from used by the given expression parser.
Namespace holding all the expression evaluation code.
typename std::conditional< NUM_PARSER==1, std::string, std::vector< std::string > >::type SelectionArg
type to be used for expression string(s) for a single or multiple expression parsers
std::function< StatusCode(ExpressionParsing::MultipleProxyLoader &)> AppendLoaderFunc
typename std::conditional< NUM_PARSER==1, class SingleParserHelper, class MultiParserHelper< NUM_PARSER > >::type ParserHelper
type of a helper class to create n-parser for the given expression or list of expressions.
StatusCode NoLoaderFunc(ExpressionParsing::MultipleProxyLoader &)