Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Public Member Functions | Friends | List of all members
JAANET::JEvtCategorySet Struct Reference

Container for a set of event categories. More...

#include <JEvtCategoryToolkit.hh>

Inheritance diagram for JAANET::JEvtCategorySet:
std::set< JEvtCategoryHelper >

Public Member Functions

 JEvtCategorySet ()
 Default constructor. More...
 

Friends

std::istream & operator>> (std::istream &in, JEvtCategorySet &categories)
 Stream input. More...
 
std::ostream & operator<< (std::ostream &out, const JEvtCategorySet &categories)
 Stream output. More...
 

Detailed Description

Container for a set of event categories.

Input syntax as follows:

      <PDG type> [& <PDG type>]...
      <key>=<value>[,<key>=<value>]...[ & <key>=<value>[,<key>=<value>]...]...

where

Definition at line 43 of file JEvtCategoryToolkit.hh.

Constructor & Destructor Documentation

◆ JEvtCategorySet()

JAANET::JEvtCategorySet::JEvtCategorySet ( )
inline

Default constructor.

Definition at line 49 of file JEvtCategoryToolkit.hh.

50  {}

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
JEvtCategorySet categories 
)
friend

Stream input.

Parameters
ininput stream
categoriesset of event categories
Returns
input stream

Definition at line 60 of file JEvtCategoryToolkit.hh.

61  {
62  using namespace std;
63  using namespace JPP;
64 
65  for (JToken<'&'> token; in >> token; ) {
66 
67  JEvtCategoryHelper category;
68 
69  istringstream iss(token);
70  iss >> category;
71 
72  if (!fail(iss)) { categories.insert(category); }
73  }
74 
75  return in;
76  }
Wrapper class around string.
Definition: JToken.hh:26
bool fail(std::istream &in)
Check for stream state.
Definition: JParser.hh:98
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Helper class for event categories.

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const JEvtCategorySet categories 
)
friend

Stream output.

Parameters
outoutput stream
categoriesset of event categories
Returns
output stream

Definition at line 86 of file JEvtCategoryToolkit.hh.

87  {
88  using namespace std;
89  using namespace JPP;
90 
91  if (categories.size() > 0) {
92  out << *categories.cbegin();
93  }
94 
95  for (iterator i = next(categories.cbegin()); i != categories.cend(); ++i) {
96  out << " & " << *i;
97  }
98 
99  return out;
100  }

The documentation for this struct was generated from the following file: