HepMC3 event record library: Attribute.h Source File

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. */
44 class 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 */
157 class IntAttribute : public Attribute {
158public:
159
160 /** @brief Default constructor */
161 IntAttribute():Attribute(),m_val(0) {}
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 */
200 class LongAttribute : public Attribute {
201public:
202
203 /** @brief Default constructor */
204 LongAttribute(): Attribute(), m_val(0) {}
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 */
245 class DoubleAttribute : public Attribute {
246public:
247
248 /** @brief Default constructor */
249 DoubleAttribute(): Attribute(), m_val(0.0) {}
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 */
292 class FloatAttribute : public Attribute {
293public:
294
295 /** @brief Default constructor */
296 FloatAttribute(): Attribute(), m_val(0.0) {}
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 */
343 class StringAttribute : public Attribute {
344public:
345
346 /** @brief Default constructor - empty string */
347 StringAttribute():Attribute() {}
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 {
359 set_unparsed_string(att);
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) {
376 set_unparsed_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 */
387 class CharAttribute : public Attribute {
388public:
389
390 /** @brief Default constructor */
391 CharAttribute():Attribute(),m_val(0) {}
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 */
434 class LongLongAttribute : public Attribute {
435public:
436
437 /** @brief Default constructor */
438 LongLongAttribute(): Attribute(), m_val(0) {}
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 */
479 class LongDoubleAttribute : public Attribute {
480public:
481
482 /** @brief Default constructor */
483 LongDoubleAttribute(): Attribute(), m_val(0.0) {}
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(), nullptr);
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 */
528 class UIntAttribute : public Attribute {
529public:
530
531 /** @brief Default constructor */
532 UIntAttribute():Attribute(),m_val(0) {}
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(), nullptr, 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 */
573 class ULongAttribute : public Attribute {
574public:
575
576 /** @brief Default constructor */
577 ULongAttribute():Attribute(),m_val(0) {}
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(), nullptr, 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 */
617 class ULongLongAttribute : public Attribute {
618public:
619
620 /** @brief Default constructor */
621 ULongLongAttribute():Attribute(),m_val(0) {}
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(), nullptr, 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*/
660 class BoolAttribute : public Attribute {
661public:
662
663 /** @brief Default constructor */
664 BoolAttribute():Attribute(),m_val(false) {}
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 */
705 class VectorCharAttribute : public Attribute {
706public:
707
708 /** @brief Default constructor */
709 VectorCharAttribute():Attribute(),m_val() {}
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 */
753 class VectorFloatAttribute : public Attribute {
754public:
755
756 /** @brief Default constructor */
757 VectorFloatAttribute():Attribute(),m_val() {}
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 */
801 class VectorLongDoubleAttribute : public Attribute {
802public:
803
804 /** @brief Default constructor */
805 VectorLongDoubleAttribute():Attribute(),m_val() {}
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 */
850 class VectorLongLongAttribute : public Attribute {
851public:
852
853 /** @brief Default constructor */
854 VectorLongLongAttribute():Attribute(),m_val() {}
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 */
897 class VectorUIntAttribute : public Attribute {
898public:
899
900 /** @brief Default constructor */
901 VectorUIntAttribute():Attribute(),m_val() {}
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 */
944 class VectorULongAttribute : public Attribute {
945public:
946
947 /** @brief Default constructor */
948 VectorULongAttribute():Attribute(),m_val() {}
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 */
992 class VectorULongLongAttribute : public Attribute {
993public:
994
995 /** @brief Default constructor */
996 VectorULongLongAttribute():Attribute(),m_val() {}
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 */
1039 class VectorIntAttribute : public Attribute {
1040public:
1041
1042 /** @brief Default constructor */
1043 VectorIntAttribute():Attribute(),m_val() {}
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 */
1087 class VectorLongIntAttribute : public Attribute {
1088public:
1089
1090 /** @brief Default constructor */
1091 VectorLongIntAttribute():Attribute(),m_val() {}
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 */
1134 class VectorDoubleAttribute : public Attribute {
1135public:
1136
1137 /** @brief Default constructor */
1138 VectorDoubleAttribute():Attribute(),m_val() {}
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 */
1182 class VectorStringAttribute : public Attribute {
1183public:
1184
1185 /** @brief Default constructor */
1186 VectorStringAttribute():Attribute(),m_val() {}
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
HepMC3::Attribute::~Attribute
virtual ~Attribute()
Virtual destructor.
Definition Attribute.h:54
HepMC3::Attribute::unparsed_string
const std::string & unparsed_string() const
Get unparsed string.
Definition Attribute.h:105
HepMC3::Attribute::Attribute
Attribute(const std::string &st)
Protected constructor that allows to set string.
Definition Attribute.h:66
HepMC3::Attribute::is_parsed
bool is_parsed() const
Check if this attribute is parsed.
Definition Attribute.h:102
HepMC3::Attribute::vertex
ConstGenVertexPtr vertex() const
Definition Attribute.h:128
HepMC3::Attribute::event
const GenEvent * event() const
Definition Attribute.h:108
HepMC3::Attribute::Attribute
Attribute()
Default constructor.
Definition Attribute.h:51
HepMC3::Attribute::particle
ConstGenParticlePtr particle() const
Definition Attribute.h:118
HepMC3::Attribute::m_string
std::string m_string
Raw (unparsed) string.
Definition Attribute.h:144
HepMC3::Attribute::m_event
const GenEvent * m_event
Definition Attribute.h:145
HepMC3::Attribute::particle
GenParticlePtr particle()
Definition Attribute.h:113
HepMC3::Attribute::from_string
virtual bool from_string(const std::string &att)=0
Fill class content from string.
HepMC3::Attribute::vertex
GenVertexPtr vertex()
Definition Attribute.h:123
HepMC3::Attribute::m_vertex
GenVertexPtr m_vertex
Vertex to which assigned.
Definition Attribute.h:148
HepMC3::Attribute::set_unparsed_string
void set_unparsed_string(const std::string &st)
Set unparsed string.
Definition Attribute.h:137
HepMC3::Attribute::to_string
virtual bool to_string(std::string &att) const =0
Fill string from class content.
HepMC3::Attribute::m_particle
GenParticlePtr m_particle
controlling GenEvent object.
Definition Attribute.h:147
HepMC3::Attribute::init
virtual bool init(const GenRunInfo &)
Optionally initialize the attribute after from_string.
Definition Attribute.h:90
HepMC3::Attribute::init
virtual bool init()
Optionally initialize the attribute after from_string.
Definition Attribute.h:81
HepMC3::Attribute::GenEvent
friend class GenEvent
GenEvent is a friend.
Definition Attribute.h:69
HepMC3::Attribute::set_is_parsed
void set_is_parsed(bool flag)
Set is_parsed flag.
Definition Attribute.h:134
HepMC3::Attribute::m_is_parsed
bool m_is_parsed
Is this attribute parsed?
Definition Attribute.h:143
HepMC3::BoolAttribute::BoolAttribute
BoolAttribute(bool val)
Constructor initializing attribute value.
Definition Attribute.h:667
HepMC3::BoolAttribute::BoolAttribute
BoolAttribute()
Default constructor.
Definition Attribute.h:664
HepMC3::BoolAttribute::value
bool value() const
get the value associated to this Attribute.
Definition Attribute.h:685
HepMC3::BoolAttribute::m_val
bool m_val
Attribute value.
Definition Attribute.h:696
HepMC3::BoolAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:670
HepMC3::BoolAttribute::set_value
void set_value(const bool &i)
set the value associated to this Attribute.
Definition Attribute.h:690
HepMC3::BoolAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:679
HepMC3::CharAttribute::CharAttribute
CharAttribute(char val)
Constructor initializing attribute value.
Definition Attribute.h:394
HepMC3::CharAttribute::CharAttribute
CharAttribute()
Default constructor.
Definition Attribute.h:391
HepMC3::CharAttribute::set_value
void set_value(const char &i)
set the value associated to this Attribute.
Definition Attribute.h:419
HepMC3::CharAttribute::value
char value() const
get the value associated to this Attribute.
Definition Attribute.h:414
HepMC3::CharAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:397
HepMC3::CharAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:408
HepMC3::CharAttribute::m_val
char m_val
Attribute value.
Definition Attribute.h:425
HepMC3::DoubleAttribute::m_val
double m_val
Attribute value.
Definition Attribute.h:283
HepMC3::DoubleAttribute::set_value
void set_value(const double &d)
set the value associated to this Attribute.
Definition Attribute.h:276
HepMC3::DoubleAttribute::value
double value() const
get the value associated to this Attribute.
Definition Attribute.h:271
HepMC3::DoubleAttribute::DoubleAttribute
DoubleAttribute()
Default constructor.
Definition Attribute.h:249
HepMC3::DoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:255
HepMC3::DoubleAttribute::DoubleAttribute
DoubleAttribute(double val)
Constructor initializing attribute value.
Definition Attribute.h:252
HepMC3::DoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:262
HepMC3::FloatAttribute::m_val
float m_val
Attribute value.
Definition Attribute.h:330
HepMC3::FloatAttribute::FloatAttribute
FloatAttribute()
Default constructor.
Definition Attribute.h:296
HepMC3::FloatAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:302
HepMC3::FloatAttribute::FloatAttribute
FloatAttribute(float val)
Constructor initializing attribute value.
Definition Attribute.h:299
HepMC3::FloatAttribute::set_value
void set_value(const float &f)
set the value associated to this Attribute.
Definition Attribute.h:323
HepMC3::FloatAttribute::value
float value() const
get the value associated to this Attribute.
Definition Attribute.h:318
HepMC3::FloatAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:309
HepMC3::GenEvent
Stores event-related information.
Definition GenEvent.h:47
HepMC3::GenRunInfo
Stores run-related information.
Definition GenRunInfo.h:33
HepMC3::IntAttribute::m_val
int m_val
Attribute value.
Definition Attribute.h:191
HepMC3::IntAttribute::set_value
void set_value(const int &i)
set the value associated to this Attribute.
Definition Attribute.h:185
HepMC3::IntAttribute::IntAttribute
IntAttribute()
Default constructor.
Definition Attribute.h:161
HepMC3::IntAttribute::value
int value() const
get the value associated to this Attribute.
Definition Attribute.h:180
HepMC3::IntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:167
HepMC3::IntAttribute::IntAttribute
IntAttribute(int val)
Constructor initializing attribute value.
Definition Attribute.h:164
HepMC3::IntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:174
HepMC3::LongAttribute::m_val
long m_val
Attribute value.
Definition Attribute.h:235
HepMC3::LongAttribute::LongAttribute
LongAttribute(long val)
Constructor initializing attribute value.
Definition Attribute.h:207
HepMC3::LongAttribute::set_value
void set_value(const long &l)
set the value associated to this Attribute.
Definition Attribute.h:228
HepMC3::LongAttribute::value
long value() const
get the value associated to this Attribute.
Definition Attribute.h:223
HepMC3::LongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:210
HepMC3::LongAttribute::LongAttribute
LongAttribute()
Default constructor.
Definition Attribute.h:204
HepMC3::LongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:217
HepMC3::LongDoubleAttribute::m_val
long double m_val
Attribute value.
Definition Attribute.h:517
HepMC3::LongDoubleAttribute::LongDoubleAttribute
LongDoubleAttribute()
Default constructor.
Definition Attribute.h:483
HepMC3::LongDoubleAttribute::LongDoubleAttribute
LongDoubleAttribute(long double val)
Constructor initializing attribute value.
Definition Attribute.h:486
HepMC3::LongDoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:489
HepMC3::LongDoubleAttribute::set_value
void set_value(const long double &d)
set the value associated to this Attribute.
Definition Attribute.h:510
HepMC3::LongDoubleAttribute::value
long double value() const
get the value associated to this Attribute.
Definition Attribute.h:505
HepMC3::LongDoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:496
HepMC3::LongLongAttribute::value
long long value() const
get the value associated to this Attribute.
Definition Attribute.h:457
HepMC3::LongLongAttribute::set_value
void set_value(const long long &l)
set the value associated to this Attribute.
Definition Attribute.h:462
HepMC3::LongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:444
HepMC3::LongLongAttribute::LongLongAttribute
LongLongAttribute(long long val)
Constructor initializing attribute value.
Definition Attribute.h:441
HepMC3::LongLongAttribute::LongLongAttribute
LongLongAttribute()
Default constructor.
Definition Attribute.h:438
HepMC3::LongLongAttribute::m_val
long long m_val
Attribute value.
Definition Attribute.h:469
HepMC3::LongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:451
HepMC3::StringAttribute::StringAttribute
StringAttribute()
Default constructor - empty string.
Definition Attribute.h:347
HepMC3::StringAttribute::set_value
void set_value(const std::string &s)
set the value associated to this Attribute.
Definition Attribute.h:375
HepMC3::StringAttribute::StringAttribute
StringAttribute(const std::string &st)
String-based constructor.
Definition Attribute.h:355
HepMC3::StringAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:358
HepMC3::StringAttribute::value
std::string value() const
get the value associated to this Attribute.
Definition Attribute.h:370
HepMC3::StringAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:364
HepMC3::UIntAttribute::set_value
void set_value(const unsigned int &i)
set the value associated to this Attribute.
Definition Attribute.h:556
HepMC3::UIntAttribute::value
unsigned int value() const
get the value associated to this Attribute.
Definition Attribute.h:551
HepMC3::UIntAttribute::UIntAttribute
UIntAttribute(unsigned int val)
Constructor initializing attribute value.
Definition Attribute.h:535
HepMC3::UIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:538
HepMC3::UIntAttribute::m_val
unsigned int m_val
Attribute value.
Definition Attribute.h:562
HepMC3::UIntAttribute::UIntAttribute
UIntAttribute()
Default constructor.
Definition Attribute.h:532
HepMC3::UIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:545
HepMC3::ULongAttribute::ULongAttribute
ULongAttribute()
Default constructor.
Definition Attribute.h:577
HepMC3::ULongAttribute::ULongAttribute
ULongAttribute(unsigned long val)
Constructor initializing attribute value.
Definition Attribute.h:580
HepMC3::ULongAttribute::set_value
void set_value(const unsigned long &i)
set the value associated to this Attribute.
Definition Attribute.h:601
HepMC3::ULongAttribute::m_val
unsigned long m_val
Attribute value.
Definition Attribute.h:607
HepMC3::ULongAttribute::value
unsigned long value() const
get the value associated to this Attribute.
Definition Attribute.h:596
HepMC3::ULongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:583
HepMC3::ULongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:590
HepMC3::ULongLongAttribute::m_val
unsigned long long m_val
Attribute value.
Definition Attribute.h:651
HepMC3::ULongLongAttribute::value
unsigned long long value() const
get the value associated to this Attribute.
Definition Attribute.h:640
HepMC3::ULongLongAttribute::ULongLongAttribute
ULongLongAttribute()
Default constructor.
Definition Attribute.h:621
HepMC3::ULongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:627
HepMC3::ULongLongAttribute::set_value
void set_value(const unsigned long long &i)
set the value associated to this Attribute.
Definition Attribute.h:645
HepMC3::ULongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:634
HepMC3::ULongLongAttribute::ULongLongAttribute
ULongLongAttribute(unsigned long long val)
Constructor initializing attribute value.
Definition Attribute.h:624
HepMC3::VectorCharAttribute::VectorCharAttribute
VectorCharAttribute(std::vector< char > val)
Constructor initializing attribute value.
Definition Attribute.h:712
HepMC3::VectorCharAttribute::value
std::vector< char > value() const
get the value associated to this Attribute.
Definition Attribute.h:732
HepMC3::VectorCharAttribute::m_val
std::vector< char > m_val
Attribute value.
Definition Attribute.h:744
HepMC3::VectorCharAttribute::set_value
void set_value(const std::vector< char > &i)
set the value associated to this Attribute.
Definition Attribute.h:738
HepMC3::VectorCharAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:715
HepMC3::VectorCharAttribute::VectorCharAttribute
VectorCharAttribute()
Default constructor.
Definition Attribute.h:709
HepMC3::VectorCharAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:725
HepMC3::VectorDoubleAttribute::value
std::vector< double > value() const
get the value associated to this Attribute.
Definition Attribute.h:1161
HepMC3::VectorDoubleAttribute::set_value
void set_value(const std::vector< double > &i)
set the value associated to this Attribute.
Definition Attribute.h:1166
HepMC3::VectorDoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:1144
HepMC3::VectorDoubleAttribute::m_val
std::vector< double > m_val
Attribute value.
Definition Attribute.h:1172
HepMC3::VectorDoubleAttribute::VectorDoubleAttribute
VectorDoubleAttribute(std::vector< double > val)
Constructor initializing attribute value.
Definition Attribute.h:1141
HepMC3::VectorDoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:1154
HepMC3::VectorDoubleAttribute::VectorDoubleAttribute
VectorDoubleAttribute()
Default constructor.
Definition Attribute.h:1138
HepMC3::VectorFloatAttribute::VectorFloatAttribute
VectorFloatAttribute(std::vector< float > val)
Constructor initializing attribute value.
Definition Attribute.h:760
HepMC3::VectorFloatAttribute::value
std::vector< float > value() const
get the value associated to this Attribute.
Definition Attribute.h:780
HepMC3::VectorFloatAttribute::set_value
void set_value(const std::vector< float > &i)
set the value associated to this Attribute.
Definition Attribute.h:785
HepMC3::VectorFloatAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:763
HepMC3::VectorFloatAttribute::VectorFloatAttribute
VectorFloatAttribute()
Default constructor.
Definition Attribute.h:757
HepMC3::VectorFloatAttribute::m_val
std::vector< float > m_val
Attribute value.
Definition Attribute.h:791
HepMC3::VectorFloatAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:773
HepMC3::VectorIntAttribute::value
std::vector< int > value() const
get the value associated to this Attribute.
Definition Attribute.h:1066
HepMC3::VectorIntAttribute::m_val
std::vector< int > m_val
Attribute value.
Definition Attribute.h:1078
HepMC3::VectorIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:1049
HepMC3::VectorIntAttribute::VectorIntAttribute
VectorIntAttribute()
Default constructor.
Definition Attribute.h:1043
HepMC3::VectorIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:1059
HepMC3::VectorIntAttribute::set_value
void set_value(const std::vector< int > &i)
set the value associated to this Attribute.
Definition Attribute.h:1072
HepMC3::VectorIntAttribute::VectorIntAttribute
VectorIntAttribute(std::vector< int > val)
Constructor initializing attribute value.
Definition Attribute.h:1046
HepMC3::VectorLongDoubleAttribute::value
std::vector< long double > value() const
get the value associated to this Attribute.
Definition Attribute.h:828
HepMC3::VectorLongDoubleAttribute::set_value
void set_value(const std::vector< long double > &i)
set the value associated to this Attribute.
Definition Attribute.h:833
HepMC3::VectorLongDoubleAttribute::VectorLongDoubleAttribute
VectorLongDoubleAttribute()
Default constructor.
Definition Attribute.h:805
HepMC3::VectorLongDoubleAttribute::m_val
std::vector< long double > m_val
Attribute value.
Definition Attribute.h:839
HepMC3::VectorLongDoubleAttribute::VectorLongDoubleAttribute
VectorLongDoubleAttribute(std::vector< long double > val)
Constructor initializing attribute value.
Definition Attribute.h:808
HepMC3::VectorLongDoubleAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:811
HepMC3::VectorLongDoubleAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:821
HepMC3::VectorLongIntAttribute::VectorLongIntAttribute
VectorLongIntAttribute(std::vector< long int > val)
Constructor initializing attribute value.
Definition Attribute.h:1094
HepMC3::VectorLongIntAttribute::VectorLongIntAttribute
VectorLongIntAttribute()
Default constructor.
Definition Attribute.h:1091
HepMC3::VectorLongIntAttribute::value
std::vector< long int > value() const
get the value associated to this Attribute.
Definition Attribute.h:1114
HepMC3::VectorLongIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:1097
HepMC3::VectorLongIntAttribute::m_val
std::vector< long int > m_val
Attribute value.
Definition Attribute.h:1125
HepMC3::VectorLongIntAttribute::set_value
void set_value(const std::vector< long int > &i)
set the value associated to this Attribute.
Definition Attribute.h:1119
HepMC3::VectorLongIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:1107
HepMC3::VectorLongLongAttribute::value
std::vector< long long > value() const
get the value associated to this Attribute.
Definition Attribute.h:877
HepMC3::VectorLongLongAttribute::m_val
std::vector< long long > m_val
Attribute value.
Definition Attribute.h:888
HepMC3::VectorLongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:860
HepMC3::VectorLongLongAttribute::VectorLongLongAttribute
VectorLongLongAttribute()
Default constructor.
Definition Attribute.h:854
HepMC3::VectorLongLongAttribute::set_value
void set_value(const std::vector< long long > &i)
set the value associated to this Attribute.
Definition Attribute.h:882
HepMC3::VectorLongLongAttribute::VectorLongLongAttribute
VectorLongLongAttribute(std::vector< long long > val)
Constructor initializing attribute value.
Definition Attribute.h:857
HepMC3::VectorLongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:870
HepMC3::VectorStringAttribute::from_string
bool from_string(const string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:1192
HepMC3::VectorStringAttribute::value
std::vector< std::string > value() const
get the value associated to this Attribute.
Definition Attribute.h:1211
HepMC3::VectorStringAttribute::set_value
void set_value(const std::vector< std::string > &i)
set the value associated to this Attribute.
Definition Attribute.h:1216
HepMC3::VectorStringAttribute::VectorStringAttribute
VectorStringAttribute(std::vector< std::string > val)
Constructor initializing attribute value.
Definition Attribute.h:1189
HepMC3::VectorStringAttribute::VectorStringAttribute
VectorStringAttribute()
Default constructor.
Definition Attribute.h:1186
HepMC3::VectorStringAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:1204
HepMC3::VectorStringAttribute::m_val
std::vector< std::string > m_val
Attribute value.
Definition Attribute.h:1222
HepMC3::VectorUIntAttribute::VectorUIntAttribute
VectorUIntAttribute()
Default constructor.
Definition Attribute.h:901
HepMC3::VectorUIntAttribute::m_val
std::vector< unsigned int > m_val
Attribute value.
Definition Attribute.h:935
HepMC3::VectorUIntAttribute::VectorUIntAttribute
VectorUIntAttribute(std::vector< unsigned int > val)
Constructor initializing attribute value.
Definition Attribute.h:904
HepMC3::VectorUIntAttribute::value
std::vector< unsigned int > value() const
get the value associated to this Attribute.
Definition Attribute.h:924
HepMC3::VectorUIntAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:907
HepMC3::VectorUIntAttribute::set_value
void set_value(const std::vector< unsigned int > &i)
set the value associated to this Attribute.
Definition Attribute.h:929
HepMC3::VectorUIntAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:917
HepMC3::VectorULongAttribute::set_value
void set_value(const std::vector< unsigned long > &i)
set the value associated to this Attribute.
Definition Attribute.h:976
HepMC3::VectorULongAttribute::value
std::vector< unsigned long > value() const
get the value associated to this Attribute.
Definition Attribute.h:971
HepMC3::VectorULongAttribute::m_val
std::vector< unsigned long > m_val
Attribute value.
Definition Attribute.h:982
HepMC3::VectorULongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:954
HepMC3::VectorULongAttribute::VectorULongAttribute
VectorULongAttribute()
Default constructor.
Definition Attribute.h:948
HepMC3::VectorULongAttribute::VectorULongAttribute
VectorULongAttribute(std::vector< unsigned long > val)
Constructor initializing attribute value.
Definition Attribute.h:951
HepMC3::VectorULongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:964
HepMC3::VectorULongLongAttribute::value
std::vector< unsigned long long > value() const
get the value associated to this Attribute.
Definition Attribute.h:1019
HepMC3::VectorULongLongAttribute::VectorULongLongAttribute
VectorULongLongAttribute(std::vector< unsigned long long > val)
Constructor initializing attribute value.
Definition Attribute.h:999
HepMC3::VectorULongLongAttribute::set_value
void set_value(const std::vector< unsigned long long > &i)
set the value associated to this Attribute.
Definition Attribute.h:1024
HepMC3::VectorULongLongAttribute::from_string
bool from_string(const std::string &att) override
Implementation of Attribute::from_string.
Definition Attribute.h:1002
HepMC3::VectorULongLongAttribute::m_val
std::vector< unsigned long long > m_val
Attribute value.
Definition Attribute.h:1030
HepMC3::VectorULongLongAttribute::to_string
bool to_string(std::string &att) const override
Implementation of Attribute::to_string.
Definition Attribute.h:1012
HepMC3::VectorULongLongAttribute::VectorULongLongAttribute
VectorULongLongAttribute()
Default constructor.
Definition Attribute.h:996
HepMC3
HepMC3 main namespace.
Definition AnalysisExample.h:24