43 : name(a_name), begin(a_begin), end(a_end) {
44 if ( lab0.size() )
setLabel(0, lab0);
45 if ( lab1.size() )
setLabel(1, lab1);
46 if ( lab2.size() )
setLabel(2, lab2);
47 if ( lab3.size() )
setLabel(3, lab3);
53 std::string::size_type ipos = srem.find(
":");
54 if ( ipos ==0 || ipos == std::string::npos )
return;
57 srem = srem.substr(ipos+1);
58 if ( srem.size() == 0 )
return;
59 ipos = srem.find(
":");
60 if ( ipos ==0 || ipos == std::string::npos )
return;
62 if ( swrd.find_first_not_of(
"0123456789") != std::string::npos )
return;
63 Index beginTmp = std::stoi(swrd);
65 srem = srem.substr(ipos+1);
66 if ( srem.size() == 0 )
return;
67 ipos = srem.find(
":");
68 if ( ipos ==0 )
return;
69 swrd = srem.substr(0, ipos);
70 if ( swrd.find_first_not_of(
"0123456789" ) != std::string::npos )
return;
71 Index endTmp = std::stoi(swrd);
72 if ( endTmp <= beginTmp )
return;
79 while ( ipos != std::string::npos ) {
80 srem = srem.substr(ipos+1);
81 swrd = srem.substr(0, ipos);
82 ipos = srem.find(
":");
88 Index size()
const {
return end>begin ? end - begin : 0; }
96 Index last()
const {
return end > 0 ? end - 1 : 0; }
103 labels.resize(ilab+1,
"");
107 if ( ilab >= labels.size() )
return "";
115 lhs << ir.
name <<
": ";
116 if ( ir.
size() == 0 ) {
118 }
else if ( ir.
size() == 1 ) {
121 lhs <<
"[" << ir.
begin <<
", " << ir.
end <<
")";
125 if ( first ) first =
false;
bool operator<(const IndexRange &rhs) const
std::vector< Name > NameVector
IndexRange(Name a_name, Index a_begin, Index a_end, Name lab0="", Name lab1="", Name lab2="", Name lab3="")
std::ostream & operator<<(std::ostream &lhs, const IndexRange &ir)
bool contains(Index ival) const
IndexRange(Index a_begin, Index a_end)
Name label(Index ilab=0) const
void setLabel(Index ilab, Name lab)
std::string rangeString() const
std::string to_string(ModuleType const mt)