Jpp 20.0.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JFIT::JEvent Struct Reference

Auxiliary class for historical event. More...

#include <JHistory.hh>

Inheritance diagram for JFIT::JEvent:
JLANG::JEquals< JFirst_t, JSecond_t >

Public Member Functions

 JEvent ()
 Default constructor.
 
 JEvent (const int type)
 Constructor.
 
virtual ~JEvent ()
 Virtual destructor.
 
bool equals (const JEvent &event) const
 Check equality.
 
const JEventoperator() ()
 Make this event unique.
 
 ClassDef (JEvent, 2)
 

Public Attributes

int type
 application type
 
JUUID uuid
 UUID.
 
std::string git
 GIT revision.
 
std::string date
 date
 

Protected Attributes

uint32_t counter = 0
 internal counter
 

Friends

std::ostream & operator<< (std::ostream &out, const JEvent &event)
 Write event to output stream.
 

Detailed Description

Auxiliary class for historical event.

Definition at line 38 of file JHistory.hh.

Constructor & Destructor Documentation

◆ JEvent() [1/2]

JFIT::JEvent::JEvent ( )
inline

Default constructor.

Definition at line 44 of file JHistory.hh.

44 :
45 type(-1),
46 uuid()
47 {}
int type
application type
Definition JHistory.hh:136
JUUID uuid
UUID.
Definition JHistory.hh:137

◆ JEvent() [2/2]

JFIT::JEvent::JEvent ( const int type)
inline

Constructor.

Parameters
typeapplication type

Definition at line 55 of file JHistory.hh.

56 {
57 using namespace std;
58 using namespace JPP;
59
60 this->type = type;
61 this->git = getGITVersion();
62 this->date = getDateAndTime();
63
64 // UUID
65
66 random_device device;
67
68 uniform_int_distribution<uint32_t> generator(1, numeric_limits<uint32_t>::max());
69
70 uint32_t* value = reinterpret_cast<uint32_t*>(&(this->uuid.uuid));
71
72 for (int i = 0; i != 3; ++i) {
73 value[i] = generator(device);
74 }
75 }
std::string getGITVersion(const std::string &tag)
Get GIT version for given GIT tag.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Description of Monte Carlo event generation applications.
Definition JHead.hh:469
std::string date
date
Definition JHistory.hh:139
std::string git
GIT revision.
Definition JHistory.hh:138
uuid_t uuid
Definition JUUID.hh:172

◆ ~JEvent()

virtual JFIT::JEvent::~JEvent ( )
inlinevirtual

Virtual destructor.

Definition at line 81 of file JHistory.hh.

82 {}

Member Function Documentation

◆ equals()

bool JFIT::JEvent::equals ( const JEvent & event) const
inline

Check equality.

Parameters
eventevent
Returns
true if events are equal; else false

Definition at line 91 of file JHistory.hh.

92 {
93 return (this->type == event.type &&
94 this->uuid == event.uuid &&
95 this->git == event.git &&
96 this->date == event.date);
97 }

◆ operator()()

const JEvent & JFIT::JEvent::operator() ( )
inline

Make this event unique.

Returns
event

Definition at line 105 of file JHistory.hh.

106 {
107 uint32_t* value = reinterpret_cast<uint32_t*>(&(this->uuid.uuid));
108
109 value[3] = ++counter;
110
111 return *this;
112 }
uint32_t counter
internal counter
Definition JHistory.hh:142

◆ ClassDef()

JFIT::JEvent::ClassDef ( JEvent ,
2  )

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JEvent & event )
friend

Write event to output stream.

Parameters
outoutput stream
eventevent
Returns
output stream

Definition at line 122 of file JHistory.hh.

123 {
124 using namespace std;
125
126 out << setw(3) << right << event.type << ' '
127 << setw(36) << left << event.uuid << ' '
128 << setw(20) << left << event.git << ' '
129 << setw(20) << left << event.date << right;
130
131 return out;
132 }

Member Data Documentation

◆ type

int JFIT::JEvent::type

application type

Definition at line 136 of file JHistory.hh.

◆ uuid

JUUID JFIT::JEvent::uuid

UUID.

Definition at line 137 of file JHistory.hh.

◆ git

std::string JFIT::JEvent::git

GIT revision.

Definition at line 138 of file JHistory.hh.

◆ date

std::string JFIT::JEvent::date

date

Definition at line 139 of file JHistory.hh.

◆ counter

uint32_t JFIT::JEvent::counter = 0
protected

internal counter

Definition at line 142 of file JHistory.hh.


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