Jpp test-rotations-old
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_application
 Auxiliary class to test history. More...
 
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 JEvent &event)
 Constructor.
 
 JHistory (const int type)
 Constructor.
 
 JHistory (const JHistory &history, const JEvent &event)
 Constructor.
 
virtual ~JHistory ()
 Virtual destructor.
 
const JHistory & getHistory () const
 Get history.
 
JHistory & getHistory ()
 Get history.
 
bool has (const int type) const
 Has event in history.
 
bool getStatus (const std::vector< int > &types) const
 Get status.
 
JHistory & add (const int type)
 Add event to history.
 
bool hasParentUUID () const
 Has parent UUID.
 
const JUUID & getUUID () const
 Get UUID.
 
const JUUID & getParentUUID () 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 128 of file JHistory.hh.

Constructor & Destructor Documentation

◆ JHistory() [1/4]

JFIT::JHistory::JHistory ( )
inline

Default constructor.

Definition at line 229 of file JHistory.hh.

229 :
231 {}

◆ JHistory() [2/4]

JFIT::JHistory::JHistory ( const JEvent & event)
inline

Constructor.

Parameters
eventevent

Definition at line 239 of file JHistory.hh.

239 :
240 std::vector<JEvent>(1, event)
241 {}

◆ JHistory() [3/4]

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

Constructor.

Parameters
typeapplication type

Definition at line 249 of file JHistory.hh.

249 :
251 {}
Data structure for start_event tag.

◆ JHistory() [4/4]

JFIT::JHistory::JHistory ( const JHistory & history,
const JEvent & event )
inline

Constructor.

Parameters
historyhistory
eventevent

Definition at line 260 of file JHistory.hh.

261 :
262 std::vector<JEvent>(history)
263 {
264 push_back(event);
265 }

◆ ~JHistory()

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

Virtual destructor.

Definition at line 271 of file JHistory.hh.

272 {}

Member Function Documentation

◆ getHistory() [1/2]

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

Get history.

Returns
histtory

Definition at line 280 of file JHistory.hh.

281 {
282 return static_cast<const JHistory&>(*this);
283 }
JHistory()
Default constructor.
Definition JHistory.hh:229

◆ getHistory() [2/2]

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

Get history.

Returns
histtory

Definition at line 291 of file JHistory.hh.

292 {
293 return static_cast<JHistory&>(*this);
294 }

◆ 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 303 of file JHistory.hh.

304 {
305 for (const_iterator i = this->begin(); i != this->end(); ++i) {
306 if (i->type == type) {
307 return true;
308 }
309 }
310
311 return false;
312 }

◆ 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 321 of file JHistory.hh.

322 {
323 if (this->size() == types.size()) {
324
325 for (size_t i = 0; i != this->size(); ++i) {
326 if ((*this)[i].type != types[i]) {
327 return false;
328 }
329 }
330
331 return true;
332
333 } else {
334
335 return false;
336 }
337 }

◆ add()

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

Add event to history.

Parameters
typeapplication type
Returns
this history

Definition at line 346 of file JHistory.hh.

347 {
348 push_back(JEvent(type));
349
350 return *this;
351 }

◆ hasParentUUID()

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

Has parent UUID.

Definition at line 357 of file JHistory.hh.

358 {
359 return this->size() >= 2u;
360 }

◆ getUUID()

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

Get UUID.

Definition at line 366 of file JHistory.hh.

367 {
368 return this->at(this->size() - 1).uuid;
369 }

◆ getParentUUID()

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

Get parent UUID.

Definition at line 375 of file JHistory.hh.

376 {
377 return this->at(this->size() - 2).uuid;
378 }

◆ 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 388 of file JHistory.hh.

389 {
390 using namespace std;
391
392 for (const_iterator i = history.begin(); i != history.end(); ++i) {
393 out << *i << endl;
394 }
395
396 return out;
397 }

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