ATLAS Offline Software
Loading...
Searching...
No Matches
AuxStoreAccessorMacros.h File Reference

Go to the source code of this file.

Macros

#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
 Macro creating the accessors of primitive auxiliary properties.
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
 Macro creating the reader function for a primitive auxiliary property.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
 Macro creating the accessors of complex auxiliary properties.
#define AUXSTORE_OBJECT_SETTER_AND_GETTER_VARNAME(CL, TYPE, NAME, SETTER, VARNAME)
 Macro creating the accessors of complex auxiliary properties, allowing specifying the variable name.
#define AUXSTORE_OBJECT_MOVE(CL, TYPE, NAME, SETTER)
 Macro creating a move accessor for complex auxiliary properties.
#define AUXSTORE_OBJECT_GETTER(CL, TYPE, NAME)
 Macro creating the reader function for a complex auxiliary property.
#define AUXSTORE_OBJECT_GETTER_VARNAME(CL, TYPE, NAME, VARNAME)
 Macro creating the reader function for a complex auxiliary property allowing specifying the variable name.
#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME)
 Macro creating a getter function with a type conversion.
#define AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME, SETTER)
 Macro creating a setter function with a type conversion.

Macro Definition Documentation

◆ AUXSTORE_OBJECT_GETTER

#define AUXSTORE_OBJECT_GETTER ( CL,
TYPE,
NAME )
Value:
#define AUXSTORE_OBJECT_GETTER_VARNAME(CL, TYPE, NAME, VARNAME)
Macro creating the reader function for a complex auxiliary property allowing specifying the variable ...
#define TYPE(CODE, TYP, IOTYP)

Macro creating the reader function for a complex auxiliary property.

Just like AUXSTORE_OBJECT_SETTER_AND_GETTER, this macro also handles an auxiliary property that should be passed around using constant references.

Parameters
CLThe name of the xAOD class
TYPEThe (complex) type name
NAMEThe name of the auxiliary variable

If TYPE is an instance of SG::JaggedVecElt<T>, then an accessor will be generated handling jagged vector variables, returning type SG::ConstAccessor<T>::const_reference_type (which is the same as SG::ConstAccessor<T>::const_reference_type).

If TYPE is an instance of SG::PackedLink<T>, then an accessor will be generated handling packed link variables, returning type ElementLink<T>.

Definition at line 165 of file AuxStoreAccessorMacros.h.

165#define AUXSTORE_OBJECT_GETTER(CL, TYPE, NAME ) \
166 AUXSTORE_OBJECT_GETTER_VARNAME(CL, TYPE, NAME, NAME)

◆ AUXSTORE_OBJECT_GETTER_VARNAME

#define AUXSTORE_OBJECT_GETTER_VARNAME ( CL,
TYPE,
NAME,
VARNAME )
Value:
static const SG::ConstAccessor< TYPE > acc( #VARNAME ); \
return acc( *this ); \
} \
Helper class to provide constant type-safe access to aux data.
typename AuxDataTraits< T, ALLOC >::const_reference_type const_reference_type

Macro creating the reader function for a complex auxiliary property allowing specifying the variable name.

Just like AUXSTORE_OBJECT_SETTER_AND_GETTER, this macro also handles an auxiliary property that should be passed around using constant references.

Parameters
CLThe name of the xAOD class
TYPEThe (complex) type name
NAMEThe name of the auxiliary variable
VARNAMEThe auxiliary variable name.

If TYPE is an instance of SG::JaggedVecElt<T>, then an accessor will be generated handling jagged vector variables, returning type SG::ConstAccessor<T>::const_reference_type (which is the same as SG::ConstAccessor<T>::const_reference_type).

If TYPE is an instance of SG::PackedLink<T>, then an accessor will be generated handling packed link variables, returning type ElementLink<T>.

Definition at line 189 of file AuxStoreAccessorMacros.h.

189#define AUXSTORE_OBJECT_GETTER_VARNAME(CL, TYPE, NAME, VARNAME) \
190 typename SG::ConstAccessor< TYPE >::const_reference_type CL::NAME() const { \
191 static const SG::ConstAccessor< TYPE > acc( #VARNAME ); \
192 return acc( *this ); \
193 } \
194

◆ AUXSTORE_OBJECT_MOVE

#define AUXSTORE_OBJECT_MOVE ( CL,
TYPE,
NAME,
SETTER )
Value:
void CL::SETTER( typename SG::AuxDataTraits<TYPE>::element_type&& value ) { \
static const SG::Accessor< TYPE > acc( #NAME ); \
acc( *this ) = std::move(value); \
return; \
}
Helper class to provide type-safe access to aux data.
T element_type
The type the user sees.

Macro creating a move accessor for complex auxiliary properties.

This macro should be used in the same way as the AUXSTORE_OBJECT_SETTER_AND_GETTER one. In C++11, this will create a setter that takes its argument using move semantics. It is a no-op in C++98.

Parameters
CLThe name of the xAOD class
TYPEThe (complex) type name
NAMEThe name of the auxiliary variable
SETTERThe name of the "setter function"

Definition at line 138 of file AuxStoreAccessorMacros.h.

138# define AUXSTORE_OBJECT_MOVE(CL, TYPE, NAME, SETTER) \
139 void CL::SETTER( typename SG::AuxDataTraits<TYPE>::element_type&& value ) { \
140 static const SG::Accessor< TYPE > acc( #NAME ); \
141 acc( *this ) = std::move(value); \
142 return; \
143 }

◆ AUXSTORE_OBJECT_SETTER_AND_GETTER

#define AUXSTORE_OBJECT_SETTER_AND_GETTER ( CL,
TYPE,
NAME,
SETTER )
Value:
#define AUXSTORE_OBJECT_SETTER_AND_GETTER_VARNAME(CL, TYPE, NAME, SETTER, VARNAME)
Macro creating the accessors of complex auxiliary properties, allowing specifying the variable name.

Macro creating the accessors of complex auxiliary properties.

This macro should be used in the same way as the AUXSTORE_PRIMITIVE_SETTER_AND_GETTER one. However in contrary to that one, it assumes that the type given to it is heavy enough that it should be passed around using constant references instead of by value.

Parameters
CLThe name of the xAOD class
TYPEThe (complex) type name
NAMEThe name of the auxiliary variable
SETTERThe name of the "setter function"

If TYPE is an instance of SG::JaggedVecElt<T>, then accessors will be generated handling jagged vector variables. In that case, the read accessor will return type SG::ConstAccessor<T>::const_reference_type (which is the same as SG::ConstAccessor<T>::const_reference_type), and the write accessor will take type std::span<const T>.

If TYPE is an instance of SG::PackedLink<T>, then accessors will be generated handling packed link variables. In that case, the read accessor will return type ElementLink<T>, and the write accessor will take type const ElementLink<T>&.

Definition at line 88 of file AuxStoreAccessorMacros.h.

88#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER) \
89 AUXSTORE_OBJECT_SETTER_AND_GETTER_VARNAME(CL, TYPE, NAME, SETTER, NAME)

◆ AUXSTORE_OBJECT_SETTER_AND_GETTER_VARNAME

#define AUXSTORE_OBJECT_SETTER_AND_GETTER_VARNAME ( CL,
TYPE,
NAME,
SETTER,
VARNAME )
Value:
AUXSTORE_OBJECT_GETTER_VARNAME(CL, TYPE, NAME, VARNAME) \
void CL::SETTER( typename SG::Accessor< TYPE >::rhs_const_reference_type value ) { \
static const SG::Accessor< TYPE > acc( #VARNAME ); \
acc( *this ) = value; \
return; \
}
typename ConstAccessor< T, ALLOC >::const_reference_type rhs_const_reference_type

Macro creating the accessors of complex auxiliary properties, allowing specifying the variable name.

This macro should be used in the same way as the AUXSTORE_PRIMITIVE_SETTER_AND_GETTER one. However in contrary to that one, it assumes that the type given to it is heavy enough that it should be passed around using constant references instead of by value.

Parameters
CLThe name of the xAOD class
TYPEThe (complex) type name
NAMEThe name of the auxiliary variable
SETTERThe name of the "setter function"
VARNAMEThe auxiliary variable name.

If TYPE is an instance of SG::JaggedVecElt<T>, then accessors will be generated handling jagged vector variables. In that case, the read accessor will return type SG::ConstAccessor<T>::const_reference_type (which is the same as SG::ConstAccessor<T>::const_reference_type), and the write accessor will take type std::span<const T>.

If TYPE is an instance of SG::PackedLink<T>, then accessors will be generated handling packed link variables. In that case, the read accessor will return type ElementLink<T>, and the write accessor will take type const ElementLink<T>&.

Definition at line 117 of file AuxStoreAccessorMacros.h.

117#define AUXSTORE_OBJECT_SETTER_AND_GETTER_VARNAME(CL, TYPE, NAME, SETTER, VARNAME) \
118 AUXSTORE_OBJECT_GETTER_VARNAME(CL, TYPE, NAME, VARNAME) \
119 void CL::SETTER( typename SG::Accessor< TYPE >::rhs_const_reference_type value ) { \
120 static const SG::Accessor< TYPE > acc( #VARNAME ); \
121 acc( *this ) = value; \
122 return; \
123 }

◆ AUXSTORE_PRIMITIVE_GETTER

#define AUXSTORE_PRIMITIVE_GETTER ( CL,
TYPE,
NAME )
Value:
TYPE CL::NAME() const { \
static const SG::Accessor< TYPE > acc( #NAME ); \
return acc( *this ); \
}

Macro creating the reader function for a primitive auxiliary property.

This macro is a simplified version of the previous one. It just provides the accessor function for reading an auxiliary variable. It can be useful when setting an auxiliary variable is done in a more involved function, but reading it is done through a simple accessor function.

Parameters
CLThe name of the xAOD class
TYPEThe (primitive) type name
NAMEThe name of the auxiliary variable

Definition at line 59 of file AuxStoreAccessorMacros.h.

59#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME ) \
60 TYPE CL::NAME() const { \
61 static const SG::Accessor< TYPE > acc( #NAME ); \
62 return acc( *this ); \
63 }

◆ AUXSTORE_PRIMITIVE_GETTER_WITH_CAST

#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST ( CL,
PERSTYPE,
TRANSTYPE,
NAME )
Value:
TRANSTYPE CL::NAME() const { \
static const SG::Accessor< PERSTYPE > acc( #NAME ); \
return static_cast< TRANSTYPE >( acc( *this ) ); \
}

Macro creating a getter function with a type conversion.

In a number of cases we use a different primitive type in the interface classes than what we end up putting into the auxiliary store. In most cases we do double<->float, and enum<->int conversions in these cases.

This macro can be used to slightly lower the number of lines needed for implementing such a function.

Parameters
CLThe name of the xAOD class
PERSTYPEThe persistent (primitive) type name
TRANSTYPEThe transient (primitive) type name
NAMEThe name of the auxiliary variable

Definition at line 209 of file AuxStoreAccessorMacros.h.

◆ AUXSTORE_PRIMITIVE_SETTER_AND_GETTER

#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER ( CL,
TYPE,
NAME,
SETTER )
Value:
TYPE CL::NAME() const { \
static const SG::Accessor< TYPE > acc( #NAME ); \
return acc( *this ); \
} \
void CL::SETTER( TYPE value ) { \
static const SG::Accessor< TYPE > acc( #NAME ); \
acc( *this ) = value; \
return; \
}

Macro creating the accessors of primitive auxiliary properties.

The idea with this macro is to save ourselves a bit of time and typing. The macro assumes that for a given auxiliary variable, like a floating point variable of name "sthg", we define the functions:

float sthg() const;
void setSthg( float value );

in the xAOD class's header. This macro provides the implementation code for these two functions.

So, in the previous case, we would use: AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( Dummy, float, sthg, setSthg )

Parameters
CLThe name of the xAOD class
TYPEThe (primitive) type name
NAMEThe name of the auxiliary variable
SETTERThe name of the "setter function"

Definition at line 36 of file AuxStoreAccessorMacros.h.

◆ AUXSTORE_PRIMITIVE_SETTER_WITH_CAST

#define AUXSTORE_PRIMITIVE_SETTER_WITH_CAST ( CL,
PERSTYPE,
TRANSTYPE,
NAME,
SETTER )
Value:
void CL::SETTER( TRANSTYPE value ) { \
static const SG::Accessor< PERSTYPE > acc( #NAME ); \
acc( *this ) = static_cast< PERSTYPE >( value ); \
return; \
}

Macro creating a setter function with a type conversion.

In a number of cases we use a different primitive type in the interface classes than what we end up putting into the auxiliary store. In most cases we do double<->float, and enum<->int conversions in these cases.

This macro can be used to slightly lower the number of lines needed for implementing such a function.

Parameters
CLThe name of the xAOD class
PERSTYPEThe persistent (primitive) type name
TRANSTYPEThe transient (primitive) type name
NAMEThe name of the auxiliary variable

Definition at line 230 of file AuxStoreAccessorMacros.h.