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::VectorLongDoubleAttribute Class Reference

Attribute that holds a vector of real numbers of type long double. More...

#include <Attribute.h>

Inheritance diagram for HepMC3::VectorLongDoubleAttribute:
HepMC3::Attribute

Public Member Functions

 VectorLongDoubleAttribute ()
 Default constructor.
 
 VectorLongDoubleAttribute (std::vector< long double > val)
 Constructor initializing attribute value.
 
bool from_string (const std::string &att) override
 Implementation of Attribute::from_string.
 
void set_value (const std::vector< long double > &i)
 set the value associated to this Attribute.
 
bool to_string (std::string &att) const override
 Implementation of Attribute::to_string.
 
std::vector< 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 vector of real numbers of type long double.

Definition at line 801 of file Attribute.h.

Constructor & Destructor Documentation

◆ VectorLongDoubleAttribute() [1/2]

HepMC3::VectorLongDoubleAttribute::VectorLongDoubleAttribute ( )
inline

Default constructor.

Definition at line 805 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

◆ VectorLongDoubleAttribute() [2/2]

HepMC3::VectorLongDoubleAttribute::VectorLongDoubleAttribute ( std::vector< long double > val)
inline

Constructor initializing attribute value.

Definition at line 808 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

Member Function Documentation

◆ from_string()

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

Implementation of Attribute::from_string.

Implements HepMC3::Attribute.

Definition at line 811 of file Attribute.h.

811 {
812 long double datafoo;
813 m_val.clear();
814 std::stringstream datastream(att);
815 while (datastream >> datafoo) m_val.emplace_back(datafoo);
816 set_is_parsed(true);
817 return true;
818 }
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134

References HepMC3::Attribute::set_is_parsed().

◆ set_value()

void HepMC3::VectorLongDoubleAttribute::set_value ( const std::vector< long double > & i)
inline

set the value associated to this Attribute.

Definition at line 833 of file Attribute.h.

833 {
834 m_val = i;
835 set_is_parsed(true);
836 }

References HepMC3::Attribute::set_is_parsed().

◆ to_string()

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

Implementation of Attribute::to_string.

Implements HepMC3::Attribute.

Definition at line 821 of file Attribute.h.

821 {
822 att.clear();
823 for (const auto& a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
824 return true;
825 }

◆ value()

std::vector< long double > HepMC3::VectorLongDoubleAttribute::value ( ) const
inline

get the value associated to this Attribute.

Definition at line 828 of file Attribute.h.

828 {
829 return m_val;
830 }

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