41 # pragma warning( push )
42 # pragma warning( disable : 4396 )
45 #include <unordered_map>
49 # pragma warning( pop )
93 if (
getBase_().at(index).getUniqueId() != unique_id)
95 throw std::out_of_range(
"unique_id_to_index_");
98 catch (std::out_of_range &)
105 catch (std::out_of_range &)
120 Size num_valid_unique_id = 0;
122 for (
Size index = 0; index <
getBase_().size(); ++index)
128 ++num_valid_unique_id;
135 if (iter->second >=
getBase_().size() ||
getBase_()[iter->second].getUniqueId() != iter->first)
146 std::stringstream ss;
147 ss <<
"Duplicate valid unique ids detected! RandomAccessContainer has size()==" <<
getBase_().size();
148 ss <<
", num_valid_unique_id==" << num_valid_unique_id;
171 Size invalid_uids(0);
174 for (
Size index = 0; index <
getBase_().size(); ++index)
180 unique_id =
getBase_()[index].getUniqueId();
187 unique_id =
getBase_()[index].getUniqueId();
215 const T& derived =
static_cast<const T&
>(*this);
216 return derived.getData();
223 T& derived =
static_cast<T&
>(*this);
224 return derived.getData();
Postcondition failed exception.
Definition: Exception.h:173
A base class for containers with elements derived from UniqueIdInterface. This adds functionality to ...
Definition: UniqueIdIndexer.h:67
const auto & getBase_() const
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:213
std::unordered_map< UInt64, Size > UniqueIdMap
Definition: UniqueIdIndexer.h:69
UniqueIdMap uniqueid_to_index_
hash map from unique id to index of features
Definition: UniqueIdIndexer.h:231
Size uniqueIdToIndex(UInt64 unique_id) const
Returns the index of the feature with the given unique id, or Size(-1) if none exists in this random ...
Definition: UniqueIdIndexer.h:87
Size resolveUniqueIdConflicts()
Assign new UID's to doubly occurring UID's.
Definition: UniqueIdIndexer.h:169
void updateUniqueIdToIndex() const
Updates the hash map from unique id to index.
Definition: UniqueIdIndexer.h:118
auto & getBase_()
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:221
void swap(UniqueIdIndexer &rhs)
Swap.
Definition: UniqueIdIndexer.h:203
static bool isValid(UInt64 unique_id)
Returns true if the unique_id is valid, false otherwise.
Definition: UniqueIdInterface.h:68
@ INVALID
Definition: UniqueIdInterface.h:60
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:77
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:48