Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Member Functions | Static Public Attributes | Friends | List of all members
datatools::event_id Class Reference

A simple event identifier based on a run number and an event number Run and event numbers are represented by 32 bits signed integrals. The event_id class is serializable through the Boost.Serialization library. Utilities for standard I/O streams is also provided. More...

#include <bayeux/datatools/event_id.h>

Inheritance diagram for datatools::event_id:
datatools::i_serializable datatools::i_tree_dumpable datatools::i_clear

Public Member Functions

 event_id ()
 The default constructor. More...
 
 event_id (int e_)
 A constructor that sets only the event number. More...
 
 event_id (int r_, int e_)
 A constructor to fully set the event_id object. More...
 
virtual ~event_id ()
 The destructor. More...
 
virtual void clear ()
 Invalidate the id. More...
 
void reset ()
 Invalidate the id. More...
 
int get_run_number () const
 Returns the run number. More...
 
int get_event_number () const
 Returns the event number. More...
 
void set_run_number (int r_)
 Set the run number. More...
 
void set_event_number (int e_)
 Set the event number. More...
 
void set (int r_, int e_)
 Set the run and event numbers. More...
 
bool is_valid () const
 Check whether the ID is valid. More...
 
bool is_complete () const
 Check whether the ID is complete (run number and event number are set). More...
 
bool has (int r_, int e_) const
 Check if the instance has specific run and event numbers. More...
 
bool match (int r_, int e_) const
 Check if the instance match specific run and event numbers. More...
 
bool operator== (const event_id &id_) const
 Comparison operator. More...
 
bool operator< (const event_id &id_) const
 Comparison operator. More...
 
bool operator> (const event_id &id_) const
 Comparison operator. More...
 
std::string to_string () const
 Output convertor. More...
 
void from_string (const std::string &s_)
 Input convertor. More...
 
virtual void tree_dump (std::ostream &out_=std::cerr, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
 Method for smart printing (from the datatools::i_tree_dump interface). More...
 
void smart_print (std::ostream &out_, const std::string &title_, const std::string &indent_) const
 
std::string to_smart_string (const std::string &title_, const std::string &indent_) const
 
void dump () const
 Shortcut to the tree_dump method with default arguments. More...
 
- Public Member Functions inherited from datatools::i_serializable
 i_serializable ()
 Default constructor. More...
 
virtual ~i_serializable ()
 Destructor. More...
 
virtual const std::string & get_serial_tag () const =0
 Return the serialization string identifier of the class. More...
 
- Public Member Functions inherited from datatools::i_tree_dumpable
 i_tree_dumpable ()
 Constructor. More...
 
virtual ~i_tree_dumpable ()
 Destructor. More...
 
virtual void print_tree (std::ostream &out_=std::clog, const boost::property_tree::ptree &options_=empty_options()) const
 Main new interface method for printing. More...
 
void print_tree_json (std::ostream &out_=std::clog, const std::string &json_options_="") const
 Printing with jsonized options. More...
 
void print_tree_json (std::ostream &out_=std::clog, const char *json_options_=nullptr) const
 Printing with jsonized options. More...
 
void tree_dump_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="", const bool inherit_=false) const
 
void tree_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="") const
 
void smart_print_id (const int out_type_=OSTREAM_CLOG, const std::string &title_="", const std::string &indent_="") const
 
- Public Member Functions inherited from datatools::i_clear
virtual ~i_clear ()
 Destructor. More...
 

Static Public Attributes

static const int INVALID_RUN_NUMBER = -1
 Constant value for an invalid run number. More...
 
static const int ANY_RUN_NUMBER = -2
 Constant value for any run number. More...
 
static const int INVALID_EVENT_NUMBER = -1
 Constant value for an invalid event number. More...
 
static const int ANY_EVENT_NUMBER = -2
 Constant value for any event number. More...
 
static const char IO_FORMAT_SEP = '_'
 Separator character used in to_string and from_string methods. More...
 
static const char IO_FORMAT_ANY = '*'
 
static const char IO_FORMAT_INVALID = '!'
 

Friends

std::ostream & operator<< (std::ostream &s_, const event_id &id_)
 Output operator. More...
 
std::istream & operator>> (std::istream &s_, event_id &id_)
 Input operator. More...
 

Additional Inherited Members

- Public Types inherited from datatools::i_tree_dumpable
enum  ostream_type { OSTREAM_COUT = 1, OSTREAM_CERR = 2, OSTREAM_CLOG = 3 }
 Enumeration for standard output streams. More...
 
- Static Public Member Functions inherited from datatools::i_tree_dumpable
static const boost::property_tree::ptree & empty_options ()
 
static boost::property_tree::ptree make_base_print_options (const std::string &title_, const std::string &indent_="", const bool inherit_=false)
 
static std::ostream & last_skip_tag (std::ostream &out_)
 
static std::ostream & skip_tag (std::ostream &out_)
 
static std::ostream & last_tag (std::ostream &out_)
 
static std::ostream & tag (std::ostream &out_)
 

Detailed Description

A simple event identifier based on a run number and an event number Run and event numbers are represented by 32 bits signed integrals. The event_id class is serializable through the Boost.Serialization library. Utilities for standard I/O streams is also provided.

Example :

#include <iostream>
int main() {
std::cout << "The event ID : " << evId << '\n';
evId.set(45, 37);
evId.tree_dump(std:cout, "The event ID :");
return 0;
}

Constructor & Destructor Documentation

◆ event_id() [1/3]

datatools::event_id::event_id ( )

The default constructor.

Initialized to an invalid id.

◆ event_id() [2/3]

datatools::event_id::event_id ( int  e_)
explicit

A constructor that sets only the event number.

◆ event_id() [3/3]

datatools::event_id::event_id ( int  r_,
int  e_ 
)

A constructor to fully set the event_id object.

Parameters
r_the run number.
e_the event number.

◆ ~event_id()

virtual datatools::event_id::~event_id ( )
virtual

The destructor.

Member Function Documentation

◆ clear()

virtual void datatools::event_id::clear ( )
virtual

Invalidate the id.

Implements datatools::i_clear.

◆ dump()

void datatools::event_id::dump ( ) const

Shortcut to the tree_dump method with default arguments.

◆ from_string()

void datatools::event_id::from_string ( const std::string &  s_)

Input convertor.

◆ get_event_number()

int datatools::event_id::get_event_number ( ) const

Returns the event number.

Returns
the event number.

◆ get_run_number()

int datatools::event_id::get_run_number ( ) const

Returns the run number.

Returns
the run number.

◆ has()

bool datatools::event_id::has ( int  r_,
int  e_ 
) const

Check if the instance has specific run and event numbers.

Parameters
r_the run number.
e_the event number.
Returns
true or false

◆ is_complete()

bool datatools::event_id::is_complete ( ) const

Check whether the ID is complete (run number and event number are set).

◆ is_valid()

bool datatools::event_id::is_valid ( ) const

Check whether the ID is valid.

◆ match()

bool datatools::event_id::match ( int  r_,
int  e_ 
) const

Check if the instance match specific run and event numbers.

Parameters
r_the run number.
e_the event number.
Returns
true or false

◆ operator<()

bool datatools::event_id::operator< ( const event_id id_) const

Comparison operator.

◆ operator==()

bool datatools::event_id::operator== ( const event_id id_) const

Comparison operator.

◆ operator>()

bool datatools::event_id::operator> ( const event_id id_) const

Comparison operator.

◆ reset()

void datatools::event_id::reset ( )

Invalidate the id.

◆ set()

void datatools::event_id::set ( int  r_,
int  e_ 
)

Set the run and event numbers.

Parameters
r_the run number.
e_the event number.

◆ set_event_number()

void datatools::event_id::set_event_number ( int  e_)

Set the event number.

Parameters
e_the event number.

◆ set_run_number()

void datatools::event_id::set_run_number ( int  r_)

Set the run number.

Parameters
r_the run number.

◆ smart_print()

void datatools::event_id::smart_print ( std::ostream &  out_,
const std::string &  title_,
const std::string &  indent_ 
) const

◆ to_smart_string()

std::string datatools::event_id::to_smart_string ( const std::string &  title_,
const std::string &  indent_ 
) const

◆ to_string()

std::string datatools::event_id::to_string ( ) const

Output convertor.

◆ tree_dump()

virtual void datatools::event_id::tree_dump ( std::ostream &  out_ = std::cerr,
const std::string &  title_ = "",
const std::string &  indent_ = "",
bool  inherit_ = false 
) const
virtual

Method for smart printing (from the datatools::i_tree_dump interface).

Parameters
out_the output stream
title_the title to be displayed
indent_the indentation string
inherit_the inheritance flag.

Reimplemented from datatools::i_tree_dumpable.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s_,
const event_id id_ 
)
friend

Output operator.

◆ operator>>

std::istream& operator>> ( std::istream &  s_,
event_id id_ 
)
friend

Input operator.

Member Data Documentation

◆ ANY_EVENT_NUMBER

const int datatools::event_id::ANY_EVENT_NUMBER = -2
static

Constant value for any event number.

◆ ANY_RUN_NUMBER

const int datatools::event_id::ANY_RUN_NUMBER = -2
static

Constant value for any run number.

◆ INVALID_EVENT_NUMBER

const int datatools::event_id::INVALID_EVENT_NUMBER = -1
static

Constant value for an invalid event number.

◆ INVALID_RUN_NUMBER

const int datatools::event_id::INVALID_RUN_NUMBER = -1
static

Constant value for an invalid run number.

◆ IO_FORMAT_ANY

const char datatools::event_id::IO_FORMAT_ANY = '*'
static

◆ IO_FORMAT_INVALID

const char datatools::event_id::IO_FORMAT_INVALID = '!'
static

◆ IO_FORMAT_SEP

const char datatools::event_id::IO_FORMAT_SEP = '_'
static

Separator character used in to_string and from_string methods.


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