MARLEY (Model of Argon Reaction Low Energy Yields) v2.0.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
Loading...
Searching...
No Matches
HepMC3::LongDoubleAttribute Class Reference

Attribute that holds a real number as a long double. More...

#include <Attribute.h>

Inheritance diagram for HepMC3::LongDoubleAttribute:
HepMC3::Attribute

Public Member Functions

 LongDoubleAttribute ()
 Default constructor.
 
 LongDoubleAttribute (long double val)
 Constructor initializing attribute value.
 
bool from_string (const std::string &att) override
 Implementation of Attribute::from_string.
 
void set_value (const long double &d)
 set the value associated to this Attribute.
 
bool to_string (std::string &att) const override
 Implementation of Attribute::to_string.
 
long double value () const
 get the value associated to this Attribute.
 
- Public Member Functions inherited from HepMC3::Attribute
 Attribute ()
 Default constructor.
 
virtual ~Attribute ()
 Virtual destructor.
 
const GenEventevent () const
 
virtual bool init ()
 Optionally initialize the attribute after from_string.
 
virtual bool init (const GenRunInfo &)
 Optionally initialize the attribute after from_string.
 
bool is_parsed () const
 Check if this attribute is parsed.
 
GenParticlePtr particle ()
 
ConstGenParticlePtr particle () const
 
const std::string & unparsed_string () const
 Get unparsed string.
 
GenVertexPtr vertex ()
 
ConstGenVertexPtr vertex () const
 

Additional Inherited Members

- Protected Member Functions inherited from HepMC3::Attribute
 Attribute (const std::string &st)
 Protected constructor that allows to set string.
 
void set_is_parsed (bool flag)
 Set is_parsed flag.
 
void set_unparsed_string (const std::string &st)
 Set unparsed string.
 

Detailed Description

Attribute that holds a real number as a long double.

Definition at line 479 of file Attribute.h.

Constructor & Destructor Documentation

◆ LongDoubleAttribute() [1/2]

HepMC3::LongDoubleAttribute::LongDoubleAttribute ( )
inline

Default constructor.

Definition at line 483 of file Attribute.h.

483: Attribute(), m_val(0.0) {}
Attribute()
Default constructor.
Definition Attribute.h:51

References HepMC3::Attribute::Attribute().

◆ LongDoubleAttribute() [2/2]

HepMC3::LongDoubleAttribute::LongDoubleAttribute ( long double val)
inline

Constructor initializing attribute value.

Definition at line 486 of file Attribute.h.

486: Attribute(), m_val(val) {}

References HepMC3::Attribute::Attribute().

Member Function Documentation

◆ from_string()

bool HepMC3::LongDoubleAttribute::from_string ( const std::string & att)
inlineoverridevirtual

Implementation of Attribute::from_string.

Implements HepMC3::Attribute.

Definition at line 489 of file Attribute.h.

489 {
490 m_val = strtold( att.c_str(),NULL);
491 set_is_parsed(true);
492 return true;
493 }
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134

References HepMC3::Attribute::set_is_parsed().

◆ set_value()

void HepMC3::LongDoubleAttribute::set_value ( const long double & d)
inline

set the value associated to this Attribute.

Definition at line 510 of file Attribute.h.

510 {
511 m_val = d;
512 set_is_parsed(true);
513 }

References HepMC3::Attribute::set_is_parsed().

◆ to_string()

bool HepMC3::LongDoubleAttribute::to_string ( std::string & att) const
inlineoverridevirtual

Implementation of Attribute::to_string.

Implements HepMC3::Attribute.

Definition at line 496 of file Attribute.h.

496 {
497 std::ostringstream oss;
498 oss << std::setprecision(std::numeric_limits<long double>::digits10)
499 << m_val;
500 att = oss.str();
501 return true;
502 }

◆ value()

long double HepMC3::LongDoubleAttribute::value ( ) const
inline

get the value associated to this Attribute.

Definition at line 505 of file Attribute.h.

505 {
506 return m_val;
507 }

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