Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JOSCPROB::JOscParametersInterface< T > Class Template Referenceabstract

Interface class for sets of oscillation parameters. More...

#include <JOscParametersInterface.hh>

Inheritance diagram for JOSCPROB::JOscParametersInterface< T >:
JLANG::JClonable< JClonable_t, JDerived_t > JIO::JSerialisable

Public Types

typedef JOscParametersInterface< T > JOscParametersInterface_t
 
typedef JOscParameter< T > JOscParameter_t
 
typedef JOscParameter_t::JParameter_t JParameter_t
 
typedef JParameter_t::argument_type argument_type
 
typedef JParameter_t::value_type value_type
 
typedef JClonable< JClonable_t >::clone_type clone_type
 

Public Member Functions

 JOscParametersInterface ()
 Default constructor.
 
 ~JOscParametersInterface ()
 Virtual destructor.
 
virtual JProperties getProperties (const JEquationParameters &equation=JOscParametersInterface_t::getEquationParameters())=0
 Get properties of this class.
 
virtual JProperties getProperties (const JEquationParameters &equation=JOscParametersInterface_t::getEquationParameters()) const =0
 Get properties of this class.
 
JOscParametersInterface_tgetParameters ()
 Get oscillation parameters.
 
const JOscParameter_tget (const std::string &name) const
 Get oscillation parameter.
 
JOscParameter_tget (const std::string &name)
 Get oscillation parameter.
 
void set (const std::string &name, const value_type &value)
 Set value for a given oscillation parameter.
 
template<class ... Args>
void set (const std::string &name, const value_type &value, const Args &...args)
 Set value for given list of oscillation parameters.
 
void set (const JOscParametersInterface< value_type > &parameters)
 Set oscillation parameters.
 
bool equals (const JOscParametersInterface< value_type > &parameters) const
 Check whether these oscillation parameters are equal to given oscillation parameters.
 
bool operator== (const JOscParametersInterface< value_type > &parameters)
 Equal operator.
 
bool operator!= (const JOscParametersInterface< value_type > &parameters)
 Not equal operator.
 
JReaderread (JReader &in) override
 Binary stream input of oscillation parameters.
 
JWriterwrite (JWriter &out) const override
 Binary stream output of oscillation parameters.
 
virtual clone_type clone () const override
 Get clone of this object.
 

Static Public Member Functions

static JEquationParametersgetEquationParameters ()
 Get equation parameters.
 
static void setEquationParameters (const JEquationParameters &equation)
 Set equation parameters.
 

Friends

std::istream & operator>> (std::istream &in, JOscParametersInterface_t &parameters)
 Stream input of oscillation parameters.
 
std::ostream & operator<< (std::ostream &out, const JOscParametersInterface_t &parameters)
 Stream output of oscillation parameters.
 

Detailed Description

template<class T>
class JOSCPROB::JOscParametersInterface< T >

Interface class for sets of oscillation parameters.

Definition at line 46 of file JOscParametersInterface.hh.

Member Typedef Documentation

◆ JOscParametersInterface_t

template<class T >
JOscParametersInterface<T> JOSCPROB::JOscParametersInterface< T >::JOscParametersInterface_t

Definition at line 52 of file JOscParametersInterface.hh.

◆ JOscParameter_t

template<class T >
JOscParameter<T> JOSCPROB::JOscParametersInterface< T >::JOscParameter_t

Definition at line 53 of file JOscParametersInterface.hh.

◆ JParameter_t

Definition at line 55 of file JOscParametersInterface.hh.

◆ argument_type

template<class T >
JParameter_t::argument_type JOSCPROB::JOscParametersInterface< T >::argument_type

Definition at line 57 of file JOscParametersInterface.hh.

◆ value_type

template<class T >
JParameter_t::value_type JOSCPROB::JOscParametersInterface< T >::value_type

Definition at line 58 of file JOscParametersInterface.hh.

◆ clone_type

template<class JClonable_t , class JDerived_t >
JClonable<JClonable_t>::clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone_type
inherited

Definition at line 61 of file JClonable.hh.

Constructor & Destructor Documentation

◆ JOscParametersInterface()

template<class T >
JOSCPROB::JOscParametersInterface< T >::JOscParametersInterface ( )
inline

Default constructor.

Definition at line 64 of file JOscParametersInterface.hh.

65 {}

◆ ~JOscParametersInterface()

template<class T >
JOSCPROB::JOscParametersInterface< T >::~JOscParametersInterface ( )
inline

Virtual destructor.

Definition at line 71 of file JOscParametersInterface.hh.

72 {}

Member Function Documentation

◆ getProperties() [1/2]

template<class T >
virtual JProperties JOSCPROB::JOscParametersInterface< T >::getProperties ( const JEquationParameters & equation = JOscParametersInterface_t::getEquationParameters())
pure virtual

Get properties of this class.

Parameters
equationequation parameters
Returns
properties of this class

◆ getProperties() [2/2]

template<class T >
virtual JProperties JOSCPROB::JOscParametersInterface< T >::getProperties ( const JEquationParameters & equation = JOscParametersInterface_t::getEquationParameters()) const
pure virtual

Get properties of this class.

Parameters
equationequation parameters
Returns
properties of this class

◆ getParameters()

template<class T >
JOscParametersInterface_t & JOSCPROB::JOscParametersInterface< T >::getParameters ( )
inline

Get oscillation parameters.

Returns
reference to oscillation parameters

Definition at line 98 of file JOscParametersInterface.hh.

99 {
100 return static_cast<JOscParametersInterface_t&>(*this);
101 }
JOscParametersInterface< T > JOscParametersInterface_t

◆ get() [1/2]

template<class T >
const JOscParameter_t & JOSCPROB::JOscParametersInterface< T >::get ( const std::string & name) const
inline

Get oscillation parameter.

Parameters
nameparameter name
Returns
parameter

Definition at line 110 of file JOscParametersInterface.hh.

111 {
112 using namespace std;
113 using namespace JPP;
114
115 JProperties properties = this->getProperties();
116
117 const JOscParameter_t& parameter = properties.getValue<const JOscParameter_t>(name);
118
119 return parameter;
120 }
Utility class to parse parameter values.
const T & getValue(const std::string &key) const
Get value.
virtual JProperties getProperties(const JEquationParameters &equation=JOscParametersInterface_t::getEquationParameters())=0
Get properties of this class.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

◆ get() [2/2]

template<class T >
JOscParameter_t & JOSCPROB::JOscParametersInterface< T >::get ( const std::string & name)
inline

Get oscillation parameter.

Parameters
nameparameter name
Returns
parameter

Definition at line 129 of file JOscParametersInterface.hh.

130 {
131 using namespace std;
132 using namespace JPP;
133
134 JProperties properties = this->getProperties();
135
136 JOscParameter_t& parameter = properties.getValue<JOscParameter_t>(name);
137
138 return parameter;
139 }

◆ set() [1/3]

template<class T >
void JOSCPROB::JOscParametersInterface< T >::set ( const std::string & name,
const value_type & value )
inline

Set value for a given oscillation parameter.

Parameters
nameparameter name
valueparameter value

Definition at line 148 of file JOscParametersInterface.hh.

150 {
151 using namespace std;
152 using namespace JPP;
153
154 JProperties properties = this->getProperties();
155
156 JOscParameter_t& parameter = properties.getValue<JOscParameter_t>(name);
157
158 parameter.setValue(value);
159 }

◆ set() [2/3]

template<class T >
template<class ... Args>
void JOSCPROB::JOscParametersInterface< T >::set ( const std::string & name,
const value_type & value,
const Args &... args )
inline

Set value for given list of oscillation parameters.

Parameters
nameparameter name
valueparameter value
argsremaining pairs of parameter names and values

Definition at line 170 of file JOscParametersInterface.hh.

173 {
174 set(name, value);
175 set(args...);
176 }
void set(const std::string &name, const value_type &value)
Set value for a given oscillation parameter.

◆ set() [3/3]

template<class T >
void JOSCPROB::JOscParametersInterface< T >::set ( const JOscParametersInterface< value_type > & parameters)
inline

Set oscillation parameters.

Parameters
parametersoscillation parameters

Definition at line 184 of file JOscParametersInterface.hh.

185 {
186 using namespace std;
187 using namespace JPP;
188
189 JProperties properties = parameters.getProperties();
190
191 for (JProperties::const_iterator i = properties.cbegin(); i != properties.cend(); ++i) {
192
193 const JOscParameter<value_type>& parameter = i->second.getValue<const JOscParameter<value_type> >();
194
195 if (parameter.isDefined()) {
196 this->set(i->first, parameter.getValue());
197 }
198 }
199 }
const value_type getValue() const
Get value of parameter.
Definition JParameter.hh:82
const bool isDefined() const
Get status of parameter.
Abstract base class for oscillation parameter.

◆ equals()

template<class T >
bool JOSCPROB::JOscParametersInterface< T >::equals ( const JOscParametersInterface< value_type > & parameters) const
inline

Check whether these oscillation parameters are equal to given oscillation parameters.

Parameters
parametersoscillation parameters
Returns
true if equal; else false

Definition at line 208 of file JOscParametersInterface.hh.

209 {
210 using namespace std;
211 using namespace JPP;
212
213 bool equal = true;
214
215 JProperties properties = this->getProperties();
216
217 for (JProperties::const_iterator i = properties.cbegin(); i != properties.cend() && equal; ++i) {
218
219 const JOscParameter_t& parameter = i->second.getValue<const JOscParameter_t>();
220
221 equal = (parameter == parameters.get(i->first));
222 }
223
224 return equal;
225 }

◆ operator==()

template<class T >
bool JOSCPROB::JOscParametersInterface< T >::operator== ( const JOscParametersInterface< value_type > & parameters)
inline

Equal operator.

Parameters
parametersset of oscillation parameters
Returns
true if this set of oscillation parameters is equal to the given set; else false

Definition at line 234 of file JOscParametersInterface.hh.

235 {
236 return this->equals(parameters);
237 }
bool equals(const JOscParametersInterface< value_type > &parameters) const
Check whether these oscillation parameters are equal to given oscillation parameters.

◆ operator!=()

template<class T >
bool JOSCPROB::JOscParametersInterface< T >::operator!= ( const JOscParametersInterface< value_type > & parameters)
inline

Not equal operator.

Parameters
parametersset of oscillation parameters
Returns
true if this set of oscillation parameters is equal to the given set; else false

Definition at line 246 of file JOscParametersInterface.hh.

247 {
248 return !this->equals(parameters);
249 }

◆ getEquationParameters()

template<class T >
static JEquationParameters & JOSCPROB::JOscParametersInterface< T >::getEquationParameters ( )
inlinestatic

Get equation parameters.

Returns
equation parameters

Definition at line 257 of file JOscParametersInterface.hh.

258 {
259 static JEquationParameters equation("=", "\n\r;,", "./", "#");
260
261 return equation;
262 }
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ setEquationParameters()

template<class T >
static void JOSCPROB::JOscParametersInterface< T >::setEquationParameters ( const JEquationParameters & equation)
inlinestatic

Set equation parameters.

Parameters
equationequation parameters

Definition at line 270 of file JOscParametersInterface.hh.

271 {
272 getEquationParameters() = equation;
273 }
static JEquationParameters & getEquationParameters()
Get equation parameters.

◆ read()

template<class T >
JReader & JOSCPROB::JOscParametersInterface< T >::read ( JReader & in)
inlineoverridevirtual

Binary stream input of oscillation parameters.

Parameters
ininput stream
Returns
input stream

Implements JIO::JSerialisable.

Definition at line 282 of file JOscParametersInterface.hh.

283 {
284 JProperties properties = this->getProperties();
285
286 for (JProperties::iterator i = properties.begin(); i != properties.end(); ++i) {
287
288 bool is_defined;
289 value_type value;
290
291 if ((in >> is_defined >> value) && is_defined) {
292
293 JOscParameter_t& parameter = i->second.getValue<JOscParameter_t>();
294
295 parameter.setValue(value);
296 }
297 }
298
299 return in;
300 }

◆ write()

template<class T >
JWriter & JOSCPROB::JOscParametersInterface< T >::write ( JWriter & out) const
inlineoverridevirtual

Binary stream output of oscillation parameters.

Parameters
outoutput stream
Returns
output stream

Implements JIO::JSerialisable.

Definition at line 309 of file JOscParametersInterface.hh.

310 {
311 const JProperties properties = this->getProperties();
312
313 for (JProperties::const_iterator i = properties.cbegin(); i != properties.cend(); ++i) {
314
315 const JOscParameter_t& parameter = i->second.getValue<const JOscParameter_t>();
316
317 out << parameter.isDefined() << parameter.getValue();
318 }
319
320 return out;
321 }

◆ clone()

template<class JClonable_t , class JDerived_t >
virtual clone_type JLANG::JClonable< JClonable_t, JDerived_t >::clone ( ) const
inlineoverridevirtualinherited

Friends And Related Symbol Documentation

◆ operator>>

template<class T >
std::istream & operator>> ( std::istream & in,
JOscParametersInterface_t & parameters )
friend

Stream input of oscillation parameters.

Parameters
ininput stream
parametersoscillation parameters
Returns
input stream

Definition at line 331 of file JOscParametersInterface.hh.

332 {
333 using namespace std;
334 using namespace JPP;
335
336 JStringStream is(in);
337
338 if (getFileStatus(is.str().c_str())) {
339 is.load();
340 }
341
342 JProperties properties = parameters.getProperties();
343 is >> properties;
344
345 return in;
346 }
Wrapper class around STL stringstream class to facilitate optional loading of data from file.

◆ operator<<

template<class T >
std::ostream & operator<< ( std::ostream & out,
const JOscParametersInterface_t & parameters )
friend

Stream output of oscillation parameters.

Parameters
outoutput stream
parametersoscillation parameters
Returns
output stream

Definition at line 356 of file JOscParametersInterface.hh.

357 {
358 return out << parameters.getProperties();
359 }

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