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

Attribute that holds a vector of characters of type char. More...

#include <Attribute.h>

Inheritance diagram for HepMC3::VectorCharAttribute:
HepMC3::Attribute

Public Member Functions

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

Definition at line 705 of file Attribute.h.

Constructor & Destructor Documentation

◆ VectorCharAttribute() [1/2]

HepMC3::VectorCharAttribute::VectorCharAttribute ( )
inline

Default constructor.

Definition at line 709 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

◆ VectorCharAttribute() [2/2]

HepMC3::VectorCharAttribute::VectorCharAttribute ( std::vector< char > val)
inline

Constructor initializing attribute value.

Definition at line 712 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

Member Function Documentation

◆ from_string()

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

Implementation of Attribute::from_string.

Implements HepMC3::Attribute.

Definition at line 715 of file Attribute.h.

715 {
716 char datafoo;
717 m_val.clear();
718 std::stringstream datastream(att);
719 while (datastream >> datafoo) m_val.emplace_back(datafoo);
720 set_is_parsed(true);
721 return true;
722 }
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134

References HepMC3::Attribute::set_is_parsed().

◆ set_value()

void HepMC3::VectorCharAttribute::set_value ( const std::vector< char > & i)
inline

set the value associated to this Attribute.

Definition at line 738 of file Attribute.h.

738 {
739 m_val = i;
740 set_is_parsed(true);
741 }

References HepMC3::Attribute::set_is_parsed().

◆ to_string()

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

Implementation of Attribute::to_string.

Implements HepMC3::Attribute.

Definition at line 725 of file Attribute.h.

725 {
726 att.clear();
727 for (const auto& a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
728 return true;
729 }

◆ value()

std::vector< char > HepMC3::VectorCharAttribute::value ( ) const
inline

get the value associated to this Attribute.

Definition at line 732 of file Attribute.h.

732 {
733 return m_val;
734
735 }

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