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

Attribute that holds a vector of unsigned integers of type unsigned int. More...

#include <Attribute.h>

Inheritance diagram for HepMC3::VectorUIntAttribute:
HepMC3::Attribute

Public Member Functions

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

Definition at line 897 of file Attribute.h.

Constructor & Destructor Documentation

◆ VectorUIntAttribute() [1/2]

HepMC3::VectorUIntAttribute::VectorUIntAttribute ( )
inline

Default constructor.

Definition at line 901 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

◆ VectorUIntAttribute() [2/2]

HepMC3::VectorUIntAttribute::VectorUIntAttribute ( std::vector< unsigned int > val)
inline

Constructor initializing attribute value.

Definition at line 904 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

Member Function Documentation

◆ from_string()

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

Implementation of Attribute::from_string.

Implements HepMC3::Attribute.

Definition at line 907 of file Attribute.h.

907 {
908 unsigned int datafoo;
909 m_val.clear();
910 std::stringstream datastream(att);
911 while (datastream >> datafoo) m_val.emplace_back(datafoo);
912 set_is_parsed(true);
913 return true;
914 }
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134

References HepMC3::Attribute::set_is_parsed().

◆ set_value()

void HepMC3::VectorUIntAttribute::set_value ( const std::vector< unsigned int > & i)
inline

set the value associated to this Attribute.

Definition at line 929 of file Attribute.h.

929 {
930 m_val = i;
931 set_is_parsed(true);
932 }

References HepMC3::Attribute::set_is_parsed().

◆ to_string()

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

Implementation of Attribute::to_string.

Implements HepMC3::Attribute.

Definition at line 917 of file Attribute.h.

917 {
918 att.clear();
919 for (const auto& a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
920 return true;
921 }

◆ value()

std::vector< unsigned int > HepMC3::VectorUIntAttribute::value ( ) const
inline

get the value associated to this Attribute.

Definition at line 924 of file Attribute.h.

924 {
925 return m_val;
926 }

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