 |
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);
38 const std::string&
date ,
39 const std::string&
author )
87 if (!idField)
return nullptr;
95 if (!idLabel || !idLabel->
valued())
return(1);
102 if (
field == 0)
return;
109 std::map <std::string, IdDictSubRegion*>::const_iterator
it;
115 return((*it).second);
128 if ((region_name !=
"") && (
region->
name() != region_name))
continue;
139 if ((region_name !=
"") && (
region->
name() != region_name))
continue;
162 if (subregion == 0)
return;
202 g->resolve_references(idd, *
this,
index);
208 const std::string&
tag) {
210 std::cout <<
"IdDictDictionary::generate_implementation>" << std::endl;
217 g->generate_implementation(idd, *
this,
tag);
232 if (
"dummy" ==
g->name())
continue;
241 g->build_region_tree();
247 (*itr)->find_neighbours(*
this);
259 (*it)->reset_implementation();
277 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
303 if (
range.match(
id) &&
range.fields() >=
id.fields()) {
331 for (
unsigned int i = 0;
i < group_mr.
size(); ++
i) {
342 const std::string& last_field)
const {
346 if (
"" == last_field) {
382 for (
size_t i = 0;
i < nimpl; ++
i) {
386 new_range.
add(
impl.range()->build_range());
388 if (last_field ==
impl.range()->field()->name()) {
392 result.add(std::move(new_range));
403 const std::string& last_field)
const {
407 if (
"" == last_field) {
443 for (
size_t i = 0;
i < nimpl; ++
i) {
447 new_range.
add(
impl.range()->build_range());
449 if (last_field ==
impl.range()->field()->name()) {
453 result.add(std::move(new_range));
509 bool selected =
true;
522 if (!
impl.field().match(
id[
i])) {
536 if (0 == position &&
impl.bits() > 0) {
540 position -=
impl.bits();
541 packedId |= (
index << position);
557 size_t first_field_index)
const {
563 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
570 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
571 << region_index <<
" " <<
m_regions.size() << std::endl;
582 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
586 if (
index1 < first_field_index) {
587 std::cout <<
"IdDictDictionary::pack32 - first_field_index > index1 "
588 << first_field_index <<
" " <<
index1 << std::endl;
595 if (!first_field_index) {
597 position -=
impl.bits_offset();
600 size_t field_index = 0;
606 if (!
impl.ored_field().match(
fields[field_index])) {
607 std::cout <<
"IdDictDictionary::pack32 - field does NOT match: value, allowed values "
608 <<
fields[field_index] <<
" " << (std::string)
impl.ored_field()
615 if (0 == position &&
impl.bits() > 0) {
616 std::cout <<
"IdDictDictionary::pack32 - going past 0" << std::endl;
622 if (
impl.decode_index()) {
628 position -=
impl.bits();
629 packedId |= (
index << position);
648 std::cout <<
"IdDictDictionary::pack32 - index2 < index1 - 1,2"
655 std::cout <<
"IdDictDictionary::pack32 - region index incorrect - index,size"
656 << region_index <<
" " <<
m_regions.size() << std::endl;
667 std::cout <<
"IdDictDictionary::pack32 - region id empty" << std::endl;
673 size_t field_index = 0;
720 const std::string&
sep,
721 std::string& unpackedId)
const
725 std::vector<const IdDictFieldImplementation*> impls;
731 assert (unpacked.
fields() == impls.size());
732 for (
size_t i = 0;
i < unpacked.
fields(); ++
i) {
735 std::string str_value(
"nil");
749 switch (
range->specification()) {
760 str_value +=
range->field()->name() +
' ';
762 str_value +=
range->label();
771 if (
label->valued()) {
772 str_value +=
range->label();
780 for (
int v :
range->values()) {
787 str_value +=
range->field()->name() +
' ';
791 std::cout <<
"IdDictDictionary::unpack - Could not find value." << std::endl;
792 std::cout <<
"value " <<
value << std::endl;
793 std::cout <<
"field values " << std::endl;
794 for (
int v :
range->values()) {
795 std::cout <<
v <<
" ";
797 std::cout << std::endl;
804 std::cout <<
"unknown" << std::endl;
809 if (
i > 0) unpackedId +=
sep;
810 unpackedId += str_value;
827 size_t first_field_index,
836 std::cout <<
"IdDictDictionary::unpack - region index too large. Index, nregions "
837 << region_index <<
" " <<
m_regions.size() << std::endl;
847 std::cout <<
"IdDictDictionary::unpack - field index too large. Index, nfields "
855 size_t prefix_offset = 0;
860 if (first_field_index) {
863 std::cout <<
"IdDictDictionary::unpack - first_field_index too large. Index, nfields "
875 if (
impl.bits() == 0) {
876 std::cout <<
"IdDictDictionary::unpack - no bits for this field. Region, field indexes "
877 << region_index <<
" " << field_index << std::endl;
882 if (
impl.bits() +
impl.bits_offset() - prefix_offset > position) {
883 std::cout <<
"IdDictDictionary::unpack - bits + offset too large. Region, field indexes, bits, offset "
884 << region_index <<
" " << field_index <<
" "
885 <<
impl.bits() <<
" " <<
impl.bits_offset() <<
" " << prefix_offset
894 size_t index =
id.extract(position -=
impl.bits() +
impl.bits_offset() - prefix_offset,
mask);
914 size_t first_field_index,
915 size_t begin_field_index,
916 size_t end_field_index,
921 std::cout <<
"IdDictDictionary::copy - region index too large. Index, nregions "
922 << region_index <<
" " <<
m_regions.size() << std::endl;
931 std::cout <<
"IdDictDictionary::copy - field index too large. Indexes first, begin, end, nfields "
932 << first_field_index <<
" "
933 << begin_field_index <<
" "
934 << end_field_index <<
" "
940 size_t missing_offset = 0;
941 if (first_field_index) {
942 if (first_field_index > begin_field_index) {
943 std::cout <<
"IdDictDictionary::copy - first_field_index > begin_field_index. Indexes "
944 << first_field_index <<
" " << begin_field_index << std::endl;
951 size_t prefix_offset = 0;
952 if (begin_field_index) {
953 if (begin_field_index > end_field_index) {
954 std::cout <<
"IdDictDictionary::copy - begin_field_index > end_field_index. Indexes "
955 << begin_field_index <<
" " << end_field_index << std::endl;
963 size_t suffix_offset =
impl.bits() +
impl.bits_offset();
967 if (position < prefix_offset - missing_offset) {
968 std::cout <<
"IdDictDictionary::copy - position < prefix + missing. "
969 << prefix_offset <<
" " << missing_offset << std::endl;
974 if (position < suffix_offset + missing_offset) {
975 std::cout <<
"IdDictDictionary::copy - position < suffix + missing. "
976 << suffix_offset <<
" " << missing_offset << std::endl;
986 prefix_offset ? (
static_cast<Identifier::value_type>(1) << (position - prefix_offset + missing_offset)) - 1 : 0;
991 mask -= prefix_mask + suffix_mask;
1048 if (
mr.has_overlap())
return(
false);
1067 std::map< ExpandedIdentifier, IdDictDictEntry* > regions;
1075 std::cout <<
"IdDictDictionary::sort - WARNING verify is FALSE - cannot sort "
1122 std::cout <<
"=== IdDictDictionary " <<
m_name <<
" " <<
m_version <<
" "
JetConstituentVector::iterator iterator
void dump() const
Dump regions and trees for each group.
virtual void clear() override
MultiRange build_multirange() const
Get MultiRange for full dictionary.
virtual Range build_range() const override
int reset(size_t index1, size_t index2, size_t region_index, Identifier &packedId) const
Reset fields from index1 to index2.
void generate_implementation(const IdDictMgr &idd, const std::string &tag="")
std::vector< IdDictGroup * > m_groups
void resolve_references(IdDictMgr &idd)
void get_bits(const RV ®ions, size_t level, const std::string &group)
const IdDictRegion & region(size_t i) const
Region at index i.
value_type mask_shift(value_type mask, size_type shift) const
extract field(s) by masking first, then shifting
IdDictSubRegion * find_subregion(const std::string &subregion_name)
const IdDictField * find_field(const std::string &name) const
const std::string & name() const
Dictionary name.
std::string to_string(const SectorProjector proj)
const IdDictLabel * find_label(const std::string &field, const std::string &label) 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,...
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
const IdDictRegion * find_region(const std::string ®ion_name) const
const IdDictFieldImplementation & implementation(size_t i) const
std::map< std::string, IdDictField * > m_fields
static constexpr value_type ALL_BITS
static constexpr unsigned int NBITS
bool m_generated_implementation
size_type bits_offset() const
groups_type::iterator groups_it
std::vector< IdDictRegion * > m_regions
groups_type::const_iterator groups_const_it
void add_subdictionary_name(const std::string &name)
regions_type::const_iterator regions_const_it
virtual void resolve_references(IdDictMgr &idd, IdDictDictionary &dictionary) override
bool do_checks() const
Checks are performed by default in debug compilation and NOT in optimized compilation.
IdDictGroup * find_group(const std::string &group_name)
size_t n_implementation() const
int get_label_value(const std::string &field, const std::string &label, int &value) const
int unpack(const std::string &group, const Identifier &id, const ExpandedIdentifier &prefix, size_t index2, ExpandedIdentifier &unpackedId) const
Unpack the value_type id to an expanded Identifier for a given group, considering the provided prefix...
A MultiRange combines several Ranges.
void add_region(IdDictRegion *region)
void add_field(IdDictField *field)
bool do_neighbours() const
Neighbour initialization is performed by default One can switch or query this mode for any idHelper w...
regions_type::iterator regions_it
A Range describes the possible ranges for the field values of an ExpandedIdentifier.
Identifier::size_type size_type
std::vector< std::string > m_subdictionary_names
std::map< std::string, IdDictSubRegion * > m_subregions
void add_dictentry(IdDictDictEntry *entry)
void set_parent_dict(IdDictDictionary *parent_dict)
const boost::regex re(r_e)
void add(element_type value)
Add a required value. (ie. low = high = value)
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.
const std::string & name() const
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)
const IdDictLabel * find_label(const std::string &name) const
virtual std::string group_name() const override
std::vector< IdDictRegion * > m_all_regions
void set_do_checks(bool do_checks)