ATLAS Offline Software
TestProxyLoader.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TestProxyLoader.cxx, (c) ATLAS Detector software
8 // Author: Thomas Gillam (thomas.gillam@cern.ch)
9 // ExpressionParsing library
11 
13 
14 #include <stdexcept>
15 
16 namespace ExpressionParsing {
18  {
19  }
20 
22  {
23  m_intAccessCount = 0;
24  }
25 
27  {
28  if (varname == "intTEST") return VT_INT;
29  else if (varname == "int_TEST") return VT_INT;
30  else if (varname == "doubleTEST") return VT_DOUBLE;
31  else if (varname == "vectorIntTEST") return VT_VECINT;
32  else if (varname == "vectorDoubleTEST") return VT_VECDOUBLE;
33  else return VT_UNK;
34  }
35 
37  {
38  if (varname == "intTEST") { ++m_intAccessCount; return (42+(m_intAccessCount-1)); }
39  else if (varname == "int_TEST") { return 24; }
40  else throw std::runtime_error("Unknown proxy: " + varname);
41  }
42 
43  double TestProxyLoader::loadDoubleVariableFromString(const std::string &varname) const
44  {
45  if (varname == "doubleTEST") return 42.42;
46  else throw std::runtime_error("Unknown proxy: " + varname);
47  }
48 
49  std::vector<int> TestProxyLoader::loadVecIntVariableFromString(const std::string &varname) const
50  {
51  if (varname == "vectorIntTEST") return std::vector<int>(2, 42);
52  else throw std::runtime_error("Unknown proxy: " + varname);
53  }
54 
55  std::vector<double> TestProxyLoader::loadVecDoubleVariableFromString(const std::string &varname) const
56  {
57  if (varname == "vectorDoubleTEST") return std::vector<double>(2, 42.42);
58  else throw std::runtime_error("Unknown proxy: " + varname);
59  }
60 }
ExpressionParsing::TestProxyLoader::loadDoubleVariableFromString
virtual double loadDoubleVariableFromString(const std::string &varname) const
Definition: TestProxyLoader.cxx:43
ExpressionParsing::TestProxyLoader::~TestProxyLoader
virtual ~TestProxyLoader()
Definition: TestProxyLoader.cxx:17
ExpressionParsing::IProxyLoader::VT_VECDOUBLE
@ VT_VECDOUBLE
Definition: IProxyLoader.h:21
ExpressionParsing::TestProxyLoader::loadVecDoubleVariableFromString
virtual std::vector< double > loadVecDoubleVariableFromString(const std::string &varname) const
Definition: TestProxyLoader.cxx:55
ExpressionParsing::TestProxyLoader::reset
virtual void reset()
Definition: TestProxyLoader.cxx:21
ExpressionParsing::IProxyLoader::VariableType
VariableType
Definition: IProxyLoader.h:21
ExpressionParsing::IProxyLoader::VT_DOUBLE
@ VT_DOUBLE
Definition: IProxyLoader.h:21
ExpressionParsing::IProxyLoader::VT_UNK
@ VT_UNK
Definition: IProxyLoader.h:21
ExpressionParsing::TestProxyLoader::m_intAccessCount
std::atomic< unsigned int > m_intAccessCount
Definition: TestProxyLoader.h:35
ExpressionParsing
Namespace holding all the expression evaluation code.
Definition: ExpressionParser.h:26
ExpressionParsing::IProxyLoader::VT_VECINT
@ VT_VECINT
Definition: IProxyLoader.h:21
ExpressionParsing::TestProxyLoader::variableTypeFromString
virtual IProxyLoader::VariableType variableTypeFromString(const std::string &varname) const
Definition: TestProxyLoader.cxx:26
ExpressionParsing::IProxyLoader::VT_INT
@ VT_INT
Definition: IProxyLoader.h:21
TestProxyLoader.h
LArG4AODNtuplePlotter.varname
def varname(hname)
Definition: LArG4AODNtuplePlotter.py:37
ExpressionParsing::TestProxyLoader::loadVecIntVariableFromString
virtual std::vector< int > loadVecIntVariableFromString(const std::string &varname) const
Definition: TestProxyLoader.cxx:49
ExpressionParsing::TestProxyLoader::loadIntVariableFromString
virtual int loadIntVariableFromString(const std::string &varname) const
Definition: TestProxyLoader.cxx:36