ProteoWizard
Classes | Public Types | Public Member Functions | Private Attributes | Friends
pwiz::util::IntegerSet Class Reference

a virtual container of integers, accessible via an iterator interface, stored as union of intervals More...

#include <IntegerSet.hpp>

List of all members.

Classes

struct  Interval
 a single closed interval of integers More...
class  Iterator
 forward iterator providing readonly access to the virtual container More...

Public Types

typedef std::list< IntervalIntervals
 collection of Interval objects

Public Member Functions

 IntegerSet ()
 default construction
 IntegerSet (int a)
 construction with a single integer
 IntegerSet (int a, int b)
 construction with a single interval
bool empty () const
 true iff IntegerSet is empty
bool contains (int n) const
 true iff n is in the IntegerSet
bool hasUpperBound (int n) const
 true iff n is an upper bound for the IntegerSet
size_t intervalCount () const
 returns the number of intervals in the set
size_t size () const
 returns the number of integers in the set
write access to the virtual container
void insert (Interval interval)
 insert an interval of integers into the virtual container
void insert (int a)
 insert a single integer into the virtual container
void insert (int a, int b)
 insert an interval of integers into the virtual container
void parse (const std::string &intervalList)
 insert intervals by parsing a string representing a whitespace-delimited list of closed intervals: parse(" [-3,2] 5 8-9 10- "); // insert(-3,2); insert(5); insert(8,9); insert(10,INT_MAX);

Private Attributes

Intervals intervals_

Friends

PWIZ_API_DECL std::ostream & operator<< (std::ostream &os, const IntegerSet &integerSet)

const iterator interface to the virtual container

typedef Iterator const_iterator
const_iterator begin () const
const_iterator end () const

Detailed Description

a virtual container of integers, accessible via an iterator interface, stored as union of intervals

Definition at line 37 of file IntegerSet.hpp.


Member Typedef Documentation

collection of Interval objects

Definition at line 57 of file IntegerSet.hpp.

Definition at line 126 of file IntegerSet.hpp.


Constructor & Destructor Documentation

pwiz::util::IntegerSet::IntegerSet ( )

default construction

pwiz::util::IntegerSet::IntegerSet ( int  a)
explicit

construction with a single integer

pwiz::util::IntegerSet::IntegerSet ( int  a,
int  b 
)

construction with a single interval


Member Function Documentation

void pwiz::util::IntegerSet::insert ( Interval  interval)

insert an interval of integers into the virtual container

Referenced by test(), testContains(), testIndexSet(), testIntegerSet(), testMSLevelSet(), testScanEventSet(), and testScanNumberSet().

void pwiz::util::IntegerSet::insert ( int  a)

insert a single integer into the virtual container

void pwiz::util::IntegerSet::insert ( int  a,
int  b 
)

insert an interval of integers into the virtual container

void pwiz::util::IntegerSet::parse ( const std::string &  intervalList)

insert intervals by parsing a string representing a whitespace-delimited list of closed intervals: parse(" [-3,2] 5 8-9 10- "); // insert(-3,2); insert(5); insert(8,9); insert(10,INT_MAX);

Referenced by testParse(), and testParse2().

const_iterator pwiz::util::IntegerSet::begin ( ) const
const_iterator pwiz::util::IntegerSet::end ( ) const

Referenced by test(), testInstantiation(), and testParse().

bool pwiz::util::IntegerSet::empty ( ) const
inline

true iff IntegerSet is empty

Definition at line 132 of file IntegerSet.hpp.

Referenced by test().

{return intervals_.empty();}
bool pwiz::util::IntegerSet::contains ( int  n) const

true iff n is in the IntegerSet

Referenced by testContains().

bool pwiz::util::IntegerSet::hasUpperBound ( int  n) const

true iff n is an upper bound for the IntegerSet

Referenced by testUpperBound().

size_t pwiz::util::IntegerSet::intervalCount ( ) const

returns the number of intervals in the set

Referenced by testParse(), and testParse2().

size_t pwiz::util::IntegerSet::size ( ) const

returns the number of integers in the set

Referenced by testParse(), and testParse2().


Friends And Related Function Documentation

PWIZ_API_DECL std::ostream& operator<< ( std::ostream &  os,
const IntegerSet integerSet 
)
friend

Member Data Documentation

Intervals pwiz::util::IntegerSet::intervals_
private

Definition at line 148 of file IntegerSet.hpp.


The documentation for this class was generated from the following file: