ATLAS Offline Software
IdDictField.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef IDDICT_IdDictField_H
6 #define IDDICT_IdDictField_H
7 
9 #include <string>
10 #include <vector>
11 #include <memory>
12 
13 class IdDictLabel;
14 class IdDictMgr;
15 
16 class IdDictField {
17 public:
18  // ==================================
19  //** @name Constructor/destructor
20  // @{
21 
22  IdDictField (const std::string& name);
26 
27  IdDictField (const IdDictField&) = delete;
28  IdDictField& operator= (const IdDictField&) = delete;
29 
30 
31  // @}
32  // ==================================
33  //** @name Simple accessors.
34  // @{
35 
36  const std::string& name() const;
37  size_t index() const;
38  size_t get_label_number () const;
39  const IdDictLabel* find_label (const std::string& name) const;
40  const IdDictLabel& label (size_t index) const;
41  const std::string& get_label (size_t index) const;
42  ExpandedIdentifier::element_type get_label_value (const std::string& name) const;
43 
44 
46  // ==================================
47  //** @name Methods used to initialize the object.
48  // @{
49 
50  void add_label (std::unique_ptr<const IdDictLabel> label);
51  void set_index (size_t index);
52  bool verify () const;
53  void clear ();
54 
55 
57 
58 
59 private:
60  std::string m_name;
61  std::vector <std::unique_ptr<const IdDictLabel> > m_labels;
62  size_t m_index{};
63 };
64 
65 
66 inline
67 const std::string& IdDictField::name() const
68 {
69  return m_name;
70 }
71 
72 
73 inline
74 size_t IdDictField::index() const
75 {
76  return m_index;
77 }
78 
79 
80 inline
81 const IdDictLabel& IdDictField::label (size_t index) const
82 {
83  return *m_labels.at(index);
84 }
85 
86 
87 #endif
IdDictField::set_index
void set_index(size_t index)
Definition: IdDictField.cxx:41
IdDictField::m_index
size_t m_index
Definition: IdDictField.h:62
IdDictField::operator=
IdDictField & operator=(IdDictField &&)
IdDictField::get_label
const std::string & get_label(size_t index) const
Definition: IdDictField.cxx:51
IdDictField::add_label
void add_label(std::unique_ptr< const IdDictLabel > label)
Definition: IdDictField.cxx:36
index
Definition: index.py:1
IdDictField::clear
void clear()
Definition: IdDictField.cxx:83
ExpandedIdentifier.h
IdDictField::m_labels
std::vector< std::unique_ptr< const IdDictLabel > > m_labels
Definition: IdDictField.h:61
IdDictField::index
size_t index() const
Definition: IdDictField.h:74
IdDictField::IdDictField
IdDictField(const IdDictField &)=delete
IdDictField::label
const IdDictLabel & label(size_t index) const
Definition: IdDictField.h:81
IdDictField::IdDictField
IdDictField(IdDictField &&)
IdDictLabel
Definition: IdDictLabel.h:10
IdDictMgr
Definition: IdDictMgr.h:16
IdDictField::m_name
std::string m_name
Definition: IdDictField.h:60
IdDictField::get_label_number
size_t get_label_number() const
Definition: IdDictField.cxx:46
IdDictField::verify
bool verify() const
Definition: IdDictField.cxx:24
IdDictField::name
const std::string & name() const
Definition: IdDictField.h:67
IdDictField::get_label_value
ExpandedIdentifier::element_type get_label_value(const std::string &name) const
Definition: IdDictField.cxx:61
IdDictField::IdDictField
IdDictField(const std::string &name)
Definition: IdDictField.cxx:12
IdDictField
Definition: IdDictField.h:16
ExpandedIdentifier::element_type
int element_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:106
IdDictField::find_label
const IdDictLabel * find_label(const std::string &name) const
Definition: IdDictField.cxx:28
IdDictField::~IdDictField
~IdDictField()