Classes | Functions
IndexRangeGroup.h File Reference
#include "dunecore/DuneInterface/Data/IndexRange.h"

Go to the source code of this file.

Classes

class  IndexRangeGroup
 

Functions

std::ostream & operator<< (std::ostream &lhs, const IndexRangeGroup &ir)
 

Function Documentation

std::ostream& operator<< ( std::ostream &  lhs,
const IndexRangeGroup ir 
)

Definition at line 101 of file IndexRangeGroup.h.

101  {
102  if ( ir.size() == 0 ) {
103  lhs << ir.name << ": <empty>";
104  // If the group holds one range and the range and group names are the same,
105  // then print the range.
106  } else if ( ir.size() == 1 && ir.range(0).name == ir.name ) {
107  lhs << ir.range(0);
108  } else {
109  lhs << ir.name << ": [";
110  bool first = true;
111  for ( const IndexRange& ran : ir.ranges ) {
112  if ( first ) first = false;
113  else lhs << ", ";
114  lhs << ran.name;
115  }
116  lhs << "]";
117  first = true;
118  for ( std::string lab : ir.labels ) {
119  if ( first ) first = false;
120  else lhs << ",";
121  lhs << " " << lab;
122  }
123  }
124  return lhs;
125 }
std::string string
Definition: nybbler.cc:12
IndexRange range(Index iran) const
Name name
Definition: IndexRange.h:32
RangeVector ranges
NameVector labels
Index size() const