This class is a parser for slices of the form i:j:k where i, j and k are integers representing respectively the starting point, the stopping point and the period.
More...
#include <IntervalsParser.H>
|
| SliceParser (const std::string &instr, bool isBTD=false) |
| Constructor of the SliceParser class. More...
|
|
bool | contains (int n) const |
| A method that returns true if the input integer is contained in the slice. (e.g. if the list is initialized with "300:500:100", this method returns true if and only if n is 300, 400 or 500). If the period is negative or 0, the function always returns false. More...
|
|
int | nextContains (int n) const |
| A method that returns the smallest integer strictly greater than n such that contains(n) is true. Returns std::numeric_limits<int>::max() if there is no such integer. More...
|
|
int | previousContains (int n) const |
| A method that returns the greatest integer strictly smaller than n such that contains(n) is true. Returns 0 if there is no such integer. More...
|
|
int | getPeriod () const |
| A method that returns the slice period. More...
|
|
int | getStart () const |
| A method that returns the slice start. More...
|
|
int | getStop () const |
| A method that returns the slice stop. More...
|
|
int | numContained () const |
| A method that returns the number of integers contained by the slice. More...
|
|
This class is a parser for slices of the form i:j:k where i, j and k are integers representing respectively the starting point, the stopping point and the period.
◆ SliceParser()
utils::parser::SliceParser::SliceParser |
( |
const std::string & |
instr, |
|
|
bool |
isBTD = false |
|
) |
| |
Constructor of the SliceParser class.
- Parameters
-
[in] | instr | an input string of the form "i:j:k", "i:j" or "k" where i, j and k are integers representing respectively the starting point, the stopping point and the period. Any of these integers may be omitted in which case it will be equal to their default value (0 for the starting point, std::numeric_limits<int>::max() for the stopping point and 1 for the period). For example SliceParser(":1000:") is equivalent to SliceParser("0:1000:1"). |
[in] | isBTD | whether this is a back-transformed diagnostic |
◆ contains()
bool utils::parser::SliceParser::contains |
( |
int |
n | ) |
const |
A method that returns true if the input integer is contained in the slice. (e.g. if the list is initialized with "300:500:100", this method returns true if and only if n is 300, 400 or 500). If the period is negative or 0, the function always returns false.
- Parameters
-
◆ getPeriod()
int utils::parser::SliceParser::getPeriod |
( |
| ) |
const |
A method that returns the slice period.
◆ getStart()
int utils::parser::SliceParser::getStart |
( |
| ) |
const |
A method that returns the slice start.
◆ getStop()
int utils::parser::SliceParser::getStop |
( |
| ) |
const |
A method that returns the slice stop.
◆ nextContains()
int utils::parser::SliceParser::nextContains |
( |
int |
n | ) |
const |
A method that returns the smallest integer strictly greater than n such that contains(n) is true. Returns std::numeric_limits<int>::max() if there is no such integer.
- Parameters
-
◆ numContained()
int utils::parser::SliceParser::numContained |
( |
| ) |
const |
A method that returns the number of integers contained by the slice.
◆ previousContains()
int utils::parser::SliceParser::previousContains |
( |
int |
n | ) |
const |
A method that returns the greatest integer strictly smaller than n such that contains(n) is true. Returns 0 if there is no such integer.
- Parameters
-
◆ m_isBTD
bool utils::parser::SliceParser::m_isBTD = false |
|
private |
◆ m_period
int utils::parser::SliceParser::m_period = 1 |
|
private |
◆ m_separator
std::string utils::parser::SliceParser::m_separator = ":" |
|
private |
◆ m_start
int utils::parser::SliceParser::m_start = 0 |
|
private |
◆ m_stop
int utils::parser::SliceParser::m_stop = std::numeric_limits<int>::max() |
|
private |
The documentation for this class was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/warpx/checkouts/latest/Source/Utils/Parser/IntervalsParser.H
- /home/docs/checkouts/readthedocs.org/user_builds/warpx/checkouts/latest/Source/Utils/Parser/IntervalsParser.cpp