Jpp 21.0.0-rc.1-88-g0130508c4
the software that should make you happy
Loading...
Searching...
No Matches
JCALIBRATE::transmittances_type Struct Reference

Auxiliary data structure for I/O of transmittances of optical modules in detector. More...

#include <JTransmittances.hh>

Inheritance diagram for JCALIBRATE::transmittances_type:
std::map< int, transmittance_type > JLANG::JObjectStreamIO< T >

Public Member Functions

transmittance_type operator[] (const int id) const
 Get transmittances of given optical module.
 
void load (const char *file_name)
 Load from input file.
 
void store (const char *file_name) const
 Store to output file.
 

Friends

std::istream & operator>> (std::istream &in, transmittances_type &transmittances)
 Read transmittances from input stream.
 
std::ostream & operator<< (std::ostream &out, const transmittances_type &transmittances)
 Write transmittances to output stream.
 

Detailed Description

Auxiliary data structure for I/O of transmittances of optical modules in detector.

Definition at line 94 of file JTransmittances.hh.

Member Function Documentation

◆ operator[]()

transmittance_type JCALIBRATE::transmittances_type::operator[] ( const int id) const
inline

Get transmittances of given optical module.

In the absence of a module identifier, default values are returned.

Parameters
idmodule identifier
Returns
transmittances

Definition at line 108 of file JTransmittances.hh.

109 {
110 const_iterator p = find(id);
111
112 if (p != this->end())
113 return p->second;
114 else
115 return transmittance_type();
116 }

◆ load()

template<class T >
void JLANG::JObjectStreamIO< T >::load ( const char * file_name)
inlineinherited

Load from input file.

Parameters
file_namefile name

Definition at line 30 of file JObjectStreamIO.hh.

31 {
32 JLANG::load<std::ifstream>(file_name, static_cast<T&>(*this));
33 }
void load(const std::string &file_name, T &object)
Load object from input file.
Definition JObjectIO.hh:55

◆ store()

template<class T >
void JLANG::JObjectStreamIO< T >::store ( const char * file_name) const
inlineinherited

Store to output file.

Parameters
file_namefile name

Definition at line 41 of file JObjectStreamIO.hh.

42 {
43 JLANG::store<std::ofstream>(file_name, static_cast<const T&>(*this));
44 }
void store(const std::string &file_name, const T &object)
Store object to output file.
Definition JObjectIO.hh:68

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
transmittances_type & transmittances )
friend

Read transmittances from input stream.

Parameters
ininput stream
transmittancestransmittances
Returns
input stream

Definition at line 126 of file JTransmittances.hh.

127 {
128 int id;
129 transmittance_type transmittance;
130
131 while (in >> id >> transmittance) {
132 transmittances[id] = transmittance;
133 }
134
135 return in;
136 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const transmittances_type & transmittances )
friend

Write transmittances to output stream.

Parameters
outoutput stream
transmittancestransmittances
Returns
output stream

Definition at line 146 of file JTransmittances.hh.

147 {
148 using namespace std;
149
150 for (const auto& i : transmittances) {
151 out << i.first << ' ' << i.second << endl;
152 }
153
154 return out;
155 }

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