NCBI C++ ToolKit
Public Member Functions | Private Attributes | List of all members
CRanges Class Reference

Search Toolkit Book for CRanges

Class representing (non overlapping) integer ranges. More...

+ Collaboration diagram for CRanges:

Public Member Functions

 CRanges (istream &is)
 Reads integer ranges from an input stream. More...
 
bool Contain (int n) const
 Checks whether provided number belongs to one of the ranges. More...
 

Private Attributes

vector< intm_Ranges
 

Detailed Description

Class representing (non overlapping) integer ranges.

Definition at line 320 of file exec_helpers.cpp.

Constructor & Destructor Documentation

◆ CRanges()

CRanges::CRanges ( istream &  is)

Reads integer ranges from an input stream.

The data must be in the following format (in ascending order): [!] R1, N2, ..., Rn

Where: ! - negation, makes all provided ranges be excluded (not included). R1 ... Rn - integer closed ranges specified either as FROM - TO (corresponds to [FROM, TO] range) or as NUMBER (corresponds to [NUMBER, NUMBER] range). Example: 4, 6 - 9, 16 - 40, 64

Definition at line 347 of file exec_helpers.cpp.

References m_Ranges, min(), and n.

Member Function Documentation

◆ Contain()

bool CRanges::Contain ( int  n) const

Checks whether provided number belongs to one of the ranges.

Definition at line 409 of file exec_helpers.cpp.

References m_Ranges, n, and compile_time_bits::range().

Member Data Documentation

◆ m_Ranges

vector<int> CRanges::m_Ranges
private

Definition at line 344 of file exec_helpers.cpp.

Referenced by Contain(), and CRanges().


The documentation for this class was generated from the following file:
Modified on Mon Feb 26 03:58:49 2024 by modify_doxy.py rev. 669887