41 # pragma warning( push )
42 # pragma warning( disable : 4396 )
45 #include <unordered_map>
49 # pragma warning( pop )
62 template <
typename RandomAccessContainer>
91 if (
getBase_().at(index).getUniqueId() != unique_id)
93 throw std::out_of_range(
"unique_id_to_index_");
96 catch (std::out_of_range &)
103 catch (std::out_of_range &)
118 Size num_valid_unique_id = 0;
120 for (
Size index = 0; index <
getBase_().size(); ++index)
126 ++num_valid_unique_id;
133 if (iter->second >=
getBase_().size() ||
getBase_()[iter->second].getUniqueId() != iter->first)
144 std::stringstream ss;
145 ss <<
"Duplicate valid unique ids detected! RandomAccessContainer has size()==" <<
getBase_().size();
146 ss <<
", num_valid_unique_id==" << num_valid_unique_id;
169 Size invalid_uids(0);
172 for (
Size index = 0; index <
getBase_().size(); ++index)
178 unique_id =
getBase_()[index].getUniqueId();
185 unique_id =
getBase_()[index].getUniqueId();
213 const RandomAccessContainer &
216 return *
static_cast<const RandomAccessContainer *
>(
this);
223 RandomAccessContainer &
226 return *
static_cast<RandomAccessContainer *
>(
this);
Postcondition failed exception.
Definition: Exception.h:173
A base class for random access containers for classes derived from UniqueIdInterface that adds functi...
Definition: UniqueIdIndexer.h:64
std::unordered_map< UInt64, Size > UniqueIdMap
Definition: UniqueIdIndexer.h:67
RandomAccessContainer & getBase_()
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:224
UniqueIdMap uniqueid_to_index_
hash map from unique id to index of features
Definition: UniqueIdIndexer.h:233
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:85
Size resolveUniqueIdConflicts()
Assign new UID's to doubly occurring UID's.
Definition: UniqueIdIndexer.h:167
void updateUniqueIdToIndex() const
Updates the hash map from unique id to index.
Definition: UniqueIdIndexer.h:116
const RandomAccessContainer & getBase_() const
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:214
void swap(UniqueIdIndexer &rhs)
Swap.
Definition: UniqueIdIndexer.h:201
static bool isValid(UInt64 unique_id)
Returns true if the unique_id is valid, false otherwise.
Definition: UniqueIdInterface.h:69
@ INVALID
Definition: UniqueIdInterface.h:61
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:47