Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
 JHeadSet (JMultipleFileScanner_t &input)
 Constructor.
 
void put (JMultipleFileScanner_t &input)
 Put headers from given list of files.
 
void put (const std::string &input)
 Put header from given file.
 
const JHeadget (const std::string &input) const
 Get header for given file.
 

Public Attributes

JComparator_t compare
 Function object for comparison of headers.
 

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

◆ JHeadSet() [1/2]

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

Default constructor.

Definition at line 35 of file JHeadSet.hh.

36 {}

◆ JHeadSet() [2/2]

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

◆ put() [1/2]

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 }

◆ put() [2/2]

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 }
Monte Carlo run header.
Definition JHead.hh:1236
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
JComparator_t compare
Function object for comparison of headers.
Definition JHeadSet.hh:105

◆ get()

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.
Exception for accessing a value in a collection that is outside of its range.

Member Data Documentation

◆ compare

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: