15 #ifndef IndexRangeGroup_H 16 #define IndexRangeGroup_H 40 : name(a_name), labels(a_labels), ranges(a_ranges) { }
44 : name(a_name), ranges(a_ranges) { }
48 : name(ran.name), labels(ran.labels), ranges(1, ran) { }
54 std::string::size_type ipos = srem.find(
",");
55 if ( ipos == std::string::npos ) {
61 while ( ipos != std::string::npos ) {
62 srem = srem.substr(ipos+1);
63 ipos = srem.find(
",");
67 ranges.push_back(ran);
78 bool isValid()
const {
return name.size() || ranges.size(); }
85 if ( ran.name == name )
return ran;
90 if ( ilab >= labels.size() )
return "";
96 for (
Index ival=ran.begin; ival<ran.end; ++ival ) idxs.push_back(ival);
102 if ( ir.
size() == 0 ) {
103 lhs << ir.
name <<
": <empty>";
109 lhs << ir.
name <<
": [";
112 if ( first ) first =
false;
119 if ( first ) first =
false;
IndexRange range(Name name) const
std::vector< IndexRange > RangeVector
Name label(Index ilab=0) const
IndexRangeGroup(Name a_name, const NameVector &a_labels, const RangeVector &a_ranges)
IndexRangeGroup(std::string sgrp)
IndexRange range(Index iran) const
std::vector< Name > NameVector
std::vector< Index > IndexVector
bool operator<(const IndexRangeGroup &rhs) const
IndexRangeGroup(Name a_name, const RangeVector &a_ranges)
std::ostream & operator<<(std::ostream &lhs, const IndexRangeGroup &ir)
IndexRangeGroup(const IndexRange &ran)
void getIndices(IndexVector &idxs) const