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

Attribute that holds a vector of type string. More...

#include <Attribute.h>

Inheritance diagram for HepMC3::VectorStringAttribute:
HepMC3::Attribute

Public Member Functions

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

Definition at line 1182 of file Attribute.h.

Constructor & Destructor Documentation

◆ VectorStringAttribute() [1/2]

HepMC3::VectorStringAttribute::VectorStringAttribute ( )
inline

Default constructor.

Definition at line 1186 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

◆ VectorStringAttribute() [2/2]

HepMC3::VectorStringAttribute::VectorStringAttribute ( std::vector< std::string > val)
inline

Constructor initializing attribute value.

Definition at line 1189 of file Attribute.h.

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

References HepMC3::Attribute::Attribute().

Member Function Documentation

◆ from_string()

bool HepMC3::VectorStringAttribute::from_string ( const string & att)
inlineoverridevirtual

Implementation of Attribute::from_string.

Implements HepMC3::Attribute.

Definition at line 1192 of file Attribute.h.

1192 {
1193 size_t posb = att.find_first_not_of(' ');
1194 do {
1195 size_t pose = att.find_first_of(' ', posb);
1196 m_val.push_back(att.substr(posb, pose - posb));
1197 posb = att.find_first_not_of(' ', pose);
1198 } while (posb != std::string::npos);
1199 set_is_parsed(true);
1200 return true;
1201 }
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134

References HepMC3::Attribute::set_is_parsed().

◆ set_value()

void HepMC3::VectorStringAttribute::set_value ( const std::vector< std::string > & i)
inline

set the value associated to this Attribute.

Definition at line 1216 of file Attribute.h.

1216 {
1217 m_val = i;
1218 set_is_parsed(true);
1219 }

References HepMC3::Attribute::set_is_parsed().

◆ to_string()

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

Implementation of Attribute::to_string.

Implements HepMC3::Attribute.

Definition at line 1204 of file Attribute.h.

1204 {
1205 att.clear();
1206 for (const auto& a: m_val) {if (att.length()) att+=" "; att+=a;}
1207 return true;
1208 }

◆ value()

std::vector< std::string > HepMC3::VectorStringAttribute::value ( ) const
inline

get the value associated to this Attribute.

Definition at line 1211 of file Attribute.h.

1211 {
1212 return m_val;
1213 }

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