ATLAS Offline Software
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
IdDictRange Class Reference

#include <IdDictDefs.h>

Inheritance diagram for IdDictRange:
Collaboration diagram for IdDictRange:

Public Types

enum  specification_type {
  unknown, by_value, by_values, by_label,
  by_labels, by_minvalue, by_maxvalue, by_minmax
}
 
enum  continuation_mode {
  none, has_next, has_previous, has_both,
  wrap_around
}
 

Public Member Functions

 IdDictRange ()=default
 
 ~IdDictRange ()=default
 
void resolve_references (const IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region)
 
void generate_implementation (const IdDictMgr &idd, IdDictDictionary &dictionary, IdDictRegion &region, const std::string &tag="")
 
Range build_range () const
 
virtual void reset_implementation ()
 
virtual bool verify () const
 
virtual void clear ()
 

Public Attributes

std::string m_field_name
 
IdDictFieldm_field {}
 
specification_type m_specification {unknown}
 
std::string m_tag
 
std::string m_label
 
int m_value {}
 
int m_minvalue {}
 
int m_maxvalue {}
 
int m_prev_value {}
 
int m_next_value {}
 
continuation_mode m_continuation_mode {none}
 
std::vector< std::string > m_labels
 
std::vector< int > m_values
 

Private Attributes

bool m_resolved_references {}
 

Detailed Description

Definition at line 523 of file IdDictDefs.h.

Member Enumeration Documentation

◆ continuation_mode

Enumerator
none 
has_next 
has_previous 
has_both 
wrap_around 

Definition at line 551 of file IdDictDefs.h.

551  {
552  none,
553  has_next,
554  has_previous,
555  has_both,
557  };

◆ specification_type

Enumerator
unknown 
by_value 
by_values 
by_label 
by_labels 
by_minvalue 
by_maxvalue 
by_minmax 

Definition at line 540 of file IdDictDefs.h.

540  {
541  unknown,
542  by_value,
543  by_values,
544  by_label,
545  by_labels,
546  by_minvalue,
547  by_maxvalue,
548  by_minmax
549  } ;

Constructor & Destructor Documentation

◆ IdDictRange()

IdDictRange::IdDictRange ( )
default

◆ ~IdDictRange()

IdDictRange::~IdDictRange ( )
default

Member Function Documentation

◆ build_range()

Range IdDictRange::build_range ( ) const
virtual

Implements IdDictRegionEntry.

Definition at line 2609 of file IdDictMgr.cxx.

2609  {
2610  Range result;
2612  switch (m_specification) {
2613  case by_value:
2614  case by_label:{
2615  field.set (m_value, m_value);
2616  break;
2617  }
2618  case by_values:
2619  case by_labels:{
2621  v.insert(v.end(), m_values.begin(), m_values.end());
2622  field.set (v);
2623  break;
2624  }
2625  case by_minvalue:{
2626  field.set_minimum (m_minvalue);
2627  break;
2628  }
2629  case by_maxvalue:{
2630  field.set_maximum (m_maxvalue);
2631  break;
2632  }
2633  case by_minmax:{
2634  field.set (m_minvalue, m_maxvalue);
2635  break;
2636  }
2637  case unknown:{
2638  break;
2639  }
2640  }
2642  field.set(true);
2643  } else if (has_previous == m_continuation_mode) {
2644  field.set_previous(m_prev_value);
2645  } else if (has_next == m_continuation_mode) {
2646  field.set_next(m_next_value);
2647  } else if (has_both == m_continuation_mode) {
2648  field.set_previous(m_prev_value);
2649  field.set_next(m_next_value);
2650  }
2651  result.add (std::move(field));
2652  return (result);
2653 }

◆ clear()

virtual void IdDictRegionEntry::clear ( )
inlinevirtualinherited

Definition at line 519 of file IdDictDefs.h.

519 {/*default is noop*/}

◆ generate_implementation()

void IdDictRange::generate_implementation ( const IdDictMgr idd,
IdDictDictionary dictionary,
IdDictRegion region,
const std::string &  tag = "" 
)
virtual

Reimplemented from IdDictRegionEntry.

Definition at line 2538 of file IdDictMgr.cxx.

2539  {
2540 
2541  // Add IdDictFieldImplementation to this region
2542 
2543  // NOTE: we DO NOT protect this method with
2544  // m_generated_implementation because the same object may be
2545  // called more than once because there are IdDictRangeRef's which
2546  // point to the same IdDictRange's.
2547 
2548  if (Debugger::debug ()) {
2549  std::cout << "IdDictRange::generate_implementation>" << std::endl;
2550  }
2551 
2552  region.m_implementation.resize (region.m_implementation.size () + 1);
2553  IdDictFieldImplementation& impl = region.m_implementation.back ();
2554  impl.set_range(this);
2555  if (m_field->m_index == 0) {
2556  m_field->m_index = region.m_implementation.size () - 1;
2557 
2558  } else if (m_field->m_index != (region.m_implementation.size () - 1)) {
2559  std::cout << "Bad field index for " << m_field_name
2560  << " index " << m_field->m_index
2561  << " in dictionary " << dictionary.m_name
2562  << " region #" << region.m_index
2563  << " size " << (region.m_implementation.size () - 1)
2564  << std::endl;
2565  }
2566 
2567  size_t index = region.m_implementation.size () - 1;
2568  if (region.m_implementation.size () <= index) {
2569  std::cout << "IdDictRange::generate_implementation: index >= impl size - "
2570  << index << " " << region.m_implementation.size ()
2571  << std::endl;
2572  return;
2573  }
2574 
2576  switch (m_specification) {
2577  case by_value:
2578  case by_label: {
2579  impl.set_field(Range::field(m_value, m_value));
2580  break;
2581  }
2582  case by_values:
2583  case by_labels: {
2585  v.insert(v.end(), m_values.begin(), m_values.end());
2586  field.set(v);
2587  impl.set_field(field);
2588  }
2589  break;
2590  case by_minvalue:
2591  field.set_minimum (m_minvalue);
2592  impl.set_field(field);
2593  break;
2594  case by_maxvalue:
2595  field.set_maximum (m_maxvalue);
2596  impl.set_field(field);
2597  break;
2598  case by_minmax:
2599  field.set (m_minvalue, m_maxvalue);
2600  impl.set_field(field);
2601  break;
2602  case unknown:
2603  break;
2604  }
2605 }

◆ reset_implementation()

virtual void IdDictRegionEntry::reset_implementation ( )
inlinevirtualinherited

Reimplemented in IdDictDictionaryRef, IdDictReference, and IdDictRangeRef.

Definition at line 517 of file IdDictDefs.h.

517 { /*default is noop*/}

◆ resolve_references()

void IdDictRange::resolve_references ( const IdDictMgr idd,
IdDictDictionary dictionary,
IdDictRegion region 
)
virtual

The range values were unspecified in the range element.

Therefore, the set of values must be obtained from the field definition (if it exists!!).

If the field is undefined, then too bad, this range will be dummy.

Reimplemented from IdDictRegionEntry.

Definition at line 2491 of file IdDictMgr.cxx.

2492  {
2493  if(!m_resolved_references) {
2494  m_field = dictionary.find_field (m_field_name);
2495  if (m_field == nullptr) {
2496  m_field = new IdDictField;
2498  dictionary.add_field (m_field);
2499  }
2500 
2501  if (m_specification == unknown) {
2511  unsigned int labels = m_field->get_label_number ();
2512  if (labels == 1) {
2514  m_label = m_field->get_label (0);
2515  } else if (labels > 1) {
2517  for (size_t i = 0; i < labels; ++i) {
2518  m_labels.push_back (m_field->get_label (i));
2519  }
2520  }
2521  }
2522 
2523  if (m_specification == by_label) {
2525  } else if (m_specification == by_labels) {
2526  m_values.clear ();
2527  for (size_t i = 0; i < m_labels.size (); ++i) {
2528  const std::string& label = m_labels[i];
2529  int value = m_field->get_label_value (label);
2530  m_values.push_back (value);
2531  }
2532  }
2533  m_resolved_references = true;
2534  }
2535 }

◆ verify()

virtual bool IdDictRegionEntry::verify ( ) const
inlinevirtualinherited

Reimplemented in IdDictDictionaryRef, IdDictReference, and IdDictRangeRef.

Definition at line 518 of file IdDictDefs.h.

518 {return true;}

Member Data Documentation

◆ m_continuation_mode

continuation_mode IdDictRange::m_continuation_mode {none}

Definition at line 568 of file IdDictDefs.h.

◆ m_field

IdDictField* IdDictRange::m_field {}

Definition at line 538 of file IdDictDefs.h.

◆ m_field_name

std::string IdDictRange::m_field_name

Definition at line 537 of file IdDictDefs.h.

◆ m_label

std::string IdDictRange::m_label

Definition at line 562 of file IdDictDefs.h.

◆ m_labels

std::vector<std::string> IdDictRange::m_labels

Definition at line 569 of file IdDictDefs.h.

◆ m_maxvalue

int IdDictRange::m_maxvalue {}

Definition at line 565 of file IdDictDefs.h.

◆ m_minvalue

int IdDictRange::m_minvalue {}

Definition at line 564 of file IdDictDefs.h.

◆ m_next_value

int IdDictRange::m_next_value {}

Definition at line 567 of file IdDictDefs.h.

◆ m_prev_value

int IdDictRange::m_prev_value {}

Definition at line 566 of file IdDictDefs.h.

◆ m_resolved_references

bool IdDictRange::m_resolved_references {}
private

Definition at line 573 of file IdDictDefs.h.

◆ m_specification

specification_type IdDictRange::m_specification {unknown}

Definition at line 559 of file IdDictDefs.h.

◆ m_tag

std::string IdDictRange::m_tag

Definition at line 561 of file IdDictDefs.h.

◆ m_value

int IdDictRange::m_value {}

Definition at line 563 of file IdDictDefs.h.

◆ m_values

std::vector<int> IdDictRange::m_values

Definition at line 570 of file IdDictDefs.h.


The documentation for this class was generated from the following files:
IdDictField::m_index
size_t m_index
Definition: IdDictDefs.h:331
IdDictField::get_label
const std::string & get_label(size_t index) const
Definition: IdDictMgr.cxx:1936
get_generator_info.result
result
Definition: get_generator_info.py:21
IdDictRange::by_minmax
@ by_minmax
Definition: IdDictDefs.h:548
index
Definition: index.py:1
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
IdDictRange::by_label
@ by_label
Definition: IdDictDefs.h:544
IdDictRange::m_field_name
std::string m_field_name
Definition: IdDictDefs.h:537
IdDictRange::by_labels
@ by_labels
Definition: IdDictDefs.h:545
athena.value
value
Definition: athena.py:124
IdDictRange::none
@ none
Definition: IdDictDefs.h:552
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
IdDictRange::m_specification
specification_type m_specification
Definition: IdDictDefs.h:559
IdDictRange::m_field
IdDictField * m_field
Definition: IdDictDefs.h:538
IdDictRange::has_previous
@ has_previous
Definition: IdDictDefs.h:554
IdDictRange::by_minvalue
@ by_minvalue
Definition: IdDictDefs.h:546
beamspotnt.labels
list labels
Definition: bin/beamspotnt.py:1447
IdDictRegion::m_index
size_t m_index
Definition: IdDictDefs.h:460
IdDictRange::m_maxvalue
int m_maxvalue
Definition: IdDictDefs.h:565
lumiFormat.i
int i
Definition: lumiFormat.py:85
IdDictField::m_name
std::string m_name
Definition: IdDictDefs.h:329
IdDictRange::has_both
@ has_both
Definition: IdDictDefs.h:555
IdDictRange::m_prev_value
int m_prev_value
Definition: IdDictDefs.h:566
IdDictField::get_label_number
size_t get_label_number() const
Definition: IdDictMgr.cxx:1931
IdDictRange::by_maxvalue
@ by_maxvalue
Definition: IdDictDefs.h:547
IdDictRange::unknown
@ unknown
Definition: IdDictDefs.h:541
IdDictRange::m_value
int m_value
Definition: IdDictDefs.h:563
Debugger::debug
static bool debug()
Definition: IdDictMgr.cxx:28
IdDictField::get_label_value
ExpandedIdentifier::element_type get_label_value(const std::string &name) const
Definition: IdDictMgr.cxx:1941
IdentifierField::element_vector
std::vector< element_type > element_vector
Definition: IdentifierField.h:23
master.dictionary
dictionary
Definition: master.py:47
IdDictRange::m_labels
std::vector< std::string > m_labels
Definition: IdDictDefs.h:569
IdDictRange::has_next
@ has_next
Definition: IdDictDefs.h:553
Range
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Definition: DetectorDescription/Identifier/Identifier/Range.h:29
IdDictRange::m_continuation_mode
continuation_mode m_continuation_mode
Definition: IdDictDefs.h:568
python.PyAthena.v
v
Definition: PyAthena.py:154
impl
Definition: CaloGPUClusterAndCellDataMonitorOptions.h:46
DeMoScan.index
string index
Definition: DeMoScan.py:364
IdDictRange::m_resolved_references
bool m_resolved_references
Definition: IdDictDefs.h:573
IdentifierField
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
Definition: IdentifierField.h:19
IdDictRange::by_values
@ by_values
Definition: IdDictDefs.h:543
IdDictRange::m_label
std::string m_label
Definition: IdDictDefs.h:562
IdDictRange::by_value
@ by_value
Definition: IdDictDefs.h:542
IdDictField
Definition: IdDictDefs.h:316
IdDictRange::wrap_around
@ wrap_around
Definition: IdDictDefs.h:556
IdDictFieldImplementation
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
Definition: IdDictFieldImplementation.h:58
IdDictRegion::m_implementation
std::vector< IdDictFieldImplementation > m_implementation
Definition: IdDictDefs.h:459
IdDictRange::m_minvalue
int m_minvalue
Definition: IdDictDefs.h:564
IdDictRange::m_next_value
int m_next_value
Definition: IdDictDefs.h:567
IdDictRange::m_values
std::vector< int > m_values
Definition: IdDictDefs.h:570