ATLAS Offline Software
Loading...
Searching...
No Matches
TypeMaps.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGNAVIGATION_TYPEMAPS_H
6#define TRIGNAVIGATION_TYPEMAPS_H
7
8#include <map>
9#include <string>
10#include <memory>
11
12#include "GaudiKernel/ClassID.h"
13
15
18
19namespace HLT {
23 class TypeMaps {
24 public:
25 typedef std::map<CLID, std::unique_ptr<const HLTNavDetails::ITypeProxy>> CLIDtoTypeProxyMap;
26 typedef std::map<CLID, std::unique_ptr<const HLTNavDetails::IHolder>> CLIDtoHolderMap;
27 typedef std::map<std::string, CLID> NametoCLIDMap;
28
29 static const CLIDtoTypeProxyMap& proxies() { return m_proxies; }
30 static const CLIDtoHolderMap& holders() { return m_holders; }
31 static const NametoCLIDMap& type2clid() { return m_type2clid; }
32
33 // The registration methods are invoked at compile-time and we use
34 // a const_cast to fill the otherwise read-only type maps.
35 template<class T>
36 static constexpr void registerType ATLAS_NOT_THREAD_SAFE () {
37 auto& nc_proxies = const_cast<CLIDtoTypeProxyMap&>(m_proxies);
38 auto& nc_types = const_cast<NametoCLIDMap&>(m_type2clid);
39 nc_proxies[ClassID_traits<T>::ID()] = std::make_unique<HLTNavDetails::TypeProxy<T>>();
41 }
42
43 template<class T, class C>
44 static constexpr void registerFeatureContainer ATLAS_NOT_THREAD_SAFE () {
45 auto& nc_holders = const_cast<CLIDtoHolderMap&>(m_holders);
46 nc_holders[ClassID_traits<T>::ID()] = std::make_unique<HLTNavDetails::HolderImp<T, C>>();
47 HLT::TypeMaps::registerType<T>();
48 HLT::TypeMaps::registerType<C>();
49 }
50
51 private:
52 // statically filled by the above registration methods, otherwise const:
53 inline static const CLIDtoTypeProxyMap m_proxies;
54 inline static const CLIDtoHolderMap m_holders;
55 inline static const NametoCLIDMap m_type2clid;
56 };
57}
58
59#endif
Define macros for attributes used to control the static checker.
Type registration of holder, proxies and name/CLID mappings.
Definition TypeMaps.h:23
std::map< std::string, CLID > NametoCLIDMap
Definition TypeMaps.h:27
static const CLIDtoHolderMap m_holders
Definition TypeMaps.h:54
static const NametoCLIDMap m_type2clid
Definition TypeMaps.h:55
static constexpr void registerFeatureContainer ATLAS_NOT_THREAD_SAFE()
Definition TypeMaps.h:44
static const CLIDtoTypeProxyMap & proxies()
Definition TypeMaps.h:29
static const NametoCLIDMap & type2clid()
Definition TypeMaps.h:31
std::map< CLID, std::unique_ptr< const HLTNavDetails::IHolder > > CLIDtoHolderMap
Definition TypeMaps.h:26
static constexpr void registerType ATLAS_NOT_THREAD_SAFE()
Definition TypeMaps.h:36
std::map< CLID, std::unique_ptr< const HLTNavDetails::ITypeProxy > > CLIDtoTypeProxyMap
Definition TypeMaps.h:25
static const CLIDtoTypeProxyMap m_proxies
Definition TypeMaps.h:53
static const CLIDtoHolderMap & holders()
Definition TypeMaps.h:30
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...