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 475 of file IdentifierField.cxx.

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

◆ operator>>()

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

Definition at line 483 of file IdentifierField.cxx.

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