|
OpenMS
2.6.0
|
Go to the documentation of this file.
41 #ifdef _MSC_VER // disable some BOOST warnings that distract from ours
42 # pragma warning( push ) // save warning state
43 # pragma warning( disable : 4396 )
46 #include <boost/unordered_map.hpp>
49 # pragma warning( pop ) // restore old warning state
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:180
void updateUniqueIdToIndex() const
Updates the hash map from unique id to index.
Definition: UniqueIdIndexer.h:116
OPENMS_UINT64_TYPE UInt64
Unsigned integer type (64bit)
Definition: Types.h:77
Definition: UniqueIdInterface.h:61
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
void swap(UniqueIdIndexer &rhs)
Swap.
Definition: UniqueIdIndexer.h:201
boost::unordered_map< UInt64, Size > UniqueIdMap
Definition: UniqueIdIndexer.h:67
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
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
A base class for random access containers for classes derived from UniqueIdInterface that adds functi...
Definition: UniqueIdIndexer.h:63
const RandomAccessContainer & getBase_() const
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:214
Size resolveUniqueIdConflicts()
Assign new UID's to doubly occurring UID's.
Definition: UniqueIdIndexer.h:167
UniqueIdMap uniqueid_to_index_
hash map from unique id to index of features
Definition: UniqueIdIndexer.h:233
RandomAccessContainer & getBase_()
A little helper to get access to the base (!) class RandomAccessContainer.
Definition: UniqueIdIndexer.h:224
static bool isValid(UInt64 unique_id)
Returns true if the unique_id is valid, false otherwise.
Definition: UniqueIdInterface.h:69