OpenMS
2.5.0
|
A base class defining a common interface for all classes having a unique id. More...
#include <OpenMS/CONCEPT/UniqueIdInterface.h>
Public Types | |
enum | { INVALID = 0 } |
This is the invalid unique id (cast it to a UInt64 if you like) More... | |
Public Member Functions | |
UniqueIdInterface () | |
Default constructor - the unique id will be invalid More... | |
UniqueIdInterface (const UniqueIdInterface &rhs)=default | |
Copy constructor - copies the unique id. More... | |
UniqueIdInterface (UniqueIdInterface &&rhs)=default | |
Move constructor. More... | |
UniqueIdInterface & | operator= (UniqueIdInterface const &rhs)=default |
Assignment operator - copies the unique id. More... | |
UniqueIdInterface & | operator= (UniqueIdInterface &&) &=default |
Move Assignment operator - copies the unique id. More... | |
virtual | ~UniqueIdInterface ()=default |
Destructor. More... | |
bool | operator== (UniqueIdInterface const &rhs) const |
Equality comparison operator - the unique ids must be equal (!) More... | |
UInt64 | getUniqueId () const |
Non-mutable access to unique id - returns the unique id. More... | |
Size | clearUniqueId () |
Clear the unique id. The new unique id will be invalid. Returns 1 if the unique id was changed, 0 otherwise. More... | |
void | swap (UniqueIdInterface &from) |
Size | hasValidUniqueId () const |
Returns whether the unique id is valid. Returns 1 if the unique id is valid, 0 otherwise. More... | |
Size | hasInvalidUniqueId () const |
Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise. More... | |
Size | setUniqueId () |
Assigns a new, valid unique id. Always returns 1. More... | |
Size | ensureUniqueId () |
Assigns a valid unique id, but only if the present one is invalid. Returns 1 if the unique id was changed, 0 otherwise. More... | |
void | setUniqueId (UInt64 rhs) |
Assigns the given unique id. More... | |
void | setUniqueId (const String &rhs) |
Mutable access to unique id. More... | |
Static Public Member Functions | |
static bool | isValid (UInt64 unique_id) |
Returns true if the unique_id is valid, false otherwise. More... | |
Protected Attributes | |
UInt64 | unique_id_ |
the unique id More... | |
A base class defining a common interface for all classes having a unique id.
Have a look at RichPeak2D for an example how to extend a class to support unique ids.
anonymous enum |
|
inline |
Default constructor - the unique id will be invalid
|
default |
Copy constructor - copies the unique id.
|
default |
Move constructor.
|
virtualdefault |
Destructor.
|
inline |
Clear the unique id. The new unique id will be invalid. Returns 1 if the unique id was changed, 0 otherwise.
Referenced by RichPeak2D::operator=(), and RichPeak2D::RichPeak2D().
|
inline |
Assigns a valid unique id, but only if the present one is invalid. Returns 1 if the unique id was changed, 0 otherwise.
References UniqueIdGenerator::getUniqueId().
|
inline |
Non-mutable access to unique id - returns the unique id.
Referenced by TOPPGNPSExport::main_(), FeatureHandle::IndexLess::operator()(), and ConfidenceScoring::scoreMap().
|
inline |
Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise.
|
inline |
Returns whether the unique id is valid. Returns 1 if the unique id is valid, 0 otherwise.
|
inlinestatic |
Returns true if the unique_id is valid, false otherwise.
Currently, an invalid unique id is represented by UInt64(0), but please prefer using this method for clarity.
Referenced by UniqueIdIndexer< ConsensusMap >::resolveUniqueIdConflicts(), and UniqueIdIndexer< ConsensusMap >::updateUniqueIdToIndex().
|
default |
Move Assignment operator - copies the unique id.
|
default |
Assignment operator - copies the unique id.
|
inline |
Equality comparison operator - the unique ids must be equal (!)
References UniqueIdInterface::unique_id_.
Referenced by RichPeak2D::operator==().
|
inline |
Assigns a new, valid unique id. Always returns 1.
References UniqueIdGenerator::getUniqueId().
void setUniqueId | ( | const String & | rhs | ) |
Mutable access to unique id.
This is designed to work well with id
attributes in XML, which are prefixed with letters. The portion of the String after the last underscore is extracted and parsed as a UInt64. It must consist of digits only. For example, some_feature.setUniqueId("f_12345_00067890")
is equivalent to some_feature.setUniqueId(67890)
|
inline |
Assigns the given unique id.
|
inline |
References UniqueIdInterface::unique_id_.
|
protected |
the unique id
Referenced by UniqueIdInterface::operator==(), and UniqueIdInterface::swap().