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

491 {
492 out<<std::string(c);
493 return out;
494}

◆ operator>>()

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

Definition at line 498 of file IdentifierField.cxx.

498 {
499 idf.clear();
500 while (std::isspace(is.peek())){is.ignore();}
501 char c = is.peek();
502 if (c =='*'){
503 is.ignore();
504 //do nothing; the 'clear' set idf to unbounded
505 } else if (isDigit(c)){
506 if (c =='+') is.ignore();
507 int v = parseStreamDigits(is);//'is' ptr is incremented
508 c = is.peek();
509 //possible: bound, list
510 if (c == ','){ //found comma, so definitely list
511 is.ignore();
512 std::vector<int> vec(1,v);
513 const auto & restOfList = parseStreamList(is);
514 vec.insert(vec.end(), restOfList.begin(), restOfList.end());
515 idf.set(vec);
516 } else if (c == ':'){ //bounded
517 is.ignore();
518 c=is.peek(); //peek char after the colon
519 if (isDigit(c)){ //bounded
520 int v1 = parseStreamDigits(is);
521 idf.set(v,v1);
522 }
523 } else { //remaining alternative: single number
524 idf.add_value(v);
525 }
526 } else {
527 std::string msg{"Stream extraction for IdentifierField: "};
528 std::string remains;
529 is >> remains;
530 msg+=remains;
531 throw std::invalid_argument(msg);
532 }
533 return is;
534}
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