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

Attribute that holds a vector of real numbers of type float. More...

#include <Attribute.h>

Inheritance diagram for HepMC3::VectorFloatAttribute:
HepMC3::Attribute

Public Member Functions

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

Definition at line 753 of file Attribute.h.

Constructor & Destructor Documentation

◆ VectorFloatAttribute() [1/2]

HepMC3::VectorFloatAttribute::VectorFloatAttribute ( )
inline

Default constructor.

Definition at line 757 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

◆ VectorFloatAttribute() [2/2]

HepMC3::VectorFloatAttribute::VectorFloatAttribute ( std::vector< float > val)
inline

Constructor initializing attribute value.

Definition at line 760 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

Member Function Documentation

◆ from_string()

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

Implementation of Attribute::from_string.

Implements HepMC3::Attribute.

Definition at line 763 of file Attribute.h.

763 {
764 float datafoo;
765 m_val.clear();
766 std::stringstream datastream(att);
767 while (datastream >> datafoo) m_val.emplace_back(datafoo);
768 set_is_parsed(true);
769 return true;
770 }
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134

References HepMC3::Attribute::set_is_parsed().

◆ set_value()

void HepMC3::VectorFloatAttribute::set_value ( const std::vector< float > & i)
inline

set the value associated to this Attribute.

Definition at line 785 of file Attribute.h.

785 {
786 m_val = i;
787 set_is_parsed(true);
788 }

References HepMC3::Attribute::set_is_parsed().

◆ to_string()

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

Implementation of Attribute::to_string.

Implements HepMC3::Attribute.

Definition at line 773 of file Attribute.h.

773 {
774 att.clear();
775 for (const auto& a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
776 return true;
777 }

◆ value()

std::vector< float > HepMC3::VectorFloatAttribute::value ( ) const
inline

get the value associated to this Attribute.

Definition at line 780 of file Attribute.h.

780 {
781 return m_val;
782 }

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