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

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

#include <IntegerSet.hpp>

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 More...
 

Public Member Functions

 IntegerSet ()
 default construction More...
 
 IntegerSet (int a)
 construction with a single integer More...
 
 IntegerSet (int a, int b)
 construction with a single interval More...
 
bool empty () const
 true iff IntegerSet is empty More...
 
bool contains (int n) const
 true iff n is in the IntegerSet More...
 
bool hasUpperBound (int n) const
 true iff n is an upper bound for the IntegerSet More...
 
size_t intervalCount () const
 returns the number of intervals in the set More...
 
size_t size () const
 returns the number of integers in the set More...
 
write access to the virtual container
void insert (Interval interval)
 insert an interval of integers into the virtual container More...
 
void insert (int a)
 insert a single integer into the virtual container More...
 
void insert (int a, int b)
 insert an interval of integers into the virtual container More...
 
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); More...
 

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

§ Intervals

collection of Interval objects

Definition at line 57 of file IntegerSet.hpp.

§ const_iterator

Definition at line 126 of file IntegerSet.hpp.

Constructor & Destructor Documentation

§ IntegerSet() [1/3]

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

default construction

§ IntegerSet() [2/3]

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

construction with a single integer

§ IntegerSet() [3/3]

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

construction with a single interval

Member Function Documentation

§ insert() [1/3]

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

§ insert() [2/3]

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

insert a single integer into the virtual container

§ insert() [3/3]

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

insert an interval of integers into the virtual container

§ parse()

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

§ begin()

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

§ end()

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

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

§ empty()

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

true iff IntegerSet is empty

Definition at line 132 of file IntegerSet.hpp.

Referenced by test().

132 {return intervals_.empty();}

§ contains()

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

true iff n is in the IntegerSet

Referenced by testContains().

§ hasUpperBound()

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

true iff n is an upper bound for the IntegerSet

Referenced by testUpperBound().

§ intervalCount()

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

returns the number of intervals in the set

Referenced by testParse(), and testParse2().

§ size()

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

§ operator<<

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

Member Data Documentation

§ intervals_

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: