ATLAS Offline Software
Macros
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. More...
 
#define AUXSTORE_PRIMITIVE_GETTER(CL, TYPE, NAME)
 Macro creating the reader function for a primitive auxiliary property. More...
 
#define AUXSTORE_OBJECT_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
 Macro creating the accessors of complex auxiliary properties. More...
 
#define AUXSTORE_OBJECT_MOVE(CL, TYPE, NAME, SETTER)
 Macro creating a move accessor for complex auxiliary properties. More...
 
#define AUXSTORE_OBJECT_GETTER(CL, TYPE, NAME)
 Macro creating the reader function for a complex auxiliary property. More...
 
#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME)
 Macro creating a getter function with a type conversion. More...
 
#define AUXSTORE_PRIMITIVE_SETTER_WITH_CAST(CL, PERSTYPE, TRANSTYPE, NAME, SETTER)
 Macro creating a setter function with a type conversion. More...
 

Macro Definition Documentation

◆ AUXSTORE_OBJECT_GETTER

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

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

Definition at line 120 of file AuxStoreAccessorMacros.h.

◆ AUXSTORE_OBJECT_MOVE

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

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 102 of file AuxStoreAccessorMacros.h.

◆ AUXSTORE_OBJECT_SETTER_AND_GETTER

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

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"

Definition at line 78 of file AuxStoreAccessorMacros.h.

◆ AUXSTORE_PRIMITIVE_GETTER

#define AUXSTORE_PRIMITIVE_GETTER (   CL,
  TYPE,
  NAME 
)
Value:
TYPE CL::NAME() const { \
static const 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 60 of file AuxStoreAccessorMacros.h.

◆ AUXSTORE_PRIMITIVE_GETTER_WITH_CAST

#define AUXSTORE_PRIMITIVE_GETTER_WITH_CAST (   CL,
  PERSTYPE,
  TRANSTYPE,
  NAME 
)
Value:
TRANSTYPE CL::NAME() const { \
static const 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 140 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 Accessor< TYPE > acc( #NAME ); \
return acc( *this ); \
} \
void CL::SETTER( TYPE value ) { \
static const 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 37 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 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 161 of file AuxStoreAccessorMacros.h.

SG::Accessor< TYPE >
athena.value
value
Definition: athena.py:124
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
TYPE
#define TYPE(CODE, TYP, IOTYP)
SG::AuxDataTraits::element_type
T element_type
The type the user sees.
Definition: AuxDataTraits.h:43