ATLAS Offline Software
Loading...
Searching...
No Matches
IdentifierField.h File Reference
#include <Identifier/ExpandedIdentifier.h>
#include <vector>
#include <string>
#include <stdexcept>
#include <iosfwd>
#include <limits>
#include <utility>
#include <variant>
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 481 of file IdentifierField.cxx.

482 {
483 out<<std::string(c);
484 return out;
485}

◆ operator>>()

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

Definition at line 489 of file IdentifierField.cxx.

489 {
490 idf.clear();
491 while (std::isspace(is.peek())){is.ignore();}
492 char c = is.peek();
493 if (c =='*'){
494 is.ignore();
495 //do nothing; the 'clear' set idf to unbounded
496 } else if (isDigit(c)){
497 if (c =='+') is.ignore();
498 int v = parseStreamDigits(is);//'is' ptr is incremented
499 c = is.peek();
500 //possible: bound, list
501 if (c == ','){ //found comma, so definitely list
502 is.ignore();
503 std::vector<int> vec(1,v);
504 const auto & restOfList = parseStreamList(is);
505 vec.insert(vec.end(), restOfList.begin(), restOfList.end());
506 idf.set(vec);
507 } else if (c == ':'){ //bounded
508 is.ignore();
509 c=is.peek(); //peek char after the colon
510 if (isDigit(c)){ //bounded
511 int v1 = parseStreamDigits(is);
512 idf.set(v,v1);
513 }
514 } else { //remaining alternative: single number
515 idf.add_value(v);
516 }
517 } else {
518 std::string msg{"Stream extraction for IdentifierField: "};
519 std::string remains;
520 is >> remains;
521 msg+=remains;
522 throw std::invalid_argument(msg);
523 }
524 return is;
525}
std::vector< size_t > vec
bool isDigit(const char c)
IdentifierField::element_type parseStreamDigits(std::istream &is)
IdentifierField::element_vector parseStreamList(std::istream &is)
MsgStream & msg
Definition testRead.cxx:32