6 #ifndef HEPMC3_ATTRIBUTE_H
7 #define HEPMC3_ATTRIBUTE_H
96 virtual bool to_string(
string &att)
const = 0;
169 m_val = atoi( att.c_str() );
175 att = std::to_string(
m_val);
210 m_val = atoi( att.c_str() );
216 att = std::to_string(
m_val);
253 m_val = atof( att.c_str() );
259 std::ostringstream oss;
260 oss << std::setprecision(std::numeric_limits<double>::digits10)
298 m_val = float(atof( att.c_str() ));
304 std::ostringstream oss;
305 oss << std::setprecision(std::numeric_limits<float>::digits10)
LongAttribute(long val)
Constructor initializing attribute value.
const string & unparsed_string() const
Get unparsed string.
Forward declaration of GenParticle.
void set_value(const double &d)
set the value associated to this Attribute.
float value() const
get the value associated to this Attribute.
string m_string
Raw (unparsed) string.
virtual bool to_string(string &att) const =0
Fill string from class content.
bool to_string(string &att) const
Implementation of Attribute::to_string.
LongAttribute()
Default constructor.
void set_value(const string &s)
set the value associated to this Attribute.
FloatAttribute(float val)
Constructor initializing attribute value.
bool is_parsed() const
Check if this attribute is parsed.
GenParticlePtr particle()
virtual bool from_string(const string &att)=0
Fill class content from string.
Attribute that holds a real number as a float.
Stores vertex-related information.
bool to_string(string &att) const
Implementation of Attribute::to_string.
long m_val
Attribute value.
ConstGenParticlePtr particle() const
string value() const
get the value associated to this Attribute.
Stores run-related information.
virtual bool init()
Optionally initialize the attribute after from_string.
Stores particle-related information.
void set_value(const int &i)
set the value associated to this Attribute.
long value() const
get the value associated to this Attribute.
Attribute that holds a string.
double value() const
get the value associated to this Attribute.
void set_unparsed_string(const string &st)
Set unparsed string.
GenParticlePtr m_particle
Particle to which assigned.
int m_val
Attribute value.
float m_val
Attribute value.
bool from_string(const string &att)
Implementation of Attribute::from_string.
const GenEvent * event() const
double m_val
Attribute value.
Stores event-related information.
bool from_string(const string &att)
Implementation of Attribute::from_string.
DoubleAttribute()
Default constructor.
Attribute that holds a real number as a double.
bool to_string(string &att) const
Implementation of Attribute::to_string.
ConstGenVertexPtr vertex() const
Minimal forward declarations for GenParticle.
Minimal forward declarations for GenVertex.
StringAttribute(const string &st)
String-based constructor.
void set_value(const float &f)
set the value associated to this Attribute.
bool to_string(string &att) const
Implementation of Attribute::to_string.
virtual bool init(const GenRunInfo &)
Optionally initialize the attribute after from_string.
void set_value(const long &l)
set the value associated to this Attribute.
bool to_string(string &att) const
Implementation of Attribute::to_string.
IntAttribute(int val)
Constructor initializing attribute value.
GenVertexPtr m_vertex
Vertex to which assigned.
void set_is_parsed(bool flag)
Set is_parsed flag.
IntAttribute()
Default constructor.
virtual ~Attribute()
Virtual destructor.
FloatAttribute()
Default constructor.
Attribute that holds an Integer implemented as an int.
bool from_string(const string &att)
Implementation of Attribute::from_string.
DoubleAttribute(double val)
Constructor initializing attribute value.
bool from_string(const string &att)
Implementation of Attribute::from_string.
int value() const
get the value associated to this Attribute.
bool m_is_parsed
Is this attribute parsed?
Attribute(const string &st)
Protected constructor that allows to set string.
bool from_string(const string &att)
Implementation of Attribute::from_string.
Attribute that holds an Integer implemented as an int.
StringAttribute()
Default constructor - empty string.
Attribute()
Default constructor.