HepMC3 event record library
Attribute.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2020 The HepMC collaboration (see AUTHORS for details)
5 //
6 #ifndef HEPMC3_ATTRIBUTE_H
7 #define HEPMC3_ATTRIBUTE_H
8 /**
9  * @file Attribute.h
10  * @brief Definition of \b class Attribute, \b class IntAttribute and \b class StringAttribute
11  *
12  * @class HepMC3::Attribute
13  * @brief Base class for all attributes
14  *
15  * Contains virtual functions to_string and from_string that
16  * each attribute must implement, as well as init function that
17  * attributes should overload to initialize parsed attribute
18  *
19  * @ingroup attributes
20  *
21  */
22 #include <cstdio> // sprintf
23 #include <string>
24 #include <limits>
25 #include <sstream>
26 #include <iomanip>
27 #include <map>
28 
29 #include "HepMC3/GenParticle_fwd.h"
30 #include "HepMC3/GenVertex_fwd.h"
31 
32 /** Deprecated */
33 using std::string;
34 
35 namespace HepMC3 {
36 
37 /** @brief Forward declaration of GenEvent. */
38 class GenEvent;
39 
40 /** @brief Forward declaration of GenRunInfo. */
41 class GenRunInfo;
42 
43 /** @brief Base attribute class. */
44 class Attribute {
45 //
46 // Constructors
47 //
48 public:
49  /** @brief Default constructor */
50  //Note: m_event should be set to nullptr in case event is deleted!
51  Attribute():m_is_parsed(true) { m_event=nullptr; }
52 
53  /** @brief Virtual destructor */
54  virtual ~Attribute() {}
55 
56 protected:
57  /** @brief Protected constructor that allows to set string
58  *
59  * Used when parsing attributes from file. An StringAttribute class
60  * object is made, which uses this constructor to signify that
61  * it just holds string without parsing it.
62  *
63  * @note There should be no need for user class to ever use this constructor
64  */
65  //Note: m_event should be set to nullptr n case event is deleted!
66  explicit Attribute(const std::string &st):m_is_parsed(false),m_string(st) { m_event=nullptr; }
67 
68  /** @brief GenEvent is a friend */
69  friend class GenEvent;
70 
71 //
72 // Virtual Functions
73 //
74 public:
75  /** @brief Fill class content from string.
76  */
77  virtual bool from_string(const std::string & att) = 0;
78 
79  /** @brief Optionally initialize the attribute after from_string.
80  */
81  virtual bool init() {
82  return true;
83  }
84 
85  /** @brief Optionally initialize the attribute after from_string
86  *
87  * Is passed a reference to the GenRunInfo object to which the
88  * Attribute belongs.
89  */
90  virtual bool init(const GenRunInfo & ) {
91  return true;
92  }
93 
94  /** @brief Fill string from class content */
95  virtual bool to_string(std::string &att) const = 0;
96 
97 //
98 // Accessors
99 //
100 public:
101  /** @brief Check if this attribute is parsed */
102  bool is_parsed() const { return m_is_parsed; }
103 
104  /** @brief Get unparsed string */
105  const std::string& unparsed_string() const { return m_string; }
106 
107  /** return the GenEvent to which this Attribute belongs, if at all. */
108  const GenEvent * event() const {
109  return m_event;
110  }
111 
112  /** return the GenParticle to which this Attribute belongs, if at all. */
113  GenParticlePtr particle() {
114  return m_particle;
115  }
116 
117  /** return the GenParticle to which this Attribute belongs, if at all. */
118  ConstGenParticlePtr particle() const {
119  return std::const_pointer_cast<GenParticle>(m_particle);
120  }
121 
122  /** return the GenVertex to which this Attribute belongs, if at all. */
123  GenVertexPtr vertex() {
124  return m_vertex;
125  }
126 
127  /** return the GenVertex to which this Attribute belongs, if at all. */
128  ConstGenVertexPtr vertex() const {
129  return std::const_pointer_cast<GenVertex>(m_vertex);
130  }
131 
132 protected:
133  /** @brief Set is_parsed flag */
134  void set_is_parsed(bool flag) { m_is_parsed = flag; }
135 
136  /** @brief Set unparsed string */
137  void set_unparsed_string(const std::string &st) { m_string = st; }
138 
139 //
140 // Fields
141 //
142 private:
143  bool m_is_parsed; //!< Is this attribute parsed?
144  std::string m_string; //!< Raw (unparsed) string
145  const GenEvent * m_event; //!< Possibility to be aware of the
146  //! controlling GenEvent object.
147  GenParticlePtr m_particle; //!< Particle to which assigned.
148  GenVertexPtr m_vertex; //!< Vertex to which assigned.
149 };
150 
151 /**
152  * @class HepMC3::IntAttribute
153  * @brief Attribute that holds an Integer implemented as an int
154  *
155  * @ingroup attributes
156  */
157 class IntAttribute : public Attribute {
158 public:
159 
160  /** @brief Default constructor */
162 
163  /** @brief Constructor initializing attribute value */
164  IntAttribute(int val):Attribute(),m_val(val) {}
165 
166  /** @brief Implementation of Attribute::from_string */
167  bool from_string(const std::string &att) override {
168  m_val = atoi( att.c_str() );
169  return true;
170  }
171 
172  /** @brief Implementation of Attribute::to_string */
173  bool to_string(std::string &att) const override{
174  att = std::to_string(m_val);
175  return true;
176  }
177 
178  /** @brief get the value associated to this Attribute. */
179  int value() const {
180  return m_val;
181  }
182 
183  /** @brief set the value associated to this Attribute. */
184  void set_value(const int& i) {
185  m_val = i;
186  }
187 
188 private:
189  int m_val; ///< Attribute value
190 };
191 
192 /**
193  * @class HepMC3::LongAttribute
194  * @brief Attribute that holds an Integer implemented as an int
195  *
196  * @ingroup attributes
197  */
198 class LongAttribute : public Attribute {
199 public:
200 
201  /** @brief Default constructor */
203 
204  /** @brief Constructor initializing attribute value */
205  LongAttribute(long val): Attribute(), m_val(val) {}
206 
207  /** @brief Implementation of Attribute::from_string */
208  bool from_string(const std::string &att) override{
209  m_val = atol( att.c_str() );
210  return true;
211  }
212 
213  /** @brief Implementation of Attribute::to_string */
214  bool to_string(std::string &att) const override{
215  att = std::to_string(m_val);
216  return true;
217  }
218 
219  /** @brief get the value associated to this Attribute. */
220  long value() const {
221  return m_val;
222  }
223 
224  /** @brief set the value associated to this Attribute. */
225  void set_value(const long& l) {
226  m_val = l;
227  }
228 
229 private:
230 
231  long m_val; ///< Attribute value
232 
233 };
234 
235 /**
236  * @class HepMC3::DoubleAttribute
237  * @brief Attribute that holds a real number as a double.
238  *
239  * @ingroup attributes
240  */
241 class DoubleAttribute : public Attribute {
242 public:
243 
244  /** @brief Default constructor */
246 
247  /** @brief Constructor initializing attribute value */
248  DoubleAttribute(double val): Attribute(), m_val(val) {}
249 
250  /** @brief Implementation of Attribute::from_string */
251  bool from_string(const std::string &att) override{
252  m_val = atof( att.c_str() );
253  return true;
254  }
255 
256  /** @brief Implementation of Attribute::to_string */
257  bool to_string(std::string &att) const override{
258  std::ostringstream oss;
259  oss << std::setprecision(std::numeric_limits<double>::digits10)
260  << m_val;
261  att = oss.str();
262  return true;
263  }
264 
265  /** @brief get the value associated to this Attribute. */
266  double value() const {
267  return m_val;
268  }
269 
270  /** @brief set the value associated to this Attribute. */
271  void set_value(const double& d) {
272  m_val = d;
273  }
274 
275 private:
276 
277  double m_val; ///< Attribute value
278 };
279 
280 /**
281  * @class HepMC3::FloatAttribute
282  * @brief Attribute that holds a real number as a float.
283  *
284  * @ingroup attributes
285  */
286 class FloatAttribute : public Attribute {
287 public:
288 
289  /** @brief Default constructor */
291 
292  /** @brief Constructor initializing attribute value */
293  FloatAttribute(float val): Attribute(), m_val(val) {}
294 
295  /** @brief Implementation of Attribute::from_string */
296  bool from_string(const std::string &att) override{
297  m_val = float(atof( att.c_str() ));
298  return true;
299  }
300 
301  /** @brief Implementation of Attribute::to_string */
302  bool to_string(std::string &att) const override{
303  std::ostringstream oss;
304  oss << std::setprecision(std::numeric_limits<float>::digits10)
305  << m_val;
306  att = oss.str();
307  return true;
308  }
309 
310  /** @brief get the value associated to this Attribute. */
311  float value() const {
312  return m_val;
313  }
314 
315  /** @brief set the value associated to this Attribute. */
316  void set_value(const float& f) {
317  m_val = f;
318  }
319 
320 private:
321 
322  float m_val; ///< Attribute value
323 };
324 
325 /**
326  * @class HepMC3::StringAttribute
327  * @brief Attribute that holds a string
328  *
329  * Default attribute constructed when reading input files.
330  * It can be then parsed by other attributes or left as a string.
331  *
332  * @ingroup attributes
333  *
334  */
335 class StringAttribute : public Attribute {
336 public:
337 
338  /** @brief Default constructor - empty string */
340 
341  /** @brief String-based constructor
342  *
343  * The Attribute constructor used here marks that this is an unparsed
344  * string that can be (but does not have to be) parsed
345  *
346  */
347  StringAttribute(const std::string &st):Attribute(st) {}
348 
349  /** @brief Implementation of Attribute::from_string */
350  bool from_string(const std::string &att) override{
351  set_unparsed_string(att);
352  return true;
353  }
354 
355  /** @brief Implementation of Attribute::to_string */
356  bool to_string(std::string &att) const override{
357  att = unparsed_string();
358  return true;
359  }
360 
361  /** @brief get the value associated to this Attribute. */
362  std::string value() const {
363  return unparsed_string();
364  }
365 
366  /** @brief set the value associated to this Attribute. */
367  void set_value(const std::string& s) {
369  }
370 
371 };
372 
373 /**
374  * @class HepMC3::CharAttribute
375  * @brief Attribute that holds an Chareger implemented as an int
376  *
377  * @ingroup attributes
378  */
379 class CharAttribute : public Attribute {
380 public:
381 
382  /** @brief Default constructor */
384 
385  /** @brief Constructor initializing attribute value */
386  CharAttribute(char val):Attribute(),m_val(val) {}
387 
388  /** @brief Implementation of Attribute::from_string */
389  bool from_string(const std::string &att) override {
390  if (att.size())
391  {
392  m_val = att.at(0);
393  return true;
394  }
395  return false;
396  }
397 
398  /** @brief Implementation of Attribute::to_string */
399  bool to_string(std::string &att) const override {
400  att = std::to_string(m_val);
401  return true;
402  }
403 
404  /** @brief get the value associated to this Attribute. */
405  char value() const {
406  return m_val;
407  }
408 
409  /** @brief set the value associated to this Attribute. */
410  void set_value(const char& i) {
411  m_val = i;
412  }
413 
414 private:
415  char m_val; ///< Attribute value
416 };
417 
418 /**
419  * @class HepMC3::LongLongAttribute
420  * @brief Attribute that holds an Integer implemented as an int
421  *
422  * @ingroup attributes
423  */
424 class LongLongAttribute : public Attribute {
425 public:
426 
427  /** @brief Default constructor */
429 
430  /** @brief Constructor initializing attribute value */
431  LongLongAttribute(long long val): Attribute(), m_val(val) {}
432 
433  /** @brief Implementation of Attribute::from_string */
434  bool from_string(const std::string &att) override{
435  m_val = atoll( att.c_str() );
436  return true;
437  }
438 
439  /** @brief Implementation of Attribute::to_string */
440  bool to_string(std::string &att) const override{
441  att = std::to_string(m_val);
442  return true;
443  }
444 
445  /** @brief get the value associated to this Attribute. */
446  long long value() const {
447  return m_val;
448  }
449 
450  /** @brief set the value associated to this Attribute. */
451  void set_value(const long long& l) {
452  m_val = l;
453  }
454 
455 private:
456 
457  long long m_val; ///< Attribute value
458 
459 };
460 
461 /**
462  * @class HepMC3::LongDoubleAttribute
463  * @brief Attribute that holds a real number as a double.
464  *
465  * @ingroup attributes
466  */
468 public:
469 
470  /** @brief Default constructor */
472 
473  /** @brief Constructor initializing attribute value */
474  LongDoubleAttribute(long double val): Attribute(), m_val(val) {}
475 
476  /** @brief Implementation of Attribute::from_string */
477  bool from_string(const std::string &att) override {
478  m_val = strtold( att.c_str(),NULL);
479  return true;
480  }
481 
482  /** @brief Implementation of Attribute::to_string */
483  bool to_string(std::string &att) const override{
484  std::ostringstream oss;
485  oss << std::setprecision(std::numeric_limits<long double>::digits10)
486  << m_val;
487  att = oss.str();
488  return true;
489  }
490 
491  /** @brief get the value associated to this Attribute. */
492  long double value() const {
493  return m_val;
494  }
495 
496  /** @brief set the value associated to this Attribute. */
497  void set_value(const long double& d) {
498  m_val = d;
499  }
500 
501 private:
502 
503  long double m_val; ///< Attribute value
504 };
505 
506 
507 
508 /**
509  * @class HepMC3::UIntAttribute
510  * @brief Attribute that holds an unsigned int
511  *
512  * @ingroup attributes
513  */
514 class UIntAttribute : public Attribute {
515 public:
516 
517  /** @brief Default constructor */
519 
520  /** @brief Constructor initializing attribute value */
521  UIntAttribute(unsigned int val):Attribute(),m_val(val) {}
522 
523  /** @brief Implementation of Attribute::from_string */
524  bool from_string(const std::string &att) override{
525  m_val = strtoul(att.c_str(), NULL, 0);
526  return true;
527  }
528 
529  /** @brief Implementation of Attribute::to_string */
530  bool to_string(std::string &att) const override{
531  att = std::to_string(m_val);
532  return true;
533  }
534 
535  /** @brief get the value associated to this Attribute. */
536  unsigned int value() const {
537  return m_val;
538  }
539 
540  /** @brief set the value associated to this Attribute. */
541  void set_value(const unsigned int& i) {
542  m_val = i;
543  }
544 
545 private:
546  unsigned int m_val; ///< Attribute value
547 };
548 
549 
550 
551 /**
552  * @class HepMC3::ULongAttribute
553  * @brief Attribute that holds an unsigned long
554  *
555  * @ingroup attributes
556  */
557 class ULongAttribute : public Attribute {
558 public:
559 
560  /** @brief Default constructor */
562 
563  /** @brief Constructor initializing attribute value */
564  ULongAttribute(unsigned long val):Attribute(),m_val(val) {}
565 
566  /** @brief Implementation of Attribute::from_string */
567  bool from_string(const std::string &att) override{
568  m_val = strtoul(att.c_str(), NULL, 0);
569  return true;
570  }
571 
572  /** @brief Implementation of Attribute::to_string */
573  bool to_string(std::string &att) const override{
574  att = std::to_string(m_val);
575  return true;
576  }
577 
578  /** @brief get the value associated to this Attribute. */
579  unsigned long value() const {
580  return m_val;
581  }
582 
583  /** @brief set the value associated to this Attribute. */
584  void set_value(const unsigned long& i) {
585  m_val = i;
586  }
587 
588 private:
589  unsigned long m_val; ///< Attribute value
590 };
591 
592 
593 /**
594  * @class HepMC3::ULongLongAttribute
595  * @brief Attribute that holds an unsigned long long
596  *
597  * @ingroup attributes
598  */
600 public:
601 
602  /** @brief Default constructor */
604 
605  /** @brief Constructor initializing attribute value */
606  ULongLongAttribute(unsigned long long val):Attribute(),m_val(val) {}
607 
608  /** @brief Implementation of Attribute::from_string */
609  bool from_string(const std::string &att) override{
610  m_val = strtoull(att.c_str(), NULL, 0);
611  return true;
612  }
613 
614  /** @brief Implementation of Attribute::to_string */
615  bool to_string(std::string &att) const override{
616  att = std::to_string(m_val);
617  return true;
618  }
619 
620  /** @brief get the value associated to this Attribute. */
621  unsigned long long value() const {
622  return m_val;
623  }
624 
625  /** @brief set the value associated to this Attribute. */
626  void set_value(const unsigned long long& i) {
627  m_val = i;
628  }
629 
630 private:
631  unsigned long long m_val; ///< Attribute value
632 };
633 /**
634  * @class HepMC3::BoolAttribute
635  * @brief Attribute that holds an Booleger implemented as an int
636  *
637  * @ingroup attributes
638  */
639 class BoolAttribute : public Attribute {
640 public:
641 
642  /** @brief Default constructor */
644 
645  /** @brief Constructor initializing attribute value */
646  BoolAttribute(bool val):Attribute(),m_val(val) {}
647 
648  /** @brief Implementation of Attribute::from_string */
649  bool from_string(const std::string &att) override{
650  if (att.size()!=1) return false;
651  if (att==std::string("1")) {m_val = true; return true;}
652  if (att==std::string("0")) {m_val = false; return true;}
653  return false;
654  }
655 
656  /** @brief Implementation of Attribute::to_string */
657  bool to_string(std::string &att) const override{
658  att = std::to_string(m_val);
659  return true;
660  }
661 
662  /** @brief get the value associated to this Attribute. */
663  bool value() const {
664  return m_val;
665  }
666 
667  /** @brief set the value associated to this Attribute. */
668  void set_value(const bool& i) {
669  m_val = i;
670  }
671 
672 private:
673  bool m_val; ///< Attribute value
674 };
675 
676 /**
677  * @class HepMC3::VectorCharAttribute
678  * @brief Attribute that holds a vector of charegers of type char
679  *
680  * @ingroup attributes
681  */
683 public:
684 
685  /** @brief Default constructor */
687 
688  /** @brief Constructor initializing attribute value */
689  VectorCharAttribute(std::vector<char> val):Attribute(),m_val(val) {}
690 
691  /** @brief Implementation of Attribute::from_string */
692  bool from_string(const std::string &att) override {
693  char datafoo;
694  m_val.clear();
695  std::stringstream datastream(att);
696  while (datastream >> datafoo) m_val.push_back(datafoo);
697  return true;
698  }
699 
700  /** @brief Implementation of Attribute::to_string */
701  bool to_string(std::string &att) const override{
702  att.clear();
703  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
704  return true;
705  }
706 
707  /** @brief get the value associated to this Attribute. */
708  std::vector<char> value() const {
709  return m_val;
710  }
711 
712  /** @brief set the value associated to this Attribute. */
713  void set_value(const std::vector<char>& i) {
714  m_val = i;
715  }
716 
717 private:
718  std::vector<char> m_val; ///< Attribute value
719 };
720 
721 /**
722  * @class HepMC3::VectorFloatAttribute
723  * @brief Attribute that holds a vector of floategers of type float
724  *
725  * @ingroup attributes
726  */
728 public:
729 
730  /** @brief Default constructor */
732 
733  /** @brief Constructor initializing attribute value */
734  VectorFloatAttribute(std::vector<float> val):Attribute(),m_val(val) {}
735 
736  /** @brief Implementation of Attribute::from_string */
737  bool from_string(const std::string &att) override {
738  float datafoo;
739  m_val.clear();
740  std::stringstream datastream(att);
741  while (datastream >> datafoo) m_val.push_back(datafoo);
742  return true;
743  }
744 
745  /** @brief Implementation of Attribute::to_string */
746  bool to_string(std::string &att) const override{
747  att.clear();
748  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
749  return true;
750  }
751 
752  /** @brief get the value associated to this Attribute. */
753  std::vector<float> value() const {
754  return m_val;
755  }
756 
757  /** @brief set the value associated to this Attribute. */
758  void set_value(const std::vector<float>& i) {
759  m_val = i;
760  }
761 
762 private:
763  std::vector<float> m_val; ///< Attribute value
764 };
765 
766 
767 /**
768  * @class HepMC3::VectorLongDoubleAttribute
769  * @brief Attribute that holds a vector of long doubleegers of type long double
770  *
771  * @ingroup attributes
772  */
774 public:
775 
776  /** @brief Default constructor */
778 
779  /** @brief Constructor initializing attribute value */
780  VectorLongDoubleAttribute(std::vector<long double> val):Attribute(),m_val(val) {}
781 
782  /** @brief Implementation of Attribute::from_string */
783  bool from_string(const std::string &att) override {
784  long double datafoo;
785  m_val.clear();
786  std::stringstream datastream(att);
787  while (datastream >> datafoo) m_val.push_back(datafoo);
788  return true;
789  }
790 
791  /** @brief Implementation of Attribute::to_string */
792  bool to_string(std::string &att) const override{
793  att.clear();
794  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
795  return true;
796  }
797 
798  /** @brief get the value associated to this Attribute. */
799  std::vector<long double> value() const {
800  return m_val;
801  }
802 
803  /** @brief set the value associated to this Attribute. */
804  void set_value(const std::vector<long double>& i) {
805  m_val = i;
806  }
807 
808 private:
809  std::vector<long double> m_val; ///< Attribute value
810 };
811 
812 
813 
814 /**
815  * @class HepMC3::VectorLongLongAttribute
816  * @brief Attribute that holds a vector of long longegers of type long long
817  *
818  * @ingroup attributes
819  */
821 public:
822 
823  /** @brief Default constructor */
825 
826  /** @brief Constructor initializing attribute value */
827  VectorLongLongAttribute(std::vector<long long> val):Attribute(),m_val(val) {}
828 
829  /** @brief Implementation of Attribute::from_string */
830  bool from_string(const std::string &att) override {
831  long long datafoo;
832  m_val.clear();
833  std::stringstream datastream(att);
834  while (datastream >> datafoo) m_val.push_back(datafoo);
835  return true;
836  }
837 
838  /** @brief Implementation of Attribute::to_string */
839  bool to_string(std::string &att) const override{
840  att.clear();
841  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
842  return true;
843  }
844 
845  /** @brief get the value associated to this Attribute. */
846  std::vector<long long> value() const {
847  return m_val;
848  }
849 
850  /** @brief set the value associated to this Attribute. */
851  void set_value(const std::vector<long long>& i) {
852  m_val = i;
853  }
854 
855 private:
856  std::vector<long long> m_val; ///< Attribute value
857 };
858 
859 /**
860  * @class HepMC3::VectorUIntAttribute
861  * @brief Attribute that holds a vector of unsigned integers of type unsigned int
862  *
863  * @ingroup attributes
864  */
866 public:
867 
868  /** @brief Default constructor */
870 
871  /** @brief Constructor initializing attribute value */
872  VectorUIntAttribute(std::vector<unsigned int> val):Attribute(),m_val(val) {}
873 
874  /** @brief Implementation of Attribute::from_string */
875  bool from_string(const std::string &att) override {
876  unsigned int datafoo;
877  m_val.clear();
878  std::stringstream datastream(att);
879  while (datastream >> datafoo) m_val.push_back(datafoo);
880  return true;
881  }
882 
883  /** @brief Implementation of Attribute::to_string */
884  bool to_string(std::string &att) const override{
885  att.clear();
886  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
887  return true;
888  }
889 
890  /** @brief get the value associated to this Attribute. */
891  std::vector<unsigned int> value() const {
892  return m_val;
893  }
894 
895  /** @brief set the value associated to this Attribute. */
896  void set_value(const std::vector<unsigned int>& i) {
897  m_val = i;
898  }
899 
900 private:
901  std::vector<unsigned int> m_val; ///< Attribute value
902 };
903 
904 /**
905  * @class HepMC3::VectorULongAttribute
906  * @brief Attribute that holds a vector of unsigned longegers of type unsigned long
907  *
908  * @ingroup attributes
909  */
911 public:
912 
913  /** @brief Default constructor */
915 
916  /** @brief Constructor initializing attribute value */
917  VectorULongAttribute(std::vector<unsigned long> val):Attribute(),m_val(val) {}
918 
919  /** @brief Implementation of Attribute::from_string */
920  bool from_string(const std::string &att) override {
921  unsigned long datafoo;
922  m_val.clear();
923  std::stringstream datastream(att);
924  while (datastream >> datafoo) m_val.push_back(datafoo);
925  return true;
926  }
927 
928  /** @brief Implementation of Attribute::to_string */
929  bool to_string(std::string &att) const override{
930  att.clear();
931  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
932  return true;
933  }
934 
935  /** @brief get the value associated to this Attribute. */
936  std::vector<unsigned long> value() const {
937  return m_val;
938  }
939 
940  /** @brief set the value associated to this Attribute. */
941  void set_value(const std::vector<unsigned long>& i) {
942  m_val = i;
943  }
944 
945 private:
946  std::vector<unsigned long> m_val; ///< Attribute value
947 };
948 
949 
950 /**
951  * @class HepMC3::VectorULongLongAttribute
952  * @brief Attribute that holds a vector of unsigned long longegers of type unsigned long long
953  *
954  * @ingroup attributes
955  */
957 public:
958 
959  /** @brief Default constructor */
961 
962  /** @brief Constructor initializing attribute value */
963  VectorULongLongAttribute(std::vector<unsigned long long> val):Attribute(),m_val(val) {}
964 
965  /** @brief Implementation of Attribute::from_string */
966  bool from_string(const std::string &att) override {
967  unsigned long long datafoo;
968  m_val.clear();
969  std::stringstream datastream(att);
970  while (datastream >> datafoo) m_val.push_back(datafoo);
971  return true;
972  }
973 
974  /** @brief Implementation of Attribute::to_string */
975  bool to_string(std::string &att) const override{
976  att.clear();
977  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
978  return true;
979  }
980 
981  /** @brief get the value associated to this Attribute. */
982  std::vector<unsigned long long> value() const {
983  return m_val;
984  }
985 
986  /** @brief set the value associated to this Attribute. */
987  void set_value(const std::vector<unsigned long long>& i) {
988  m_val = i;
989  }
990 
991 private:
992  std::vector<unsigned long long> m_val; ///< Attribute value
993 };
994 
995 /**
996  * @class HepMC3::VectorIntAttribute
997  * @brief Attribute that holds a vector of integers of type int
998  *
999  * @ingroup attributes
1000  */
1002 public:
1003 
1004  /** @brief Default constructor */
1006 
1007  /** @brief Constructor initializing attribute value */
1008  VectorIntAttribute(std::vector<int> val):Attribute(),m_val(val) {}
1009 
1010  /** @brief Implementation of Attribute::from_string */
1011  bool from_string(const std::string &att) override {
1012  int datafoo;
1013  m_val.clear();
1014  std::stringstream datastream(att);
1015  while (datastream >> datafoo) m_val.push_back(datafoo);
1016  return true;
1017  }
1018 
1019  /** @brief Implementation of Attribute::to_string */
1020  bool to_string(std::string &att) const override{
1021  att.clear();
1022  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
1023  return true;
1024  }
1025 
1026  /** @brief get the value associated to this Attribute. */
1027  std::vector<int> value() const {
1028  return m_val;
1029  }
1030 
1031  /** @brief set the value associated to this Attribute. */
1032  void set_value(const std::vector<int>& i) {
1033  m_val = i;
1034  }
1035 
1036 private:
1037  std::vector<int> m_val; ///< Attribute value
1038 };
1039 
1040 /**
1041  * @class HepMC3::VectorLongIntAttribute
1042  * @brief Attribute that holds a vector of integers of type int
1043  *
1044  * @ingroup attributes
1045  */
1047 public:
1048 
1049  /** @brief Default constructor */
1051 
1052  /** @brief Constructor initializing attribute value */
1053  VectorLongIntAttribute(std::vector<long int> val):Attribute(),m_val(val) {}
1054 
1055  /** @brief Implementation of Attribute::from_string */
1056  bool from_string(const std::string &att) override {
1057  long int datafoo;
1058  m_val.clear();
1059  std::stringstream datastream(att);
1060  while (datastream >> datafoo) m_val.push_back(datafoo);
1061  return true;
1062  }
1063 
1064  /** @brief Implementation of Attribute::to_string */
1065  bool to_string(std::string &att) const override{
1066  att.clear();
1067  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
1068  return true;
1069  }
1070 
1071  /** @brief get the value associated to this Attribute. */
1072  std::vector<long int> value() const {
1073  return m_val;
1074  }
1075 
1076  /** @brief set the value associated to this Attribute. */
1077  void set_value(const std::vector<long int>& i) {
1078  m_val = i;
1079  }
1080 
1081 private:
1082  std::vector<long int> m_val; ///< Attribute value
1083 };
1084 
1085 /**
1086  * @class HepMC3::VectorDoubleAttribute
1087  * @brief Attribute that holds a vector of FPs of type double
1088  *
1089  * @ingroup attributes
1090  */
1092 public:
1093 
1094  /** @brief Default constructor */
1096 
1097  /** @brief Constructor initializing attribute value */
1098  VectorDoubleAttribute(std::vector<double> val):Attribute(),m_val(val) {}
1099 
1100  /** @brief Implementation of Attribute::from_string */
1101  bool from_string(const std::string &att) override {
1102  double datafoo;
1103  m_val.clear();
1104  std::stringstream datastream(att);
1105  while (datastream >> datafoo) m_val.push_back(datafoo);
1106  return true;
1107  }
1108 
1109  /** @brief Implementation of Attribute::to_string */
1110  bool to_string(std::string &att) const override{
1111  att.clear();
1112  for (auto a: m_val) {if (att.length()) att+=" "; att+=std::to_string(a);}
1113  return true;
1114  }
1115 
1116  /** @brief get the value associated to this Attribute. */
1117  std::vector<double> value() const {
1118  return m_val;
1119  }
1120 
1121  /** @brief set the value associated to this Attribute. */
1122  void set_value(const std::vector<double>& i) {
1123  m_val = i;
1124  }
1125 
1126 private:
1127  std::vector<double> m_val; ///< Attribute value
1128 };
1129 
1130 
1131 /**
1132  * @class HepMC3::VectorStringAttribute
1133  * @brief Attribute that holds a vector of FPs of type string
1134  *
1135  * @ingroup attributes
1136  */
1138 public:
1139 
1140  /** @brief Default constructor */
1142 
1143  /** @brief Constructor initializing attribute value */
1144  VectorStringAttribute(std::vector<std::string> val):Attribute(),m_val(val) {}
1145 
1146  /** @brief Implementation of Attribute::from_string */
1147  bool from_string(const string &att) override {
1148  size_t posb = att.find_first_not_of(' ');
1149  do {
1150  size_t pose = att.find_first_of(' ', posb);
1151  m_val.push_back(att.substr(posb, pose - posb));
1152  posb = att.find_first_not_of(' ', pose);
1153  } while (posb != std::string::npos);
1154  return true;
1155  }
1156 
1157  /** @brief Implementation of Attribute::to_string */
1158  bool to_string(std::string &att) const override{
1159  att.clear();
1160  for (auto a: m_val) {if (att.length()) att+=" "; att+=a;}
1161  return true;
1162  }
1163 
1164  /** @brief get the value associated to this Attribute. */
1165  std::vector<std::string> value() const {
1166  return m_val;
1167  }
1168 
1169  /** @brief set the value associated to this Attribute. */
1170  void set_value(const std::vector<std::string>& i) {
1171  m_val = i;
1172  }
1173 
1174 private:
1175  std::vector<std::string> m_val; ///< Attribute value
1176 };
1177 
1178 
1179 } // namespace HepMC3
1180 
1181 #endif
HepMC3::Attribute::m_event
const GenEvent * m_event
Definition: Attribute.h:145
HepMC3::VectorULongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:975
HepMC3::VectorFloatAttribute::m_val
std::vector< float > m_val
Attribute value.
Definition: Attribute.h:763
HepMC3::Attribute::from_string
virtual bool from_string(const std::string &att)=0
Fill class content from string.
HepMC3::DoubleAttribute::DoubleAttribute
DoubleAttribute()
Default constructor.
Definition: Attribute.h:245
HepMC3::VectorULongLongAttribute::value
std::vector< unsigned long long > value() const
get the value associated to this Attribute.
Definition: Attribute.h:982
HepMC3::VectorStringAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:1158
HepMC3::LongLongAttribute::LongLongAttribute
LongLongAttribute()
Default constructor.
Definition: Attribute.h:428
HepMC3::Attribute::init
virtual bool init()
Optionally initialize the attribute after from_string.
Definition: Attribute.h:81
HepMC3::VectorCharAttribute::set_value
void set_value(const std::vector< char > &i)
set the value associated to this Attribute.
Definition: Attribute.h:713
HepMC3::UIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:530
HepMC3::VectorDoubleAttribute::VectorDoubleAttribute
VectorDoubleAttribute()
Default constructor.
Definition: Attribute.h:1095
HepMC3::VectorLongIntAttribute
Attribute that holds a vector of integers of type int.
Definition: Attribute.h:1046
HepMC3::BoolAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:649
HepMC3::StringAttribute
Attribute that holds a string.
Definition: Attribute.h:335
HepMC3::LongAttribute::LongAttribute
LongAttribute(long val)
Constructor initializing attribute value.
Definition: Attribute.h:205
HepMC3::VectorDoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:1110
HepMC3::ULongLongAttribute::value
unsigned long long value() const
get the value associated to this Attribute.
Definition: Attribute.h:621
HepMC3::ULongLongAttribute::ULongLongAttribute
ULongLongAttribute()
Default constructor.
Definition: Attribute.h:603
HepMC3::VectorLongDoubleAttribute::m_val
std::vector< long double > m_val
Attribute value.
Definition: Attribute.h:809
HepMC3::BoolAttribute::BoolAttribute
BoolAttribute()
Default constructor.
Definition: Attribute.h:643
HepMC3::VectorLongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:830
HepMC3::LongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:214
HepMC3::CharAttribute::m_val
char m_val
Attribute value.
Definition: Attribute.h:415
HepMC3::VectorUIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:875
HepMC3::VectorFloatAttribute
Attribute that holds a vector of floategers of type float.
Definition: Attribute.h:727
HepMC3::BoolAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:657
HepMC3::LongDoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:483
HepMC3::FloatAttribute::FloatAttribute
FloatAttribute(float val)
Constructor initializing attribute value.
Definition: Attribute.h:293
HepMC3::VectorCharAttribute::m_val
std::vector< char > m_val
Attribute value.
Definition: Attribute.h:718
HepMC3::VectorLongDoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:783
HepMC3::StringAttribute::StringAttribute
StringAttribute(const std::string &st)
String-based constructor.
Definition: Attribute.h:347
HepMC3::DoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:257
HepMC3::GenEvent
Stores event-related information.
Definition: GenEvent.h:41
HepMC3::VectorUIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:884
HepMC3::VectorFloatAttribute::VectorFloatAttribute
VectorFloatAttribute()
Default constructor.
Definition: Attribute.h:731
HepMC3::LongDoubleAttribute
Attribute that holds a real number as a double.
Definition: Attribute.h:467
HepMC3::FloatAttribute::value
float value() const
get the value associated to this Attribute.
Definition: Attribute.h:311
HepMC3::IntAttribute::IntAttribute
IntAttribute(int val)
Constructor initializing attribute value.
Definition: Attribute.h:164
HepMC3::DoubleAttribute::set_value
void set_value(const double &d)
set the value associated to this Attribute.
Definition: Attribute.h:271
HepMC3::CharAttribute::value
char value() const
get the value associated to this Attribute.
Definition: Attribute.h:405
HepMC3::LongLongAttribute::m_val
long long m_val
Attribute value.
Definition: Attribute.h:457
HepMC3::DoubleAttribute::value
double value() const
get the value associated to this Attribute.
Definition: Attribute.h:266
HepMC3::Attribute::set_unparsed_string
void set_unparsed_string(const std::string &st)
Set unparsed string.
Definition: Attribute.h:137
HepMC3::IntAttribute::IntAttribute
IntAttribute()
Default constructor.
Definition: Attribute.h:161
HepMC3::BoolAttribute::m_val
bool m_val
Attribute value.
Definition: Attribute.h:673
HepMC3::CharAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:389
HepMC3::ULongAttribute::m_val
unsigned long m_val
Attribute value.
Definition: Attribute.h:589
HepMC3::FloatAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:296
HepMC3::LongAttribute::m_val
long m_val
Attribute value.
Definition: Attribute.h:231
HepMC3::VectorCharAttribute::value
std::vector< char > value() const
get the value associated to this Attribute.
Definition: Attribute.h:708
HepMC3::CharAttribute::set_value
void set_value(const char &i)
set the value associated to this Attribute.
Definition: Attribute.h:410
HepMC3::StringAttribute::set_value
void set_value(const std::string &s)
set the value associated to this Attribute.
Definition: Attribute.h:367
HepMC3::DoubleAttribute::m_val
double m_val
Attribute value.
Definition: Attribute.h:277
HepMC3
HepMC3 main namespace.
Definition: AnalysisExample.h:19
HepMC3::LongLongAttribute::value
long long value() const
get the value associated to this Attribute.
Definition: Attribute.h:446
HepMC3::ULongAttribute::value
unsigned long value() const
get the value associated to this Attribute.
Definition: Attribute.h:579
HepMC3::VectorLongIntAttribute::m_val
std::vector< long int > m_val
Attribute value.
Definition: Attribute.h:1082
HepMC3::LongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:434
HepMC3::VectorDoubleAttribute::value
std::vector< double > value() const
get the value associated to this Attribute.
Definition: Attribute.h:1117
HepMC3::LongDoubleAttribute::LongDoubleAttribute
LongDoubleAttribute(long double val)
Constructor initializing attribute value.
Definition: Attribute.h:474
HepMC3::ULongLongAttribute::set_value
void set_value(const unsigned long long &i)
set the value associated to this Attribute.
Definition: Attribute.h:626
HepMC3::IntAttribute
Attribute that holds an Integer implemented as an int.
Definition: Attribute.h:157
HepMC3::VectorIntAttribute::m_val
std::vector< int > m_val
Attribute value.
Definition: Attribute.h:1037
HepMC3::VectorFloatAttribute::value
std::vector< float > value() const
get the value associated to this Attribute.
Definition: Attribute.h:753
HepMC3::VectorLongIntAttribute::VectorLongIntAttribute
VectorLongIntAttribute()
Default constructor.
Definition: Attribute.h:1050
HepMC3::UIntAttribute::m_val
unsigned int m_val
Attribute value.
Definition: Attribute.h:546
HepMC3::VectorULongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:920
HepMC3::CharAttribute::CharAttribute
CharAttribute()
Default constructor.
Definition: Attribute.h:383
HepMC3::VectorULongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:929
HepMC3::Attribute::is_parsed
bool is_parsed() const
Check if this attribute is parsed.
Definition: Attribute.h:102
HepMC3::VectorUIntAttribute::VectorUIntAttribute
VectorUIntAttribute()
Default constructor.
Definition: Attribute.h:869
HepMC3::LongAttribute::value
long value() const
get the value associated to this Attribute.
Definition: Attribute.h:220
HepMC3::LongAttribute
Attribute that holds an Integer implemented as an int.
Definition: Attribute.h:198
HepMC3::VectorFloatAttribute::VectorFloatAttribute
VectorFloatAttribute(std::vector< float > val)
Constructor initializing attribute value.
Definition: Attribute.h:734
HepMC3::VectorIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:1020
HepMC3::CharAttribute
Attribute that holds an Chareger implemented as an int.
Definition: Attribute.h:379
HepMC3::VectorULongAttribute::set_value
void set_value(const std::vector< unsigned long > &i)
set the value associated to this Attribute.
Definition: Attribute.h:941
HepMC3::VectorLongLongAttribute::set_value
void set_value(const std::vector< long long > &i)
set the value associated to this Attribute.
Definition: Attribute.h:851
HepMC3::VectorIntAttribute::value
std::vector< int > value() const
get the value associated to this Attribute.
Definition: Attribute.h:1027
HepMC3::VectorLongIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:1065
HepMC3::Attribute::m_string
std::string m_string
Raw (unparsed) string.
Definition: Attribute.h:144
HepMC3::VectorLongDoubleAttribute::VectorLongDoubleAttribute
VectorLongDoubleAttribute()
Default constructor.
Definition: Attribute.h:777
HepMC3::Attribute::m_particle
GenParticlePtr m_particle
controlling GenEvent object.
Definition: Attribute.h:147
HepMC3::VectorStringAttribute::m_val
std::vector< std::string > m_val
Attribute value.
Definition: Attribute.h:1175
HepMC3::VectorLongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:839
HepMC3::Attribute::particle
GenParticlePtr particle()
Definition: Attribute.h:113
HepMC3::Attribute::Attribute
Attribute(const std::string &st)
Protected constructor that allows to set string.
Definition: Attribute.h:66
HepMC3::VectorIntAttribute::VectorIntAttribute
VectorIntAttribute(std::vector< int > val)
Constructor initializing attribute value.
Definition: Attribute.h:1008
HepMC3::VectorCharAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:701
HepMC3::ULongAttribute::ULongAttribute
ULongAttribute()
Default constructor.
Definition: Attribute.h:561
HepMC3::LongDoubleAttribute::value
long double value() const
get the value associated to this Attribute.
Definition: Attribute.h:492
HepMC3::ULongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:609
HepMC3::ULongAttribute
Attribute that holds an unsigned long.
Definition: Attribute.h:557
HepMC3::VectorULongLongAttribute::VectorULongLongAttribute
VectorULongLongAttribute()
Default constructor.
Definition: Attribute.h:960
HepMC3::Attribute::init
virtual bool init(const GenRunInfo &)
Optionally initialize the attribute after from_string.
Definition: Attribute.h:90
HepMC3::UIntAttribute::UIntAttribute
UIntAttribute(unsigned int val)
Constructor initializing attribute value.
Definition: Attribute.h:521
HepMC3::VectorULongLongAttribute::VectorULongLongAttribute
VectorULongLongAttribute(std::vector< unsigned long long > val)
Constructor initializing attribute value.
Definition: Attribute.h:963
HepMC3::VectorULongAttribute::VectorULongAttribute
VectorULongAttribute()
Default constructor.
Definition: Attribute.h:914
HepMC3::VectorLongDoubleAttribute::set_value
void set_value(const std::vector< long double > &i)
set the value associated to this Attribute.
Definition: Attribute.h:804
HepMC3::VectorUIntAttribute::m_val
std::vector< unsigned int > m_val
Attribute value.
Definition: Attribute.h:901
HepMC3::Attribute::event
const GenEvent * event() const
Definition: Attribute.h:108
HepMC3::UIntAttribute::set_value
void set_value(const unsigned int &i)
set the value associated to this Attribute.
Definition: Attribute.h:541
HepMC3::VectorCharAttribute
Attribute that holds a vector of charegers of type char.
Definition: Attribute.h:682
HepMC3::StringAttribute::StringAttribute
StringAttribute()
Default constructor - empty string.
Definition: Attribute.h:339
HepMC3::DoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:251
HepMC3::VectorULongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:966
HepMC3::VectorULongLongAttribute::m_val
std::vector< unsigned long long > m_val
Attribute value.
Definition: Attribute.h:992
HepMC3::StringAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:356
HepMC3::VectorUIntAttribute::VectorUIntAttribute
VectorUIntAttribute(std::vector< unsigned int > val)
Constructor initializing attribute value.
Definition: Attribute.h:872
HepMC3::VectorLongDoubleAttribute::value
std::vector< long double > value() const
get the value associated to this Attribute.
Definition: Attribute.h:799
HepMC3::VectorLongLongAttribute::m_val
std::vector< long long > m_val
Attribute value.
Definition: Attribute.h:856
HepMC3::VectorLongLongAttribute::value
std::vector< long long > value() const
get the value associated to this Attribute.
Definition: Attribute.h:846
HepMC3::LongAttribute::set_value
void set_value(const long &l)
set the value associated to this Attribute.
Definition: Attribute.h:225
HepMC3::VectorLongDoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:792
HepMC3::Attribute::vertex
ConstGenVertexPtr vertex() const
Definition: Attribute.h:128
HepMC3::IntAttribute::set_value
void set_value(const int &i)
set the value associated to this Attribute.
Definition: Attribute.h:184
HepMC3::VectorULongAttribute::m_val
std::vector< unsigned long > m_val
Attribute value.
Definition: Attribute.h:946
HepMC3::LongDoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:477
HepMC3::VectorCharAttribute::VectorCharAttribute
VectorCharAttribute()
Default constructor.
Definition: Attribute.h:686
HepMC3::LongLongAttribute::LongLongAttribute
LongLongAttribute(long long val)
Constructor initializing attribute value.
Definition: Attribute.h:431
HepMC3::VectorStringAttribute::value
std::vector< std::string > value() const
get the value associated to this Attribute.
Definition: Attribute.h:1165
HepMC3::VectorLongIntAttribute::value
std::vector< long int > value() const
get the value associated to this Attribute.
Definition: Attribute.h:1072
HepMC3::VectorLongLongAttribute::VectorLongLongAttribute
VectorLongLongAttribute()
Default constructor.
Definition: Attribute.h:824
HepMC3::CharAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:399
HepMC3::VectorCharAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:692
HepMC3::DoubleAttribute
Attribute that holds a real number as a double.
Definition: Attribute.h:241
HepMC3::VectorIntAttribute
Attribute that holds a vector of integers of type int.
Definition: Attribute.h:1001
HepMC3::VectorDoubleAttribute::m_val
std::vector< double > m_val
Attribute value.
Definition: Attribute.h:1127
HepMC3::LongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:208
HepMC3::LongLongAttribute::set_value
void set_value(const long long &l)
set the value associated to this Attribute.
Definition: Attribute.h:451
HepMC3::VectorULongAttribute::value
std::vector< unsigned long > value() const
get the value associated to this Attribute.
Definition: Attribute.h:936
HepMC3::VectorStringAttribute::VectorStringAttribute
VectorStringAttribute(std::vector< std::string > val)
Constructor initializing attribute value.
Definition: Attribute.h:1144
HepMC3::Attribute::vertex
GenVertexPtr vertex()
Definition: Attribute.h:123
HepMC3::VectorULongAttribute::VectorULongAttribute
VectorULongAttribute(std::vector< unsigned long > val)
Constructor initializing attribute value.
Definition: Attribute.h:917
HepMC3::VectorStringAttribute::VectorStringAttribute
VectorStringAttribute()
Default constructor.
Definition: Attribute.h:1141
HepMC3::VectorDoubleAttribute
Attribute that holds a vector of FPs of type double.
Definition: Attribute.h:1091
HepMC3::BoolAttribute::value
bool value() const
get the value associated to this Attribute.
Definition: Attribute.h:663
HepMC3::VectorStringAttribute::from_string
bool from_string(const string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:1147
HepMC3::VectorULongLongAttribute::set_value
void set_value(const std::vector< unsigned long long > &i)
set the value associated to this Attribute.
Definition: Attribute.h:987
HepMC3::UIntAttribute
Attribute that holds an unsigned int.
Definition: Attribute.h:514
HepMC3::VectorLongLongAttribute
Attribute that holds a vector of long longegers of type long long.
Definition: Attribute.h:820
HepMC3::VectorIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:1011
HepMC3::BoolAttribute::BoolAttribute
BoolAttribute(bool val)
Constructor initializing attribute value.
Definition: Attribute.h:646
HepMC3::VectorUIntAttribute::value
std::vector< unsigned int > value() const
get the value associated to this Attribute.
Definition: Attribute.h:891
HepMC3::Attribute::m_vertex
GenVertexPtr m_vertex
Vertex to which assigned.
Definition: Attribute.h:148
HepMC3::VectorDoubleAttribute::VectorDoubleAttribute
VectorDoubleAttribute(std::vector< double > val)
Constructor initializing attribute value.
Definition: Attribute.h:1098
HepMC3::ULongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:573
HepMC3::ULongLongAttribute
Attribute that holds an unsigned long long.
Definition: Attribute.h:599
HepMC3::VectorLongIntAttribute::set_value
void set_value(const std::vector< long int > &i)
set the value associated to this Attribute.
Definition: Attribute.h:1077
HepMC3::ULongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:567
HepMC3::VectorLongIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:1056
HepMC3::ULongLongAttribute::ULongLongAttribute
ULongLongAttribute(unsigned long long val)
Constructor initializing attribute value.
Definition: Attribute.h:606
HepMC3::Attribute::set_is_parsed
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition: Attribute.h:134
HepMC3::Attribute
Base attribute class.
Definition: Attribute.h:44
HepMC3::VectorCharAttribute::VectorCharAttribute
VectorCharAttribute(std::vector< char > val)
Constructor initializing attribute value.
Definition: Attribute.h:689
HepMC3::FloatAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:302
HepMC3::FloatAttribute::m_val
float m_val
Attribute value.
Definition: Attribute.h:322
HepMC3::VectorULongAttribute
Attribute that holds a vector of unsigned longegers of type unsigned long.
Definition: Attribute.h:910
HepMC3::DoubleAttribute::DoubleAttribute
DoubleAttribute(double val)
Constructor initializing attribute value.
Definition: Attribute.h:248
HepMC3::VectorIntAttribute::VectorIntAttribute
VectorIntAttribute()
Default constructor.
Definition: Attribute.h:1005
HepMC3::VectorFloatAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:746
HepMC3::IntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:173
HepMC3::LongLongAttribute
Attribute that holds an Integer implemented as an int.
Definition: Attribute.h:424
HepMC3::BoolAttribute
Attribute that holds an Booleger implemented as an int.
Definition: Attribute.h:639
HepMC3::ULongAttribute::ULongAttribute
ULongAttribute(unsigned long val)
Constructor initializing attribute value.
Definition: Attribute.h:564
HepMC3::VectorStringAttribute::set_value
void set_value(const std::vector< std::string > &i)
set the value associated to this Attribute.
Definition: Attribute.h:1170
HepMC3::IntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:167
HepMC3::VectorFloatAttribute::set_value
void set_value(const std::vector< float > &i)
set the value associated to this Attribute.
Definition: Attribute.h:758
HepMC3::LongDoubleAttribute::set_value
void set_value(const long double &d)
set the value associated to this Attribute.
Definition: Attribute.h:497
HepMC3::LongDoubleAttribute::m_val
long double m_val
Attribute value.
Definition: Attribute.h:503
HepMC3::VectorUIntAttribute::set_value
void set_value(const std::vector< unsigned int > &i)
set the value associated to this Attribute.
Definition: Attribute.h:896
HepMC3::FloatAttribute::FloatAttribute
FloatAttribute()
Default constructor.
Definition: Attribute.h:290
HepMC3::VectorLongLongAttribute::VectorLongLongAttribute
VectorLongLongAttribute(std::vector< long long > val)
Constructor initializing attribute value.
Definition: Attribute.h:827
HepMC3::FloatAttribute
Attribute that holds a real number as a float.
Definition: Attribute.h:286
HepMC3::VectorIntAttribute::set_value
void set_value(const std::vector< int > &i)
set the value associated to this Attribute.
Definition: Attribute.h:1032
HepMC3::VectorLongIntAttribute::VectorLongIntAttribute
VectorLongIntAttribute(std::vector< long int > val)
Constructor initializing attribute value.
Definition: Attribute.h:1053
HepMC3::ULongAttribute::set_value
void set_value(const unsigned long &i)
set the value associated to this Attribute.
Definition: Attribute.h:584
HepMC3::Attribute::particle
ConstGenParticlePtr particle() const
Definition: Attribute.h:118
HepMC3::VectorLongDoubleAttribute
Attribute that holds a vector of long doubleegers of type long double.
Definition: Attribute.h:773
HepMC3::StringAttribute::value
std::string value() const
get the value associated to this Attribute.
Definition: Attribute.h:362
HepMC3::UIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:524
HepMC3::ULongLongAttribute::m_val
unsigned long long m_val
Attribute value.
Definition: Attribute.h:631
HepMC3::IntAttribute::m_val
int m_val
Attribute value.
Definition: Attribute.h:189
HepMC3::VectorULongLongAttribute
Attribute that holds a vector of unsigned long longegers of type unsigned long long.
Definition: Attribute.h:956
HepMC3::VectorDoubleAttribute::set_value
void set_value(const std::vector< double > &i)
set the value associated to this Attribute.
Definition: Attribute.h:1122
HepMC3::VectorLongDoubleAttribute::VectorLongDoubleAttribute
VectorLongDoubleAttribute(std::vector< long double > val)
Constructor initializing attribute value.
Definition: Attribute.h:780
HepMC3::Attribute::unparsed_string
const std::string & unparsed_string() const
Get unparsed string.
Definition: Attribute.h:105
HepMC3::ULongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:615
HepMC3::IntAttribute::value
int value() const
get the value associated to this Attribute.
Definition: Attribute.h:179
HepMC3::LongAttribute::LongAttribute
LongAttribute()
Default constructor.
Definition: Attribute.h:202
HepMC3::UIntAttribute::UIntAttribute
UIntAttribute()
Default constructor.
Definition: Attribute.h:518
HepMC3::Attribute::Attribute
Attribute()
Default constructor.
Definition: Attribute.h:51
HepMC3::BoolAttribute::set_value
void set_value(const bool &i)
set the value associated to this Attribute.
Definition: Attribute.h:668
HepMC3::LongDoubleAttribute::LongDoubleAttribute
LongDoubleAttribute()
Default constructor.
Definition: Attribute.h:471
HepMC3::Attribute::to_string
virtual bool to_string(std::string &att) const =0
Fill string from class content.
HepMC3::VectorUIntAttribute
Attribute that holds a vector of unsigned integers of type unsigned int.
Definition: Attribute.h:865
HepMC3::FloatAttribute::set_value
void set_value(const float &f)
set the value associated to this Attribute.
Definition: Attribute.h:316
HepMC3::VectorStringAttribute
Attribute that holds a vector of FPs of type string.
Definition: Attribute.h:1137
HepMC3::Attribute::m_is_parsed
bool m_is_parsed
Is this attribute parsed?
Definition: Attribute.h:143
HepMC3::StringAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:350
HepMC3::VectorDoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:1101
HepMC3::VectorFloatAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition: Attribute.h:737
HepMC3::CharAttribute::CharAttribute
CharAttribute(char val)
Constructor initializing attribute value.
Definition: Attribute.h:386
HepMC3::LongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition: Attribute.h:440
HepMC3::Attribute::~Attribute
virtual ~Attribute()
Virtual destructor.
Definition: Attribute.h:54
HepMC3::UIntAttribute::value
unsigned int value() const
get the value associated to this Attribute.
Definition: Attribute.h:536
HepMC3::GenRunInfo
Stores run-related information.
Definition: GenRunInfo.h:33