Skip to content
Snippets Groups Projects
Commit af89a7c5 authored by Scott Snyder's avatar Scott Snyder Committed by Frank Winklmeier
Browse files

xAODMetaData: Use Accessor, etc instead of auxdata().

xAODMetaData: Use Accessor, etc instead of auxdata().

Replace auxdata, etc. with Accessor classes.
Moving to deprecate these usages in the Athena build.
parent bf54abc5
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@
// Core include(s):
#include "AthContainers/AuxTypeRegistry.h"
#include "AthContainers/normalizedTypeinfoName.h"
#include "AthContainers/ConstAccessor.h"
// Local include(s):
#include "xAODMetaData/versions/FileMetaData_v1.h"
......@@ -76,8 +77,9 @@ namespace xAOD {
if( *ti == typeid( std::string ) ) {
// Retrieve the values:
const std::string& value1 = this->auxdata< std::string >( name );
const std::string& value2 = rhs.auxdata< std::string >( name );
SG::ConstAccessor< std::string >acc( name );
const std::string& value1 = acc( *this );
const std::string& value2 = acc( rhs );
// And simply compare them:
if( value1 != value2 ) {
return false;
......@@ -86,8 +88,9 @@ namespace xAOD {
} else if( *ti == typeid( uint32_t ) ) {
// Retrieve the values:
const uint32_t& value1 = this->auxdata< uint32_t >( name );
const uint32_t& value2 = rhs.auxdata< uint32_t >( name );
SG::ConstAccessor< uint32_t >acc( name );
const uint32_t& value1 = acc( *this );
const uint32_t& value2 = acc( rhs );
// And simply compare them:
if( value1 != value2 ) {
return false;
......@@ -96,8 +99,9 @@ namespace xAOD {
} else if( *ti == typeid( float ) ) {
// Retrieve the values:
const float& value1 = this->auxdata< float >( name );
const float& value2 = rhs.auxdata< float >( name );
SG::ConstAccessor< float >acc( name );
const float& value1 = acc( *this );
const float& value2 = acc( rhs );
// And (not so simply) compare them:
if( std::abs( value1 - value2 ) > 0.001 ) {
return false;
......@@ -106,18 +110,18 @@ namespace xAOD {
} else if( *ti == typeid( char ) ) {
// Retrieve the values:
const char& value1 = this->auxdata< char >( name );
const char& value2 = rhs.auxdata< char >( name );
SG::ConstAccessor< char >acc( name );
const char& value1 = acc( *this );
const char& value2 = acc( rhs );
// And (not so simply) compare them:
if( value1 != value2 ) {
return false;
}
} else if ( *ti == typeid( std::vector<uint32_t> ) ) {
// One code to retrieve them
const std::vector<uint32_t>& value1 =
this->auxdata< std::vector<uint32_t> >(name);
const std::vector<uint32_t>& value2 =
rhs.auxdata< std::vector<uint32_t> >(name);
SG::ConstAccessor< std::vector<uint32_t> >acc( name );
const std::vector<uint32_t>& value1 = acc( *this );
const std::vector<uint32_t>& value2 = acc( rhs );
// and in simplicity compare them
if( value1 != value2 ) {
return false;
......
/*
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
*/
///
......@@ -16,6 +16,7 @@
// Local include(s):
#include "xAODMetaData/FileMetaData.h"
#include "AthContainers/ConstAccessor.h"
/// Helper macro for evaluating logical tests
#define SIMPLE_ASSERT( EXP ) \
......@@ -142,8 +143,9 @@ int main() {
// the code complains about them. But still lets the equivalence stand.
SIMPLE_ASSERT( meta2.setValue( "AnalysisValue", 1.2f ) == true );
SIMPLE_ASSERT( meta1 == meta2 );
meta1.auxdata< int >( "IntValue" ) = 1;
meta2.auxdata< int >( "IntValue" ) = 2;
SG::Accessor< int >IntValue( "IntValue" );
IntValue( meta1 ) = 1;
IntValue( meta2 ) = 2;
SIMPLE_ASSERT( meta1 == meta2 );
// Tell the user that everything went successfully:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment