Jpp
Public Member Functions | List of all members
JDETECTOR::JGetDetectorVersion Struct Reference

Auxiliary class to map detector variant to detector version. More...

#include <JDetectorVersion.hh>

Inheritance diagram for JDETECTOR::JGetDetectorVersion:
std::map< std::string, JDetectorVersion::JVersion_t >

Public Member Functions

 JGetDetectorVersion ()
 Default constructor. More...
 
JDetectorVersion::JVersion_t operator() (const std::string &variant) const
 Get detector version. More...
 
JDetectorVersion::JVersion_t operator() (const JDetectorVersion &version) const
 Get detector version. More...
 

Detailed Description

Auxiliary class to map detector variant to detector version.

Definition at line 70 of file JDetectorVersion.hh.

Constructor & Destructor Documentation

◆ JGetDetectorVersion()

JDETECTOR::JGetDetectorVersion::JGetDetectorVersion ( )
inline

Default constructor.

Definition at line 76 of file JDetectorVersion.hh.

77  {
78  using namespace JPP;
79 
80 #define MAKE_ENTRY(A) std::make_pair(to_upper(getClassname(#A)), A)
81 
82  this->insert(MAKE_ENTRY(JDetectorVersion::V1));
83  this->insert(MAKE_ENTRY(JDetectorVersion::V2));
84  this->insert(MAKE_ENTRY(JDetectorVersion::V3));
85 
86 #undef MAKE_ENTRY
87  }

Member Function Documentation

◆ operator()() [1/2]

JDetectorVersion::JVersion_t JDETECTOR::JGetDetectorVersion::operator() ( const std::string &  variant) const
inline

Get detector version.

Parameters
variantvariant
Returns
version

Definition at line 96 of file JDetectorVersion.hh.

97  {
98  using namespace JPP;
99 
100  const_iterator i = this->find(to_upper(variant));
101 
102  if (i != this->end()) {
103  return i->second;
104  } else {
105  THROW(JTypeInformationException, "Invalid variant <" << variant << ">");
106  }
107  }

◆ operator()() [2/2]

JDetectorVersion::JVersion_t JDETECTOR::JGetDetectorVersion::operator() ( const JDetectorVersion version) const
inline

Get detector version.

Parameters
versionversion
Returns
version

Definition at line 116 of file JDetectorVersion.hh.

117  {
118  return (*this)(version.getVariant());
119  }

The documentation for this struct was generated from the following file:
JDETECTOR::JDetectorVersion::V2
Version with UTC time and UTM position data.
Definition: JDetectorVersion.hh:44
JDETECTOR::JDetectorVersion::V3
Version with PMT status field and comments.
Definition: JDetectorVersion.hh:45
JLANG::to_upper
std::string to_upper(const std::string &value)
Convert all character to upper case.
Definition: JLangToolkit.hh:229
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JDETECTOR::JDetectorVersion::V1
First version.
Definition: JDetectorVersion.hh:43
MAKE_ENTRY
#define MAKE_ENTRY(A)
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:669
JEEP::JVersion::getVariant
const std::string & getVariant() const
Get variant.
Definition: JVersion.hh:90