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