ATLAS Offline Software
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
ExpressionParsing::xAODProxyLoader Class Referenceabstract

#include <xAODVariableProxyLoaders.h>

Inheritance diagram for ExpressionParsing::xAODProxyLoader:
Collaboration diagram for ExpressionParsing::xAODProxyLoader:

Public Types

enum  VariableType {
  VT_UNK, VT_INT, VT_DOUBLE, VT_VECINT,
  VT_VECDOUBLE, VT_VECEMPTY
}
 

Public Member Functions

 xAODProxyLoader ()
 
virtual ~xAODProxyLoader ()
 
 xAODProxyLoader (const xAODProxyLoader &)=delete
 Disallow copy construction and assignment. More...
 
xAODProxyLoaderoperator= (const xAODProxyLoader &)=delete
 
virtual void reset ()
 
virtual VariableType variableTypeFromString (const std::string &varname) const =0
 
virtual int loadIntVariableFromString (const std::string &varname) const =0
 
virtual double loadDoubleVariableFromString (const std::string &varname) const =0
 
virtual std::vector< int > loadVecIntVariableFromString (const std::string &varname) const =0
 
virtual std::vector< double > loadVecDoubleVariableFromString (const std::string &varname) const =0
 

Protected Types

using accessorCache_t = CxxUtils::ConcurrentStrMap< BaseAccessorWrapper *, CxxUtils::SimpleUpdater >
 

Protected Member Functions

template<class TYPE , class AUX >
bool try_type (const std::string &varname, const std::type_info *ti, const AUX *data) const
 
template<class AUX >
IProxyLoader::VariableType try_all_known_types (const std::string &varname, const AUX *data, bool isVector) const
 

Protected Attributes

accessorCache_t m_accessorCache ATLAS_THREAD_SAFE
 

Detailed Description

Definition at line 146 of file xAODVariableProxyLoaders.h.

Member Typedef Documentation

◆ accessorCache_t

Definition at line 164 of file xAODVariableProxyLoaders.h.

Member Enumeration Documentation

◆ VariableType

Enumerator
VT_UNK 
VT_INT 
VT_DOUBLE 
VT_VECINT 
VT_VECDOUBLE 
VT_VECEMPTY 

Definition at line 21 of file IProxyLoader.h.

Constructor & Destructor Documentation

◆ xAODProxyLoader() [1/2]

ExpressionParsing::xAODProxyLoader::xAODProxyLoader ( )

Definition at line 186 of file xAODVariableProxyLoaders.cxx.

186  :
187  m_accessorCache(accessorCache_t::Updater_t())
188  {
189  }

◆ ~xAODProxyLoader()

ExpressionParsing::xAODProxyLoader::~xAODProxyLoader ( )
virtual

Definition at line 191 of file xAODVariableProxyLoaders.cxx.

192  {
194  }

◆ xAODProxyLoader() [2/2]

ExpressionParsing::xAODProxyLoader::xAODProxyLoader ( const xAODProxyLoader )
delete

Disallow copy construction and assignment.

Member Function Documentation

◆ loadDoubleVariableFromString()

virtual double ExpressionParsing::IProxyLoader::loadDoubleVariableFromString ( const std::string &  varname) const
pure virtualinherited

◆ loadIntVariableFromString()

virtual int ExpressionParsing::IProxyLoader::loadIntVariableFromString ( const std::string &  varname) const
pure virtualinherited

◆ loadVecDoubleVariableFromString()

virtual std::vector<double> ExpressionParsing::IProxyLoader::loadVecDoubleVariableFromString ( const std::string &  varname) const
pure virtualinherited

◆ loadVecIntVariableFromString()

virtual std::vector<int> ExpressionParsing::IProxyLoader::loadVecIntVariableFromString ( const std::string &  varname) const
pure virtualinherited

◆ operator=()

xAODProxyLoader& ExpressionParsing::xAODProxyLoader::operator= ( const xAODProxyLoader )
delete

◆ reset()

void ExpressionParsing::xAODProxyLoader::reset ( )
virtual

Implements ExpressionParsing::IProxyLoader.

Definition at line 196 of file xAODVariableProxyLoaders.cxx.

197  {
198  for (auto x : m_accessorCache) delete x.second;
199  // m_accessorCache.clear(); // not supported by ConcurrentStrMap
200  }

◆ try_all_known_types()

template<class AUX >
IProxyLoader::VariableType ExpressionParsing::xAODProxyLoader::try_all_known_types ( const std::string &  varname,
const AUX *  data,
bool  isVector 
) const
protected

Definition at line 220 of file xAODVariableProxyLoaders.cxx.

222  {
224  const SG::auxid_t auxid = r.findAuxID(varname);
225  if (auxid != SG::null_auxid) {
226  const std::type_info *ti = r.getType(auxid);
227  // Try integer types:
228  if ( try_type<int>(varname, ti, data) ||
229  try_type<bool>(varname, ti, data) ||
230  try_type<unsigned int>(varname, ti, data) ||
231  try_type<char>(varname, ti, data) ||
232  try_type<uint8_t>(varname, ti, data) ||
233  try_type<unsigned short>(varname, ti, data) ||
234  try_type<short>(varname, ti, data) ) {
236  }
237  // Try floating point types:
238  if ( try_type<float>(varname, ti, data) ||
239  try_type<double>(varname, ti, data) ) {
241  }
242  }
243  return VT_UNK;
244  }

◆ try_type()

template<class TYPE , class AUX >
bool ExpressionParsing::xAODProxyLoader::try_type ( const std::string &  varname,
const std::type_info *  ti,
const AUX *  data 
) const
protected

Definition at line 203 of file xAODVariableProxyLoaders.cxx.

204  {
205  if (*ti == typeid(TYPE)) {
206  auto accWrap = std::make_unique<AccessorWrapper<TYPE>>(varname);
207  if (accWrap && accWrap->isValid(data)) {
208  m_accessorCache.insert_or_assign(varname, accWrap.release());
209  return true;
210  } else if (accWrap) {
212  const SG::auxid_t auxid = r.findAuxID(varname);
213  throw std::runtime_error("Unsupported aux element type '"+r.getTypeName(auxid)+"' for '"+varname+"'");
214  }
215  }
216  return false;
217  }

◆ variableTypeFromString()

virtual VariableType ExpressionParsing::IProxyLoader::variableTypeFromString ( const std::string &  varname) const
pure virtualinherited

Member Data Documentation

◆ ATLAS_THREAD_SAFE

accessorCache_t m_accessorCache ExpressionParsing::xAODProxyLoader::ATLAS_THREAD_SAFE
mutableprotected

Definition at line 165 of file xAODVariableProxyLoaders.h.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:676
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
ExpressionParsing::IProxyLoader::VT_VECEMPTY
@ VT_VECEMPTY
Definition: IProxyLoader.h:21
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
ExpressionParsing::IProxyLoader::VT_VECDOUBLE
@ VT_VECDOUBLE
Definition: IProxyLoader.h:21
x
#define x
SG::AuxTypeRegistry
Handle mappings between names and auxid_t.
Definition: AuxTypeRegistry.h:61
SG::auxid_t
size_t auxid_t
Identifier for a particular aux data item.
Definition: AuxTypes.h:27
ExpressionParsing::IProxyLoader::VT_DOUBLE
@ VT_DOUBLE
Definition: IProxyLoader.h:21
ExpressionParsing::IProxyLoader::VT_UNK
@ VT_UNK
Definition: IProxyLoader.h:21
ExpressionParsing::IProxyLoader::VT_VECINT
@ VT_VECINT
Definition: IProxyLoader.h:21
ExpressionParsing::IProxyLoader::VT_INT
@ VT_INT
Definition: IProxyLoader.h:21
TYPE
#define TYPE(CODE, TYP, IOTYP)
LArG4AODNtuplePlotter.varname
def varname(hname)
Definition: LArG4AODNtuplePlotter.py:37
runLayerRecalibration.isVector
string isVector
Definition: runLayerRecalibration.py:125
ExpressionParsing::xAODProxyLoader::reset
virtual void reset()
Definition: xAODVariableProxyLoaders.cxx:196