HepMC3 event record library
Public Member Functions | Protected Member Functions | Private Attributes | Friends
Attribute Class Referenceabstract

Detailed Description

Base attribute class.

Base class for all attributes.

Contains virtual functions to_string and from_string that each attribute must implement, as well as init function that attributes should overload to initialize parsed attribute

Definition at line 44 of file Attribute.h.

#include <Attribute.h>

+ Inheritance diagram for Attribute:
+ Collaboration diagram for Attribute:

Public Member Functions

 Attribute ()
 Default constructor.
 
virtual ~Attribute ()
 Virtual destructor.
 
virtual bool from_string (const std::string &att)=0
 Fill class content from string.
 
virtual bool init ()
 Optionally initialize the attribute after from_string.
 
virtual bool init (const GenRunInfo &)
 Optionally initialize the attribute after from_string.
 
virtual bool to_string (std::string &att) const =0
 Fill string from class content.
 
bool is_parsed () const
 Check if this attribute is parsed.
 
const std::string & unparsed_string () const
 Get unparsed string.
 
const GenEventevent () const
 
GenParticlePtr particle ()
 
ConstGenParticlePtr particle () const
 
GenVertexPtr vertex ()
 
ConstGenVertexPtr vertex () const
 

Protected Member Functions

 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.
 

Private Attributes

bool m_is_parsed
 Is this attribute parsed?
 
std::string m_string
 Raw (unparsed) string.
 
const GenEventm_event
 
GenParticlePtr m_particle
 controlling GenEvent object.
 
GenVertexPtr m_vertex
 Vertex to which assigned.
 

Friends

class GenEvent
 GenEvent is a friend.
 

Constructor & Destructor Documentation

◆ Attribute() [1/2]

Attribute ( )
inline

Default constructor.

Definition at line 51 of file Attribute.h.

References Attribute::m_event.

◆ ~Attribute()

virtual ~Attribute ( )
inlinevirtual

Virtual destructor.

Definition at line 54 of file Attribute.h.

◆ Attribute() [2/2]

Attribute ( const std::string &  st)
inlineexplicitprotected

Protected constructor that allows to set string.

Used when parsing attributes from file. An StringAttribute class object is made, which uses this constructor to signify that it just holds string without parsing it.

Note
There should be no need for user class to ever use this constructor

Definition at line 66 of file Attribute.h.

References Attribute::m_event.

Member Function Documentation

◆ event()

const GenEvent * event ( ) const
inline

return the GenEvent to which this Attribute belongs, if at all.

Definition at line 108 of file Attribute.h.

References Attribute::m_event.

◆ from_string()

virtual bool from_string ( const std::string &  att)
pure virtual

◆ init() [1/2]

virtual bool init ( )
inlinevirtual

Optionally initialize the attribute after from_string.

Reimplemented in HEPEUPAttribute.

Definition at line 81 of file Attribute.h.

◆ init() [2/2]

virtual bool init ( const GenRunInfo )
inlinevirtual

Optionally initialize the attribute after from_string.

Is passed a reference to the GenRunInfo object to which the Attribute belongs.

Reimplemented in HEPEUPAttribute.

Definition at line 90 of file Attribute.h.

◆ is_parsed()

bool is_parsed ( ) const
inline

Check if this attribute is parsed.

Definition at line 102 of file Attribute.h.

References Attribute::m_is_parsed.

◆ particle() [1/2]

GenParticlePtr particle ( )
inline

return the GenParticle to which this Attribute belongs, if at all.

Definition at line 113 of file Attribute.h.

References Attribute::m_particle.

◆ particle() [2/2]

ConstGenParticlePtr particle ( ) const
inline

return the GenParticle to which this Attribute belongs, if at all.

Definition at line 118 of file Attribute.h.

References Attribute::m_particle.

◆ set_is_parsed()

void set_is_parsed ( bool  flag)
inlineprotected

Set is_parsed flag.

Definition at line 134 of file Attribute.h.

References Attribute::m_is_parsed.

◆ set_unparsed_string()

void set_unparsed_string ( const std::string &  st)
inlineprotected

Set unparsed string.

Definition at line 137 of file Attribute.h.

References Attribute::m_string.

◆ to_string()

virtual bool to_string ( std::string &  att) const
pure virtual

◆ unparsed_string()

const std::string & unparsed_string ( ) const
inline

Get unparsed string.

Definition at line 105 of file Attribute.h.

References Attribute::m_string.

◆ vertex() [1/2]

GenVertexPtr vertex ( )
inline

return the GenVertex to which this Attribute belongs, if at all.

Definition at line 123 of file Attribute.h.

References Attribute::m_vertex.

◆ vertex() [2/2]

ConstGenVertexPtr vertex ( ) const
inline

return the GenVertex to which this Attribute belongs, if at all.

Definition at line 128 of file Attribute.h.

References Attribute::m_vertex.

Friends And Related Function Documentation

◆ GenEvent

friend class GenEvent
friend

GenEvent is a friend.

Definition at line 69 of file Attribute.h.

Field Documentation

◆ m_event

const GenEvent* m_event
private

Possibility to be aware of the

Definition at line 145 of file Attribute.h.

◆ m_is_parsed

bool m_is_parsed
private

Is this attribute parsed?

Definition at line 143 of file Attribute.h.

◆ m_particle

GenParticlePtr m_particle
private

controlling GenEvent object.

Particle to which assigned.

Definition at line 147 of file Attribute.h.

◆ m_string

std::string m_string
private

Raw (unparsed) string.

Definition at line 144 of file Attribute.h.

◆ m_vertex

GenVertexPtr m_vertex
private

Vertex to which assigned.

Definition at line 148 of file Attribute.h.


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