ATLAS Offline Software
Functions
IdentifierField.cxx File Reference
#include "Identifier/IdentifierField.h"
#include "src/IdentifierFieldParser.h"
#include <algorithm>
#include <iostream>
#include <bit>
#include <array>
#include <cctype>
#include <format>
#include <tuple>
#include <functional>

Go to the source code of this file.

Functions

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

Function Documentation

◆ operator<<()

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

Definition at line 474 of file IdentifierField.cxx.

475  {
476  out<<std::string(c);
477  return out;
478 }

◆ operator>>()

std::istream& operator>> ( std::istream &  is,
IdentifierField idf 
)

Definition at line 482 of file IdentifierField.cxx.

482  {
483  idf.clear();
484  while (std::isspace(is.peek())){is.ignore();}
485  char c = is.peek();
486  if (c =='*'){
487  is.ignore();
488  //do nothing; the 'clear' set idf to unbounded
489  } else if (isDigit(c)){
490  if (c =='+') is.ignore();
491  int v = parseStreamDigits(is);//'is' ptr is incremented
492  c = is.peek();
493  //possible: bound, list
494  if (c == ','){ //found comma, so definitely list
495  is.ignore();
496  std::vector<int> vec(1,v);
497  const auto & restOfList = parseStreamList(is);
498  vec.insert(vec.end(), restOfList.begin(), restOfList.end());
499  idf.set(vec);
500  } else if (c == ':'){ //bounded
501  is.ignore();
502  c=is.peek(); //peek char after the colon
503  if (isDigit(c)){ //bounded
504  int v1 = parseStreamDigits(is);
505  idf.set(v,v1);
506  }
507  } else { //remaining alternative: single number
508  idf.add_value(v);
509  }
510  } else {
511  std::string msg{"Stream extraction for IdentifierField: "};
512  std::string remains;
513  is >> remains;
514  msg+=remains;
515  throw std::invalid_argument(msg);
516  }
517  return is;
518 }
Identifier::parseStreamDigits
IdentifierField::element_type parseStreamDigits(std::istream &is)
Definition: IdentifierFieldParser.cxx:21
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
IdentifierField::clear
void clear()
Set methods.
Definition: IdentifierField.cxx:223
IdentifierField::set
void set(element_type minimum, element_type maximum)
Definition: IdentifierField.cxx:236
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
IdentifierField::add_value
void add_value(element_type value)
Definition: IdentifierField.cxx:249