|
ATLAS Offline Software
|
Go to the documentation of this file.
25 for (
unsigned int i = 0;
i <
str.size(); ++
i) {
26 if (!isdigit(
str[
i]))
return(
false);
28 if (0 ==
str.size())
return(
false);
37 m_generated_implementation(false),
46 std::map <std::string, IdDictField*>::const_iterator
it;
68 if (!idField)
return nullptr;
76 if (!idLabel || !idLabel->
m_valued)
return(1);
83 if (
field == 0)
return;
92 std::map <std::string, IdDictSubRegion*>::const_iterator
it;
109 if ((region != 0) && (region_name == region->
m_name))
return(region);
125 if (subregion == 0)
return;
144 group->add_dictentry(region);
153 field->resolve_references(idd);
169 (*it)->resolve_references(idd, *
this,
index);
175 const std::string&
tag) {
177 std::cout <<
"IdDictDictionary::generate_implementation>" << std::endl;
185 (*it)->generate_implementation(idd, *
this,
tag);
189 for (
it1 = regions.begin();
it1 != regions.end(); ++
it1) {
202 if (
"dummy" == (*it)->name())
continue;
214 (*itr)->find_neighbours(*
this);
226 (*it)->reset_implementation();
244 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
270 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
284 size_t bits_offset = 0;
287 impl.set_bits_offset(bits_offset);
288 bits_offset +=
impl.bits();
292 if ((not
field.isBounded()) || (0 !=
field.get_minimum())) {
293 impl.set_decode_index(
true);
309 for (
unsigned int i = 0;
i < group_mr.
size(); ++
i) {
320 const std::string& last_field)
const {
324 if (
"" == last_field) {
330 if (
"dummy" == region.
m_name)
continue;
346 if (
"dummy" == region.
m_name)
continue;
359 std::vector <IdDictFieldImplementation>::const_iterator
fit;
366 new_range.
add(
impl.range()->build_range());
368 if (last_field ==
impl.range()->m_field->m_name) {
372 result.add(std::move(new_range));
383 const std::string& last_field)
const {
387 if (
"" == last_field) {
393 if (
"dummy" == region.
m_name)
continue;
409 if (
"dummy" == region.
m_name)
continue;
422 std::vector <IdDictFieldImplementation>::const_iterator
fit;
429 new_range.
add(
impl.range()->build_range());
431 if (last_field ==
impl.range()->m_field->m_name) {
435 result.add(std::move(new_range));
491 bool selected =
true;
504 if (!
impl.field().match(
id[
i])) {
518 if (0 == position &&
impl.bits() > 0) {
522 position -=
impl.bits();
523 packedId |= (
index << position);
539 size_t first_field_index)
const {
545 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
552 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
553 << region_index <<
" " <<
m_regions.size() << std::endl;
564 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
568 if (
index1 < first_field_index) {
569 std::cout <<
"IdDictDictionary::pack32 - first_field_index > index1 "
570 << first_field_index <<
" " <<
index1 << std::endl;
577 if (!first_field_index) {
579 position -=
impl.bits_offset();
582 size_t field_index = 0;
588 if (!
impl.ored_field().match(
fields[field_index])) {
589 std::cout <<
"IdDictDictionary::pack32 - field does NOT match: value, allowed values "
590 <<
fields[field_index] <<
" " << (std::string)
impl.ored_field()
597 if (0 == position &&
impl.bits() > 0) {
598 std::cout <<
"IdDictDictionary::pack32 - going past 0" << std::endl;
604 if (
impl.decode_index()) {
610 position -=
impl.bits();
611 packedId |= (
index << position);
630 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
637 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
638 << region_index <<
" " <<
m_regions.size() << std::endl;
649 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
655 size_t field_index = 0;
674 #if defined(FLATTEN) && defined(__GNUC__)
690 if (0 < localPrefix.
fields()) unpackedId = localPrefix;
701 bool selected =
false;
711 if (
i >= localPrefix.
fields()) {
723 if (!
impl.field().match(localPrefix[
i])) {
740 if (
impl.bits() == 0)
continue;
744 if (position <
impl.bits())
break;
747 if (
index >=
impl.ored_field().get_indices()) {
778 position -=
impl.bits();
803 const std::string&
sep,
804 std::string& unpackedId)
const {
817 bool selected =
false;
827 if (
i >= localPrefix.
fields()) {
839 if (!
impl.field().match(localPrefix[
i])) {
858 if (
impl.bits() == 0)
continue;
862 if (position <
impl.bits())
break;
865 if (
index >=
impl.ored_field().get_indices()) {
886 std::string str_value(
"nil");
898 switch (
range->m_specification) {
901 str_value =
range->m_field->m_name +
' ';
902 sprintf(temp,
"%d",
value);
911 str_value +=
range->m_field->m_name +
' ';
913 str_value +=
range->m_label;
922 if (
label->m_valued) {
923 str_value +=
range->m_label;
938 if (index1 < range->m_labels.size()) {
940 str_value +=
range->m_field->m_name +
' ';
944 std::cout <<
"IdDictDictionary::unpack - Could not find value." << std::endl;
945 std::cout <<
"value " <<
value << std::endl;
946 std::cout <<
"field values " << std::endl;
947 for (
unsigned int i = 0;
i <
range->m_values.size(); ++
i) {
948 std::cout <<
range->m_values[
i] <<
" ";
950 std::cout << std::endl;
957 std::cout <<
"unknown" << std::endl;
964 unpackedId += str_value;
967 position -=
impl.bits();
992 size_t first_field_index,
1001 std::cout <<
"IdDictDictionary::unpack - region index too large. Index, nregions "
1002 << region_index <<
" " <<
m_regions.size() << std::endl;
1012 std::cout <<
"IdDictDictionary::unpack - field index too large. Index, nfields "
1020 size_t prefix_offset = 0;
1025 if (first_field_index) {
1028 std::cout <<
"IdDictDictionary::unpack - first_field_index too large. Index, nfields "
1040 if (
impl.bits() == 0) {
1041 std::cout <<
"IdDictDictionary::unpack - no bits for this field. Region, field indexes "
1042 << region_index <<
" " << field_index << std::endl;
1047 if (
impl.bits() +
impl.bits_offset() - prefix_offset > position) {
1048 std::cout <<
"IdDictDictionary::unpack - bits + offset too large. Region, field indexes, bits, offset "
1049 << region_index <<
" " << field_index <<
" "
1050 <<
impl.bits() <<
" " <<
impl.bits_offset() <<
" " << prefix_offset
1059 size_t index =
id.extract(position -=
impl.bits() +
impl.bits_offset() - prefix_offset,
mask);
1079 size_t first_field_index,
1080 size_t begin_field_index,
1081 size_t end_field_index,
1082 size_t region_index,
1086 std::cout <<
"IdDictDictionary::copy - region index too large. Index, nregions "
1087 << region_index <<
" " <<
m_regions.size() << std::endl;
1096 std::cout <<
"IdDictDictionary::copy - field index too large. Indexes first, begin, end, nfields "
1097 << first_field_index <<
" "
1098 << begin_field_index <<
" "
1099 << end_field_index <<
" "
1105 size_t missing_offset = 0;
1106 if (first_field_index) {
1107 if (first_field_index > begin_field_index) {
1108 std::cout <<
"IdDictDictionary::copy - first_field_index > begin_field_index. Indexes "
1109 << first_field_index <<
" " << begin_field_index << std::endl;
1116 size_t prefix_offset = 0;
1117 if (begin_field_index) {
1118 if (begin_field_index > end_field_index) {
1119 std::cout <<
"IdDictDictionary::copy - begin_field_index > end_field_index. Indexes "
1120 << begin_field_index <<
" " << end_field_index << std::endl;
1128 size_t suffix_offset =
impl.bits() +
impl.bits_offset();
1132 if (position < prefix_offset - missing_offset) {
1133 std::cout <<
"IdDictDictionary::copy - position < prefix + missing. "
1134 << prefix_offset <<
" " << missing_offset << std::endl;
1139 if (position < suffix_offset + missing_offset) {
1140 std::cout <<
"IdDictDictionary::copy - position < suffix + missing. "
1141 << suffix_offset <<
" " << missing_offset << std::endl;
1151 prefix_offset ? (
static_cast<Identifier::value_type>(1) << (position - prefix_offset + missing_offset)) - 1 : 0;
1156 mask -= prefix_mask + suffix_mask;
1213 if (
mr.has_overlap())
return(
false);
1232 std::map< ExpandedIdentifier, IdDictDictEntry* > regions;
1240 std::cout <<
"IdDictDictionary::sort - WARNING verify is FALSE - cannot sort "
JetConstituentVector::iterator iterator
IdDictRegion * find_region(const std::string ®ion_name) const
MultiRange build_multirange() const
Get MultiRange for full dictionary.
int unpack(const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const
Unpack the value_type id to an expanded Identifier, considering the provided prefix (result will incl...
void resolve_references(const IdDictMgr &idd, IdDictDictionary &dictionary)
int reset(size_t index1, size_t index2, size_t region_index, Identifier &packedId) const
Reset fields from index1 to index2.
bool do_neighbours(void) const
Neighbour initialization is performed by default One can switch or query this mode for any idHelper w...
void generate_implementation(const IdDictMgr &idd, const std::string &tag="")
std::vector< IdDictGroup * > m_groups
bool do_checks(void) const
Checks are performed by default in debug compilation and NOT in optimized compilation.
void get_bits(const RV ®ions, size_t level, const std::string &group)
IdDictLabel * find_label(const std::string &field, const std::string &label) const
value_type mask_shift(value_type mask, size_type shift) const
extract field(s) by masking first, then shifting
groups_type::const_iterator groups_const_it
void add(element_type value)
Append a value into a new field.
std::vector< IdDictRegion * > regions_type
IdDictLabel * find_label(const std::string &name) const
int pack32(const ExpandedIdentifier &id, size_t index1, size_t index2, Identifier &packedId) const
Pack to 32bits the subset of id between (inclusive) index1 and index2 - this is generic,...
IdDictField * find_field(const std::string &name) const
void resolve_references(const IdDictMgr &idd)
bool verify() const
Here, we verify global constraints : (this must only be applied after the resolve_references and gene...
void reset_implementation()
IdDictDictionary * m_parent_dict
Identifier::size_type size_type
groups_type::iterator groups_it
std::map< std::string, IdDictField * > m_fields
IdDictGroup * find_group(const std::string &group_name) const
Range build_range() const
std::vector< HWIdentifier >::iterator it1
bool m_generated_implementation
std::vector< IdDictRegion * > m_regions
std::string group_name() const
void add_subdictionary_name(const std::string &name)
regions_type::iterator regions_it
regions_type::const_iterator regions_const_it
int get_label_value(const std::string &field, const std::string &label, int &value) const
A MultiRange combines several Ranges.
void add_field(IdDictField *field)
virtual std::string group_name() const =0
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
void add()
Add a wild card field.
IdDictSubRegion * find_subregion(const std::string &subregion_name) const
__attribute__((always_inline)) inline uint16_t TileCalibDrawerBase
std::vector< std::string > m_subdictionary_names
std::map< std::string, IdDictSubRegion * > m_subregions
void add_dictentry(IdDictDictEntry *entry)
This is the individual specification for the range of one ExpandedIdentifier IdentifierField.
void clear()
Erase all fields.
unsigned long long value_type
bool isNumber(const std::string &s)
void set_do_neighbours(bool do_neighbours)
IdDictFieldImplementation is used to capture the specification of a single field of an Identifier.
void integrate_bits()
Set up integral of bits for efficient unpacking.
std::vector< IdDictFieldImplementation > m_implementation
int copy(const Identifier &idin, size_t first_field_index, size_t begin_field_index, size_t end_field_index, size_t region_index, Identifier &idout) const
Copy a number of fields of the value_type id into another value_type id.
void add_subregion(IdDictSubRegion *subregion)
void set_do_checks(bool do_checks)