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

Auxiliary class to map numerical value to detector version. More...

#include <JDetectorVersion.hh>

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

Public Member Functions

 JPutDetectorVersion (const JGetDetectorVersion &input)
 Constructor. More...
 
const std::string & operator() (const JDetectorVersion::JVersion_t &value) const
 Put detector version. More...
 
int operator[] (const JDetectorVersion::JVersion_t &value) const
 Get index of version. More...
 

Detailed Description

Auxiliary class to map numerical value to detector version.

Definition at line 252 of file JDetectorVersion.hh.

Constructor & Destructor Documentation

◆ JPutDetectorVersion()

JDETECTOR::JPutDetectorVersion::JPutDetectorVersion ( const JGetDetectorVersion input)
inline

Constructor.

Parameters
inputdetector versions

Definition at line 260 of file JDetectorVersion.hh.

261  {
262  using namespace std;
263 
264  for (JGetDetectorVersion::const_iterator i = input.begin(); i != input.end(); ++i) {
265  this->insert(make_pair(i->second, i->first));
266  }
267  }
Definition: JSTDTypes.hh:14

Member Function Documentation

◆ operator()()

const std::string& JDETECTOR::JPutDetectorVersion::operator() ( const JDetectorVersion::JVersion_t value) const
inline

Put detector version.

Parameters
valuenumerical value
Returns
version

Definition at line 276 of file JDetectorVersion.hh.

277  {
278  const_iterator i = this->find(value);
279 
280  if (i != this->end()) {
281  return i->second;
282  } else {
283  THROW(JTypeInformationException, "Invalid value <" << value << ">");
284  }
285  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
Exception for absence of type information.
Definition: JException.hh:648

◆ operator[]()

int JDETECTOR::JPutDetectorVersion::operator[] ( const JDetectorVersion::JVersion_t value) const
inline

Get index of version.

Parameters
valuenumerical value
Returns
index

Definition at line 294 of file JDetectorVersion.hh.

295  {
296  using namespace std;
297 
298  const_iterator i = this->find(value);
299 
300  if (i != this->end())
301  return distance(this->begin(), i);
302  else
303  return -1;
304  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.

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