15 # pragma warning( push )
16 # pragma warning( disable : 4396 )
19 #include <unordered_map>
23 # pragma warning( pop )
67 if (
getBase_().at(index).getUniqueId() != unique_id)
69 throw std::out_of_range(
"unique_id_to_index_");
72 catch (std::out_of_range &)
79 catch (std::out_of_range &)
94 Size num_valid_unique_id = 0;
102 ++num_valid_unique_id;
109 if (iter->second >=
getBase_().size() ||
getBase_()[iter->second].getUniqueId() != iter->first)
120 std::stringstream ss;
121 ss <<
"Duplicate valid unique ids detected! RandomAccessContainer has size()==" <<
getBase_().size();
122 ss <<
", num_valid_unique_id==" << num_valid_unique_id;
145 Size invalid_uids(0);
148 for (
Size index = 0; index <
getBase_().size(); ++index)
154 unique_id =
getBase_()[index].getUniqueId();
161 unique_id =
getBase_()[index].getUniqueId();
189 const T& derived =
static_cast<const T&
>(*this);
190 return derived.getData();
197 T& derived =
static_cast<T&
>(*this);
198 return derived.getData();
Postcondition failed exception.
Definition: Exception.h:141
A base class for containers with elements derived from UniqueIdInterface. This adds functionality to ...
Definition: UniqueIdIndexer.h:41
const auto & getBase_() const
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:187
std::unordered_map< UInt64, Size > UniqueIdMap
Definition: UniqueIdIndexer.h:43
UniqueIdMap uniqueid_to_index_
hash map from unique id to index of features
Definition: UniqueIdIndexer.h:205
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:61
Size resolveUniqueIdConflicts()
Assign new UID's to doubly occurring UID's.
Definition: UniqueIdIndexer.h:143
void updateUniqueIdToIndex() const
Updates the hash map from unique id to index.
Definition: UniqueIdIndexer.h:92
auto & getBase_()
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:195
void swap(UniqueIdIndexer &rhs)
Swap.
Definition: UniqueIdIndexer.h:177
static bool isValid(UInt64 unique_id)
Returns true if the unique_id is valid, false otherwise.
Definition: UniqueIdInterface.h:42
@ INVALID
Definition: UniqueIdInterface.h:34
uint64_t UInt64
Unsigned integer type (64bit)
Definition: Types.h:47
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19