1 // Dear emacs, this is -*- c++ -*-
3 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 #ifndef XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_ICC
6 #define XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_ICC
12 #include "AthContainers/AuxTypeRegistry.h"
13 #include "xAODCore/tools/AuxPersVector.h"
14 #include "xAODCore/tools/AuxVariable.h"
18 template< typename T >
19 ByteStreamAuxContainer_v1::auxid_t
20 ByteStreamAuxContainer_v1::getAuxID( const std::string& name,
21 std::vector< T >& /*vec*/,
22 SG::AuxVarFlags flags) {
24 return SG::AuxTypeRegistry::instance().template getAuxID< T >( name, "", flags );
27 /// The user is expected to use this function inside the constructor of
28 /// the derived class.
30 /// @param name The name of the variable. Same as the C++ variable's name.
31 /// @param vec A reference to the auxiliary variable inside the object
33 template< typename T >
34 void ByteStreamAuxContainer_v1::regAuxVar( const auxid_t auxid,
35 const std::string& name,
36 std::vector< T >& vec ) {
38 // Make sure that the internal vector is big enough:
39 if( m_staticVecs.size() <= auxid ) {
40 m_staticVecs.resize( auxid + 1 );
43 // Check if this variable name was already registered:
44 if( m_staticVecs[ auxid ] ) {
45 std::cerr << "WARNING xAOD::AuxContainerBase::regAuxVec "
46 << "Re-registering variable with name \""
47 << name << "\"" << std::endl;
48 delete m_staticVecs[ auxid ];
51 const SG::AuxTypeRegistry& r = SG::AuxTypeRegistry::instance();
52 if (r.isLinked(auxid)) {
53 throw std::runtime_error ("ERROR xAOD::ByteStreamAuxContainer_v1 doesn't implement linked variables");
56 // Register the variable:
57 m_staticVecs[ auxid ] = new AuxPersVector< T >( auxid, vec, false, this );
59 // Remember that we are now handling this variable:
60 m_auxids.insert( auxid );
67 #endif // XAODTRIGGER_VERSIONS_BYTESTREAMAUXCONTAINER_V1_ICC