OpenMS  2.7.0
Classes | List of all members
FeatureHandle Class Reference

Representation of a Peak2D, RichPeak2D or Feature . More...

#include <OpenMS/KERNEL/FeatureHandle.h>

Inheritance diagram for FeatureHandle:
[legend]
Collaboration diagram for FeatureHandle:
[legend]

Classes

class  FeatureHandleMutable_
 Helper class returned by FeatureHandle::asMutable(), which see. More...
 
struct  IndexLess
 Comparator by map and unique id. More...
 

Public Types

Type definitions
typedef Int ChargeType
 Charge type. More...
 
typedef float WidthType
 Feature width type. More...
 
- Public Types inherited from Peak2D
typedef float IntensityType
 Intensity type. More...
 
typedef double CoordinateType
 Coordinate type (of the position) More...
 
typedef DPosition< 2 > PositionType
 Position type. More...
 
enum  DimensionDescription { RT = 0 , MZ = 1 , DIMENSION = 2 }
 This enum maps the symbolic names of the dimensions to numbers. More...
 
- Public Types inherited from UniqueIdInterface
enum  { INVALID = 0 }
 This is the invalid unique id (cast it to a UInt64 if you like) More...
 

Public Member Functions

Constructors and destructor
 FeatureHandle ()
 Default constructor. More...
 
 FeatureHandle (UInt64 map_index, const Peak2D &point, UInt64 element_index)
 Constructor with map index, element index and position. More...
 
 FeatureHandle (UInt64 map_index, const BaseFeature &feature)
 Constructor from map index and basic feature. More...
 
 FeatureHandle (const FeatureHandle &rhs)
 Copy constructor. More...
 
FeatureHandleoperator= (const FeatureHandle &rhs)
 Assignment operator. More...
 
 ~FeatureHandle () override
 Destructor. More...
 
FeatureHandleMutable_asMutable () const
 Override (most of all) constness. More...
 
- Public Member Functions inherited from Peak2D
Peak2Doperator= (const Peak2D &rhs)=default
 Assignment operator. More...
 
Peak2Doperator= (Peak2D &&) &=default
 Move assignment operator. More...
 
bool operator== (const Peak2D &rhs) const
 Equality operator. More...
 
bool operator!= (const Peak2D &rhs) const
 Equality operator. More...
 
 Peak2D ()
 
 Peak2D (const PositionType &pos, const IntensityType in)
 Member constructor. More...
 
 Peak2D (const Peak2D &p)=default
 Copy constructor. More...
 
 Peak2D (Peak2D &&)=default
 Move constructor. More...
 
 ~Peak2D ()
 Destructor. More...
 
IntensityType getIntensity () const
 
void setIntensity (IntensityType intensity)
 Non-mutable access to the data point intensity (height) More...
 
PositionType const & getPosition () const
 Non-mutable access to the position. More...
 
PositionTypegetPosition ()
 Mutable access to the position. More...
 
void setPosition (const PositionType &position)
 Mutable access to the position. More...
 
CoordinateType getMZ () const
 Returns the m/z coordinate (index 1) More...
 
void setMZ (CoordinateType coordinate)
 Mutable access to the m/z coordinate (index 1) More...
 
CoordinateType getRT () const
 Returns the RT coordinate (index 0) More...
 
void setRT (CoordinateType coordinate)
 Mutable access to the RT coordinate (index 0) More...
 
- Public Member Functions inherited from UniqueIdInterface
 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...
 
UniqueIdInterfaceoperator= (UniqueIdInterface const &rhs)=default
 Assignment operator - copies the unique id. More...
 
UniqueIdInterfaceoperator= (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...
 

Accessors

UInt64 map_index_
 Index of the element's container. More...
 
Int charge_
 Charge of the feature. More...
 
float width_
 Width of the feature (FWHM) More...
 
UInt64 getMapIndex () const
 Returns the map index. More...
 
void setMapIndex (UInt64 i)
 Set the map index. More...
 
void setCharge (ChargeType charge)
 Sets the charge. More...
 
ChargeType getCharge () const
 Returns the charge. More...
 
void setWidth (WidthType width)
 Sets the width (FWHM) More...
 
WidthType getWidth () const
 Returns the width (FWHM) More...
 
bool operator== (const FeatureHandle &i) const
 Equality operator. More...
 
bool operator!= (const FeatureHandle &i) const
 Equality operator. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Peak2D
static char const * shortDimensionName (UInt const dim)
 Short name of the dimension (abbreviated form) More...
 
static char const * shortDimensionNameRT ()
 Short name of the dimension (abbreviated form) More...
 
static char const * shortDimensionNameMZ ()
 Short name of the dimension (abbreviated form) More...
 
static char const * fullDimensionName (UInt const dim)
 Full name of the dimension (self-explanatory form) More...
 
static char const * fullDimensionNameRT ()
 Full name of the dimension (self-explanatory form) More...
 
static char const * fullDimensionNameMZ ()
 Full name of the dimension (self-explanatory form) More...
 
static char const * shortDimensionUnit (UInt const dim)
 Unit of measurement (abbreviated form) More...
 
static char const * shortDimensionUnitRT ()
 Unit of measurement (abbreviated form) More...
 
static char const * shortDimensionUnitMZ ()
 Unit of measurement (abbreviated form) More...
 
static char const * fullDimensionUnit (UInt const dim)
 Unit of measurement (self-explanatory form) More...
 
static char const * fullDimensionUnitRT ()
 Unit of measurement (self-explanatory form) More...
 
static char const * fullDimensionUnitMZ ()
 Unit of measurement (self-explanatory form) More...
 
- Static Public Member Functions inherited from UniqueIdInterface
static bool isValid (UInt64 unique_id)
 Returns true if the unique_id is valid, false otherwise. More...
 
- Protected Attributes inherited from Peak2D
PositionType position_
 The data point position. More...
 
IntensityType intensity_
 The data point intensity. More...
 
- Protected Attributes inherited from UniqueIdInterface
UInt64 unique_id_
 the unique id More...
 
- Static Protected Attributes inherited from Peak2D
static char const *const dimension_name_short_ [DIMENSION]
 Short name of the dimension (abbreviated form) More...
 
static char const *const dimension_name_full_ [DIMENSION]
 Full name of the dimension (self-explanatory form) More...
 
static char const *const dimension_unit_short_ [DIMENSION]
 Unit of measurement (abbreviated form) More...
 
static char const *const dimension_unit_full_ [DIMENSION]
 Unit of measurement (self-explanatory form) More...
 

Detailed Description

Representation of a Peak2D, RichPeak2D or Feature .

The position and the intensity of the referenced feature are stored in the base class Peak2D. The original datapoint is referenced by the map and unique id.

Member Typedef Documentation

◆ ChargeType

typedef Int ChargeType

Charge type.

◆ WidthType

typedef float WidthType

Feature width type.

Constructor & Destructor Documentation

◆ FeatureHandle() [1/4]

Default constructor.

◆ FeatureHandle() [2/4]

FeatureHandle ( UInt64  map_index,
const Peak2D point,
UInt64  element_index 
)

Constructor with map index, element index and position.

◆ FeatureHandle() [3/4]

FeatureHandle ( UInt64  map_index,
const BaseFeature feature 
)

Constructor from map index and basic feature.

◆ FeatureHandle() [4/4]

FeatureHandle ( const FeatureHandle rhs)

Copy constructor.

◆ ~FeatureHandle()

~FeatureHandle ( )
override

Destructor.

Member Function Documentation

◆ asMutable()

FeatureHandle::FeatureHandleMutable_ & asMutable ( ) const
inline

Override (most of all) constness.

We provide this such that you can modify instances FeatureHandle which are stored within a ConsensusFeature. Note that std::set does not provide non-const iterators, because these could be used to change the relative ordering of the elements, and iterators are (by design/concept) unaware of their containers. Since ConsensusFeature uses the ordering by IndexLess (which see), you must not modify the map index of element index if there is more than one FeatureHandle stored in a ConsensusFeature. Consequently, we "disable" setMapIndex() or setElementIndex() even within FeatureHandleMutable_. On the other hand, it is perfectly safe to apply FeatureHandle::setRT(), FeatureHandle::setMZ(), FeatureHandle::setIntensity(), FeatureHandle::setCharge(), etc..

◆ getCharge()

ChargeType getCharge ( ) const

Returns the charge.

◆ getMapIndex()

UInt64 getMapIndex ( ) const

Returns the map index.

◆ getWidth()

WidthType getWidth ( ) const

Returns the width (FWHM)

◆ operator!=()

bool operator!= ( const FeatureHandle i) const

Equality operator.

◆ operator=()

FeatureHandle& operator= ( const FeatureHandle rhs)

Assignment operator.

◆ operator==()

bool operator== ( const FeatureHandle i) const

Equality operator.

◆ setCharge()

void setCharge ( ChargeType  charge)

Sets the charge.

◆ setMapIndex()

void setMapIndex ( UInt64  i)

Set the map index.

◆ setWidth()

void setWidth ( WidthType  width)

Sets the width (FWHM)

Member Data Documentation

◆ charge_

Int charge_
protected

Charge of the feature.

◆ map_index_

UInt64 map_index_
protected

Index of the element's container.

Referenced by FeatureHandle::IndexLess::operator()().

◆ width_

float width_
protected

Width of the feature (FWHM)