ATLAS Offline Software
Loading...
Searching...
No Matches
CLIDRegistry.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
3 */
4
5#ifndef ATHENAKERNEL_CLIDREGISTRY_H
6# define ATHENAKERNEL_CLIDREGISTRY_H
13
14#include "GaudiKernel/ClassID.h"
15
16#include <vector>
17#include <string>
18#include <tuple>
19#include <typeinfo>
20
21namespace CLIDdetail {
23
24 const unsigned long MINCLID = 256;
25 const unsigned long MAXCLID = 2147483647;
27}
28
30
36public:
37 typedef std::tuple <unsigned long,
38 std::string,
39 std::string> tuple_t;
40 typedef std::vector< tuple_t > CLIDVector_t;
41
43 template <unsigned long CLID>
44 static bool addEntry(const std::type_info& ti,
45 const char* typeName,
46 const std::string& typeInfoName);
47
49
50
51 static bool hasNewEntries();
54 static CLIDVector_t newEntries();
56
58 static const std::type_info* CLIDToTypeinfo (CLID clid);
59 static CLID typeinfoToCLID (const std::type_info& ti);
60
61
63 static bool addEntry (unsigned long clid,
64 const std::type_info& ti,
65 const char* typeName,
66 const std::string& typeInfoName);
67
68private:
69 static CLIDRegistryImpl& impl();
70};
71
72
73template <unsigned long CLID>
74bool CLIDRegistry::addEntry(const std::type_info& ti,
75 const char* typeName,
76 const std::string& typeInfoName) {
77 static_assert (CLIDdetail::MINCLID <= CLID && CLID <= CLIDdetail::MAXCLID,
78 "CLID out of CLIDRegistry range");
79
80 addEntry (CLID, ti, typeName, typeInfoName);
81 return true;
82}
83
84
85#endif // ATHENAKERNEL_CLIDREGISTRY_H
uint32_t CLID
The Class ID type.
a static registry of CLID->typeName entries.
static bool addEntry(const std::type_info &ti, const char *typeName, const std::string &typeInfoName)
to be called by the CLASS_DEFS
static CLIDRegistryImpl & impl()
static CLID typeinfoToCLID(const std::type_info &ti)
Return the CLID corresponding to a type_info.
static const std::type_info * CLIDToTypeinfo(CLID clid)
Translate between CLID and type_info.
std::vector< tuple_t > CLIDVector_t
static bool hasNewEntries()
registry accessors (used by ClassIDSvc)
std::tuple< unsigned long, std::string, std::string > tuple_t
static CLIDVector_t newEntries()
returns an iterator range over the entries added since last time newEntries was called
const unsigned long MINCLID
const unsigned long MAXCLID
2**31 - 1