Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes

UniqueIdInterface Class Reference
[Concept]

A base class defining a common interface for all classes having a unique id. More...

#include <OpenMS/CONCEPT/UniqueIdInterface.h>

Inheritance diagram for UniqueIdInterface:
ConsensusMap FeatureHandle FeatureMap< FeatureT > RichPeak2D FeatureHandle::FeatureHandleMutable_ BaseFeature ConsensusFeature Feature MRMFeature

List of all members.

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
 UniqueIdInterface (const UniqueIdInterface &rhs)
 Copy constructor - copies the unique id.
UniqueIdInterfaceoperator= (UniqueIdInterface const &rhs)
 Assignment operator - copies the unique id.
 ~UniqueIdInterface ()
 Destructor.
bool operator== (UniqueIdInterface const &rhs) const
 Equality comparison operator - the unique ids must be equal (!).
UInt64 getUniqueId () const
 Non-mutable access to unique id - returns the unique id.
Size clearUniqueId ()
 Clear the unique id. The new unique id will be invalid. Returns 1 if the unique id was changed, 0 otherwise.
void swap (UniqueIdInterface &from)
Size hasValidUniqueId () const
 Returns whether the unique id is valid. Returns 1 if the unique id is valid, 0 otherwise.
Size hasInvalidUniqueId () const
 Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise.
Size setUniqueId ()
 Assigns a new, valid unique id. Always returns 1.
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.
void setUniqueId (UInt64 rhs)
 Assigns the given unique id.
void setUniqueId (const String &rhs)
 Mutable access to unique id.

Static Public Member Functions

static bool isValid (UInt64 unique_id)
 Returns true if the unique_id is valid, false otherwise.

Protected Attributes

UInt64 unique_id_
 the unique id

Detailed Description

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.

See also:
UniqueIdGenerator, RichPeak2D

Member Enumeration Documentation

anonymous enum

This is the invalid unique id (cast it to a UInt64 if you like).

It is represented as an enum because static class members lead to bugs and linker errors all the time...

Enumerator:
INVALID 

Constructor & Destructor Documentation

UniqueIdInterface (  )  [inline]

Default constructor - the unique id will be invalid

UniqueIdInterface ( const UniqueIdInterface rhs  )  [inline]

Copy constructor - copies the unique id.

~UniqueIdInterface (  )  [inline]

Destructor.


Member Function Documentation

Size clearUniqueId (  )  [inline]

Clear the unique id. The new unique id will be invalid. Returns 1 if the unique id was changed, 0 otherwise.

Referenced by FeatureMap< Feature >::clear(), RichPeak2D::operator=(), and RichPeak2D::RichPeak2D().

Size ensureUniqueId (  )  [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().

UInt64 getUniqueId (  )  const [inline]

Non-mutable access to unique id - returns the unique id.

Referenced by ConsensusMap::convert(), and FeatureHandle::IndexLess::operator()().

Size hasInvalidUniqueId (  )  const [inline]

Returns whether the unique id is invalid. Returns 1 if the unique id is invalid, 0 otherwise.

Size hasValidUniqueId (  )  const [inline]

Returns whether the unique id is valid. Returns 1 if the unique id is valid, 0 otherwise.

static bool isValid ( UInt64  unique_id  )  [inline, static]

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().

UniqueIdInterface& operator= ( UniqueIdInterface const &  rhs  )  [inline]

Assignment operator - copies the unique id.

References UniqueIdInterface::unique_id_.

Referenced by RichPeak2D::operator=(), and FeatureHandle::operator=().

bool operator== ( UniqueIdInterface const &  rhs  )  const [inline]

Equality comparison operator - the unique ids must be equal (!).

References UniqueIdInterface::unique_id_.

Referenced by RichPeak2D::operator==(), and FeatureHandle::operator==().

Size setUniqueId (  )  [inline]

Assigns a new, valid unique id. Always returns 1.

References UniqueIdGenerator::getUniqueId().

Referenced by ConsensusMap::convert(), and FeatureFinderAlgorithmPicked< PeakType, FeatureType >::run().

void setUniqueId ( UInt64  rhs  )  [inline]

Assigns the given unique id.

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)

void swap ( UniqueIdInterface from  )  [inline]

Member Data Documentation


OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:51 using doxygen 1.7.1