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