A base class for random access containers for classes derived from UniqueIdInterface that adds functionality to convert a unique id into an index into the container. More...
#include <OpenMS/CONCEPT/UniqueIdIndexer.h>
Public Types | |
| typedef boost::unordered_map < UInt64, Size > | UniqueIdMap |
Public Member Functions | |
| 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 access container. | |
| void | updateUniqueIdToIndex () const |
| Updates the hash map from unique id to index. | |
| Size | resolveUniqueIdConflicts () |
| Assign new UID's to doubly occurring UID's. | |
| void | swap (UniqueIdIndexer &rhs) |
| Swap. | |
Protected Member Functions | |
| const RandomAccessContainer & | getBase_ () const |
| A little helper to get access to the base (!) class RandomAccessContainer. | |
| RandomAccessContainer & | getBase_ () |
| A little helper to get access to the base (!) class RandomAccessContainer. | |
Protected Attributes | |
| UniqueIdMap | uniqueid_to_index_ |
| hash map from unique id to index of features | |
A base class for random access containers for classes derived from UniqueIdInterface that adds functionality to convert a unique id into an index into the container.
See FeatureMap<> and ConsensusMap for living examples. The RandomAccessContainer must support operator[], at(), and size().
| typedef boost::unordered_map<UInt64, Size> UniqueIdMap |
| const RandomAccessContainer& getBase_ | ( | ) | const [inline, protected] |
A little helper to get access to the base (!) class RandomAccessContainer.
This is just a static_cast and probably not interesting elsewhere, so we make it a protected member.
Referenced by UniqueIdIndexer< ConsensusMap >::resolveUniqueIdConflicts(), UniqueIdIndexer< ConsensusMap >::uniqueIdToIndex(), and UniqueIdIndexer< ConsensusMap >::updateUniqueIdToIndex().
| RandomAccessContainer& getBase_ | ( | ) | [inline, protected] |
A little helper to get access to the base (!) class RandomAccessContainer.
This is just a static_cast and probably not interesting elsewhere, so we make it a protected member.
| Size resolveUniqueIdConflicts | ( | ) | [inline] |
Assign new UID's to doubly occurring UID's.
Assign new UID's to non-unique UID's. This usually occurs in merging of 'old' feature files, which have sequentially increasing UID's. Conflicting entries receive a new UID, such that all UID's are unique in the container.
| void swap | ( | UniqueIdIndexer< RandomAccessContainer > & | rhs | ) | [inline] |
Swap.
Referenced by UniqueIdIndexer< ConsensusMap >::swap().
Returns the index of the feature with the given unique id, or Size(-1) if none exists in this random access container.
The complexity is expected constant upon success, linear upon failure.
The lookup actually performs the following steps:
| void updateUniqueIdToIndex | ( | ) | const [inline] |
Updates the hash map from unique id to index.
Referenced by UniqueIdIndexer< ConsensusMap >::uniqueIdToIndex().
UniqueIdMap uniqueid_to_index_ [mutable, protected] |
hash map from unique id to index of features
This is mutable because the hash map is updated on demand, even if the underlying container is const.
Referenced by UniqueIdIndexer< ConsensusMap >::resolveUniqueIdConflicts(), UniqueIdIndexer< ConsensusMap >::swap(), UniqueIdIndexer< ConsensusMap >::uniqueIdToIndex(), and UniqueIdIndexer< ConsensusMap >::updateUniqueIdToIndex().
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:51 using doxygen 1.7.1 |