Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JFIT::JHistory Struct Reference

Container for historical events. More...

#include <JHistory.hh>

Inheritance diagram for JFIT::JHistory:
std::vector< JEvent > JFIT::JFit

Classes

struct  is_event
 Auxiliary class to test history. More...
 
struct  is_not_event
 Auxiliary class to test history. More...
 

Public Member Functions

 JHistory ()
 Default constructor.
 
 JHistory (const int type)
 Constructor.
 
 JHistory (const JHistory &history, const int type)
 Constructor.
 
virtual ~JHistory ()
 Virtual destructor.
 
const JHistorygetHistory () const
 Get history.
 
JHistorygetHistory ()
 Get history.
 
bool has (const int type) const
 Has event in history.
 
bool getStatus (const std::vector< int > &types) const
 Get status.
 
JHistoryadd (const int type)
 Add event to history.
 
bool hasParentUUID () const
 Has parent UUID.
 
const JUUIDgetUUID () const
 Get UUID.
 
const JUUIDgetParentUUID () const
 Get parent UUID.
 
 ClassDef (JHistory, 2)
 

Friends

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

Detailed Description

Container for historical events.

Definition at line 99 of file JHistory.hh.

Constructor & Destructor Documentation

◆ JHistory() [1/3]

JFIT::JHistory::JHistory ( )
inline

Default constructor.

Definition at line 186 of file JHistory.hh.

186 :
188 {}

◆ JHistory() [2/3]

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

Constructor.

Parameters
typeapplication type

Definition at line 196 of file JHistory.hh.

196 :
198 {
199 add(type);
200 }
JHistory & add(const int type)
Add event to history.
Definition JHistory.hh:295

◆ JHistory() [3/3]

JFIT::JHistory::JHistory ( const JHistory & history,
const int type )
inline

Constructor.

Parameters
historyhistory
typeapplication type

Definition at line 209 of file JHistory.hh.

210 :
211 std::vector<JEvent>(history)
212 {
213 add(type);
214 }

◆ ~JHistory()

virtual JFIT::JHistory::~JHistory ( )
inlinevirtual

Virtual destructor.

Definition at line 220 of file JHistory.hh.

221 {}

Member Function Documentation

◆ getHistory() [1/2]

const JHistory & JFIT::JHistory::getHistory ( ) const
inline

Get history.

Returns
histtory

Definition at line 229 of file JHistory.hh.

230 {
231 return static_cast<const JHistory&>(*this);
232 }
JHistory()
Default constructor.
Definition JHistory.hh:186

◆ getHistory() [2/2]

JHistory & JFIT::JHistory::getHistory ( )
inline

Get history.

Returns
histtory

Definition at line 240 of file JHistory.hh.

241 {
242 return static_cast<JHistory&>(*this);
243 }

◆ has()

bool JFIT::JHistory::has ( const int type) const
inline

Has event in history.

Parameters
typeapplication type
Returns
true if given event in history; else false

Definition at line 252 of file JHistory.hh.

253 {
254 for (const_iterator i = this->begin(); i != this->end(); ++i) {
255 if (i->type == type) {
256 return true;
257 }
258 }
259
260 return false;
261 }

◆ getStatus()

bool JFIT::JHistory::getStatus ( const std::vector< int > & types) const
inline

Get status.

Parameters
typesapplication types
Returns
true if history matches appplication types; else false

Definition at line 270 of file JHistory.hh.

271 {
272 if (this->size() == types.size()) {
273
274 for (size_t i = 0; i != this->size(); ++i) {
275 if ((*this)[i].type != types[i]) {
276 return false;
277 }
278 }
279
280 return true;
281
282 } else {
283
284 return false;
285 }
286 }

◆ add()

JHistory & JFIT::JHistory::add ( const int type)
inline

Add event to history.

Parameters
typeapplication type
Returns
this history

Definition at line 295 of file JHistory.hh.

296 {
297 push_back(JEvent(type));
298
299 return *this;
300 }
Data structure for start_event tag.

◆ hasParentUUID()

bool JFIT::JHistory::hasParentUUID ( ) const
inline

Has parent UUID.

Definition at line 306 of file JHistory.hh.

307 {
308 return this->size() >= 2u;
309 }

◆ getUUID()

const JUUID & JFIT::JHistory::getUUID ( ) const
inline

Get UUID.

Definition at line 315 of file JHistory.hh.

316 {
317 return this->at(this->size() - 1).uuid;
318 }

◆ getParentUUID()

const JUUID & JFIT::JHistory::getParentUUID ( ) const
inline

Get parent UUID.

Definition at line 324 of file JHistory.hh.

325 {
326 return this->at(this->size() - 2).uuid;
327 }

◆ ClassDef()

JFIT::JHistory::ClassDef ( JHistory ,
2  )

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JHistory & history )
friend

Write history to output stream.

Parameters
outoutput stream
historyhistory
Returns
output stream

Definition at line 337 of file JHistory.hh.

338 {
339 using namespace std;
340
341 for (const_iterator i = history.begin(); i != history.end(); ++i) {
342 out << *i << endl;
343 }
344
345 return out;
346 }

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