ATLAS Offline Software
Classes | Functions
IdentifierField.h File Reference
#include <Identifier/ExpandedIdentifier.h>
#include <vector>
#include <string>
#include <stdexcept>
#include <iosfwd>
#include <limits>
Include dependency graph for IdentifierField.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  IdentifierField
 This is the individual specification for the range of one ExpandedIdentifier IdentifierField. More...
 

Functions

std::ostream & operator<< (std::ostream &out, const IdentifierField &c)
 
std::istream & operator>> (std::istream &in, IdentifierField &c)
 

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  out,
const IdentifierField c 
)

Definition at line 734 of file IdentifierField.cxx.

735  {
736  out<<std::string(c);
737  return out;
738 }

◆ operator>>()

std::istream& operator>> ( std::istream &  in,
IdentifierField c 
)

Definition at line 742 of file IdentifierField.cxx.

742  {
743  idf.clear();
744  while (std::isspace(is.peek())){is.ignore();}
745  char c = is.peek();
746  if (c =='*'){
747  is.ignore();
748  //do nothing; the 'clear' set idf to unbounded
749  } else if (c==':'){ //upper bound
750  is.ignore();
751  idf.set_maximum(parseStreamDigits(is));
752  } else if (isDigit(c)){
753  if (c =='+') is.ignore();
754  int v = parseStreamDigits(is);//i is incremented
755  c = is.peek();
756  //possible: lowerbound, bound, list
757  if (c == ','){ //found comma, so definitely list
758  is.ignore();
759  std::vector<int> vec(1,v);
760  const auto & restOfList = parseStreamList(is);
761  vec.insert(vec.end(), restOfList.begin(), restOfList.end());
762  idf.set(vec);
763  } else if (c == ':'){ //bounded, or lower bound
764  is.ignore();
765  c=is.peek(); //peek char after the colon
766  if (isDigit(c)){ //bounded
767  int v1 = parseStreamDigits(is);
768  idf.set(v,v1);
769  } else { //lower bound
770  idf.set_minimum(v);
771  }
772  } else { //remaining alternative: single number
773  idf.add_value(v);
774  }
775  } else {
776  std::string msg{"Stream extraction for IdentifierField: "};
777  std::string remains;
778  is >> remains;
779  msg+=remains;
780  throw std::invalid_argument(msg);
781  }
782  return is;
783 }
Identifier::parseStreamDigits
IdentifierField::element_type parseStreamDigits(std::istream &is)
Definition: IdentifierFieldParser.cxx:21
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
Identifier::parseStreamList
IdentifierField::element_vector parseStreamList(std::istream &is)
Definition: IdentifierFieldParser.cxx:37
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
Identifier::isDigit
bool isDigit(const char c)
Definition: IdentifierFieldParser.cxx:16
python.PyAthena.v
v
Definition: PyAthena.py:154
python.compressB64.c
def c
Definition: compressB64.py:93
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7