Jpp  17.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
JSUPPORT::JHeadSet< JComparator_t > Struct Template Reference

Auxiliary class for organising Monte Carlo run headers. More...

#include <JHeadSet.hh>

Inheritance diagram for JSUPPORT::JHeadSet< JComparator_t >:
std::vector< JHead >

Public Member Functions

 JHeadSet ()
 Default constructor. More...
 
 JHeadSet (JMultipleFileScanner_t &input)
 Constructor. More...
 
void put (JMultipleFileScanner_t &input)
 Put headers from given list of files. More...
 
void put (const std::string &input)
 Put header from given file. More...
 
const JHeadget (const std::string &input) const
 Get header for given file. More...
 

Public Attributes

JComparator_t compare
 Function object for comparison of headers. More...
 

Detailed Description

template<class JComparator_t = std::less<JHead>>
struct JSUPPORT::JHeadSet< JComparator_t >

Auxiliary class for organising Monte Carlo run headers.

Definition at line 29 of file JHeadSet.hh.

Constructor & Destructor Documentation

template<class JComparator_t = std::less<JHead>>
JSUPPORT::JHeadSet< JComparator_t >::JHeadSet ( )
inline

Default constructor.

Definition at line 35 of file JHeadSet.hh.

36  {}
template<class JComparator_t = std::less<JHead>>
JSUPPORT::JHeadSet< JComparator_t >::JHeadSet ( JMultipleFileScanner_t input)
inline

Constructor.

Parameters
inputfile list

Definition at line 44 of file JHeadSet.hh.

45  {
46  put(input);
47  }
void put(JMultipleFileScanner_t &input)
Put headers from given list of files.
Definition: JHeadSet.hh:55

Member Function Documentation

template<class JComparator_t = std::less<JHead>>
void JSUPPORT::JHeadSet< JComparator_t >::put ( JMultipleFileScanner_t input)
inline

Put headers from given list of files.

Parameters
inputfile list

Definition at line 55 of file JHeadSet.hh.

56  {
57  for (JMultipleFileScanner_t::const_iterator i = input.begin(); i != input.end(); ++i) {
58  this->put(*i);
59  }
60  }
void put(JMultipleFileScanner_t &input)
Put headers from given list of files.
Definition: JHeadSet.hh:55
template<class JComparator_t = std::less<JHead>>
void JSUPPORT::JHeadSet< JComparator_t >::put ( const std::string input)
inline

Put header from given file.

Parameters
inputfile name

Definition at line 68 of file JHeadSet.hh.

69  {
70  using namespace std;
71  using namespace JPP;
72 
73  const JHead head = getHeader(input);
74 
75  iterator p = lower_bound(this->begin(), this->end(), head, compare);
76 
77  if (p != this->end() && *p == head)
78  p->add(head);
79  else
80  this->insert(p, head);
81  }
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
JComparator_t compare
Function object for comparison of headers.
Definition: JHeadSet.hh:105
Monte Carlo run header.
Definition: JHead.hh:1167
template<class JComparator_t = std::less<JHead>>
const JHead& JSUPPORT::JHeadSet< JComparator_t >::get ( const std::string input) const
inline

Get header for given file.

Parameters
inputfile name

Definition at line 89 of file JHeadSet.hh.

90  {
91  const JHead head = getHeader(input);
92 
93  const_iterator p = lower_bound(this->begin(), this->end(), head, compare);
94 
95  if (p != this->end())
96  return *p;
97  else
98  THROW(JValueOutOfRange, "No corresponding header for file " << input);
99  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
JComparator_t compare
Function object for comparison of headers.
Definition: JHeadSet.hh:105
Monte Carlo run header.
Definition: JHead.hh:1167
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162

Member Data Documentation

template<class JComparator_t = std::less<JHead>>
JComparator_t JSUPPORT::JHeadSet< JComparator_t >::compare

Function object for comparison of headers.

Definition at line 105 of file JHeadSet.hh.


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