Jpp  18.1.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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::stringoperator() (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 241 of file JDetectorVersion.hh.

Constructor & Destructor Documentation

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

Constructor.

Parameters
inputdetector versions

Definition at line 249 of file JDetectorVersion.hh.

250  {
251  using namespace std;
252 
253  for (JGetDetectorVersion::const_iterator i = input.begin(); i != input.end(); ++i) {
254  this->insert(make_pair(i->second, i->first));
255  }
256  }

Member Function Documentation

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

Put detector version.

Parameters
valuenumerical value
Returns
version

Definition at line 265 of file JDetectorVersion.hh.

266  {
267  const_iterator i = this->find(value);
268 
269  if (i != this->end()) {
270  return i->second;
271  } else {
272  THROW(JTypeInformationException, "Invalid value <" << value << ">");
273  }
274  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
int JDETECTOR::JPutDetectorVersion::operator[] ( const JDetectorVersion::JVersion_t value) const
inline

Get index of version.

Parameters
valuenumerical value
Returns
index

Definition at line 283 of file JDetectorVersion.hh.

284  {
285  using namespace std;
286 
287  const_iterator i = this->find(value);
288 
289  if (i != this->end())
290  return distance(this->begin(), i);
291  else
292  return -1;
293  }
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: