ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
IdDictField Class Reference

#include <IdDictField.h>

Collaboration diagram for IdDictField:

Public Member Functions

IdDictLabelfind_label (const std::string &name) const
 
void add_label (IdDictLabel *label)
 
size_t get_label_number () const
 
const std::string get_label (size_t index) const
 
ExpandedIdentifier::element_type get_label_value (const std::string &name) const
 
void resolve_references (const IdDictMgr &idd)
 
void generate_implementation (const IdDictMgr &idd, const std::string &tag="")
 
void reset_implementation ()
 
bool verify () const
 
void clear ()
 

Public Attributes

std::string m_name
 
std::vector< IdDictLabel * > m_labels
 
size_t m_index {}
 

Detailed Description

Definition at line 15 of file IdDictField.h.

Member Function Documentation

◆ add_label()

void IdDictField::add_label ( IdDictLabel label)

Definition at line 36 of file IdDictField.cxx.

36  {
37  m_labels.push_back(label);
38 }

◆ clear()

void IdDictField::clear ( )

Definition at line 77 of file IdDictField.cxx.

77  {
78  for (size_t i = 0; i < m_labels.size(); ++i) {
80  delete label;
81  }
82  m_labels.clear();
83 }

◆ find_label()

IdDictLabel * IdDictField::find_label ( const std::string &  name) const

Definition at line 26 of file IdDictField.cxx.

26  {
27  for (size_t i = 0; i < m_labels.size(); ++i) {
29  if ((label != 0) && (label->m_name == name)) return(label);
30  }
31 
32  return(0);
33 }

◆ generate_implementation()

void IdDictField::generate_implementation ( const IdDictMgr idd,
const std::string &  tag = "" 
)

Definition at line 15 of file IdDictField.cxx.

16  {
17 }

◆ get_label()

const std::string IdDictField::get_label ( size_t  index) const

Definition at line 46 of file IdDictField.cxx.

46  {
47  std::string result;
48  try{
49  result = m_labels.at(index)->m_name;
50  } catch (std::out_of_range& e) {
51  throw std::out_of_range(std::format("IdDictField::get_label : Attempt to access index {} in vector of size {}",
52  index, m_labels.size()));
53  }
54  return result;
55 }

◆ get_label_number()

size_t IdDictField::get_label_number ( ) const

Definition at line 41 of file IdDictField.cxx.

41  {
42  return m_labels.size();
43 }

◆ get_label_value()

ExpandedIdentifier::element_type IdDictField::get_label_value ( const std::string &  name) const

Definition at line 58 of file IdDictField.cxx.

58  {
60  try{
61  value = std::stoi(name);
62  return value;
63  } catch (std::invalid_argument& e) {
64  for (const auto* label:m_labels) {
65  if (label == nullptr) continue;
66  if (label->m_valued) value = label->m_value;
67  if (label->m_name == name) {
68  return(value);
69  }
70  value++;
71  }
72  }
73  std::cerr << "Warning : label " << name << " not found" << std::endl;
74  return(0);
75 }

◆ reset_implementation()

void IdDictField::reset_implementation ( )

Definition at line 19 of file IdDictField.cxx.

19  {
20 }

◆ resolve_references()

void IdDictField::resolve_references ( const IdDictMgr idd)

Definition at line 12 of file IdDictField.cxx.

12  {
13 }

◆ verify()

bool IdDictField::verify ( ) const

Definition at line 22 of file IdDictField.cxx.

22  {
23  return(true);
24 }

Member Data Documentation

◆ m_index

size_t IdDictField::m_index {}

Definition at line 30 of file IdDictField.h.

◆ m_labels

std::vector<IdDictLabel*> IdDictField::m_labels

Definition at line 29 of file IdDictField.h.

◆ m_name

std::string IdDictField::m_name

Definition at line 28 of file IdDictField.h.


The documentation for this class was generated from the following files:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
get_generator_info.result
result
Definition: get_generator_info.py:21
vtune_athena.format
format
Definition: vtune_athena.py:14
index
Definition: index.py:1
athena.value
value
Definition: athena.py:124
lumiFormat.i
int i
Definition: lumiFormat.py:85
add-xsec-uncert-quadrature-N.label
label
Definition: add-xsec-uncert-quadrature-N.py:104
IdDictLabel
Definition: IdDictLabel.h:10
IdDictField::m_labels
std::vector< IdDictLabel * > m_labels
Definition: IdDictField.h:29
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ExpandedIdentifier::element_type
int element_type
Definition: DetectorDescription/Identifier/Identifier/ExpandedIdentifier.h:106