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) |
| | Constructor of the SliceParser class. More...
|
| |
| bool | contains (const 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 (const 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 (const 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...
|
| |
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()
| SliceParser::SliceParser |
( |
const std::string & |
instr | ) |
|
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"). |
◆ contains()
| bool SliceParser::contains |
( |
const 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 SliceParser::getPeriod |
( |
| ) |
const |
A method that returns the slice period.
◆ getStart()
| int SliceParser::getStart |
( |
| ) |
const |
A method that returns the slice start.
◆ getStop()
| int SliceParser::getStop |
( |
| ) |
const |
A method that returns the slice stop.
◆ nextContains()
| int SliceParser::nextContains |
( |
const 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
-
◆ previousContains()
| int SliceParser::previousContains |
( |
const 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_period
| int SliceParser::m_period = 1 |
|
private |
◆ m_separator
| std::string SliceParser::m_separator = ":" |
|
private |
◆ m_start
| int SliceParser::m_start = 0 |
|
private |
◆ m_stop
| int 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/20.10/Source/Utils/IntervalsParser.H
- /home/docs/checkouts/readthedocs.org/user_builds/warpx/checkouts/20.10/Source/Utils/IntervalsParser.cpp