Jpp 20.0.0-rc.8
the software that should make you happy
Loading...
Searching...
No Matches
JLANG::JStatus Struct Reference

Auxiliary class for handling status. More...

#include <JStatus.hh>

Inheritance diagram for JLANG::JStatus:
JLANG::JEquals< JStatus > JDETECTOR::JModule JDETECTOR::JModuleStatus_t JDETECTOR::JPMT JDETECTOR::JPMTStatus_t JCALIBRATE::JModel JMONITOR::JClusterBuilder

Public Types

typedef int status_type
 

Public Member Functions

 JStatus ()
 Default constructor.
 
 JStatus (const status_type status)
 Constructor.
 
status_type getStatus (const JType< status_type > &type) const
 Get status.
 
JStatus getStatus (const JType< JStatus > &type) const
 Get status.
 
template<class T >
const T getStatus () const
 Get status.
 
const JStatusgetStatus () const
 Get status.
 
status_typegetStatus (const JType< status_type > &type)
 Get status.
 
JStatusgetStatus (const JType< JStatus > &type)
 Get status.
 
template<class T >
T & getStatus ()
 Get status.
 
JStatusgetStatus ()
 Get status.
 
void setStatus (const JStatus &status)
 Set status.
 
bool equals (const JStatus &status) const
 Equal method.
 
JStatus getAND (const JStatus &status) const
 Get combined status.
 
JStatus getOR (const JStatus &status) const
 Get combined status.
 
bool has (const int bit) const
 Test PMT status.
 
void set (const int bit)
 Set PMT status.
 
void reset (const int bit)
 Reset PMT status.
 

Static Public Attributes

static const int NUMBER_OF_STATUS_BITS = sizeof(status_type) * 8
 number of status bits
 

Protected Attributes

status_type status
 

Friends

std::istream & operator>> (std::istream &in, JStatus &status)
 Read status from input.
 
std::ostream & operator<< (std::ostream &out, const JStatus &status)
 Write status to output.
 

Detailed Description

Auxiliary class for handling status.

The various status are controlled using a bitwise data field.
The corresponding bits can externally be defined (e.g. via an enumeration).

Definition at line 29 of file JStatus.hh.

Member Typedef Documentation

◆ status_type

Definition at line 32 of file JStatus.hh.

Constructor & Destructor Documentation

◆ JStatus() [1/2]

JLANG::JStatus::JStatus ( )
inline

Default constructor.

Definition at line 40 of file JStatus.hh.

40 :
41 status(0)
42 {}
status_type status
Definition JStatus.hh:252

◆ JStatus() [2/2]

JLANG::JStatus::JStatus ( const status_type status)
inline

Constructor.

Parameters
statusstatus

Definition at line 50 of file JStatus.hh.

50 :
52 {}

Member Function Documentation

◆ getStatus() [1/8]

status_type JLANG::JStatus::getStatus ( const JType< status_type > & type) const
inline

Get status.

Returns
status

Definition at line 60 of file JStatus.hh.

61 {
62 return this->status;
63 }

◆ getStatus() [2/8]

JStatus JLANG::JStatus::getStatus ( const JType< JStatus > & type) const
inline

Get status.

Returns
status

Definition at line 71 of file JStatus.hh.

72 {
73 return *this;
74 }

◆ getStatus() [3/8]

template<class T >
const T JLANG::JStatus::getStatus ( ) const
inline

Get status.

Returns
status

Definition at line 83 of file JStatus.hh.

84 {
85 return getStatus(JType<T>());
86 }
const T getStatus() const
Get status.
Definition JStatus.hh:83

◆ getStatus() [4/8]

const JStatus & JLANG::JStatus::getStatus ( ) const
inline

Get status.

Returns
status

Definition at line 94 of file JStatus.hh.

95 {
96 return static_cast<const JStatus&>(*this);
97 }
JStatus()
Default constructor.
Definition JStatus.hh:40

◆ getStatus() [5/8]

status_type & JLANG::JStatus::getStatus ( const JType< status_type > & type)
inline

Get status.

Returns
status

Definition at line 105 of file JStatus.hh.

106 {
107 return this->status;
108 }

◆ getStatus() [6/8]

JStatus & JLANG::JStatus::getStatus ( const JType< JStatus > & type)
inline

Get status.

Returns
status

Definition at line 116 of file JStatus.hh.

117 {
118 return *this;
119 }

◆ getStatus() [7/8]

template<class T >
T & JLANG::JStatus::getStatus ( )
inline

Get status.

Returns
status

Definition at line 128 of file JStatus.hh.

129 {
130 return getStatus(JType<T>());
131 }

◆ getStatus() [8/8]

JStatus & JLANG::JStatus::getStatus ( )
inline

Get status.

Returns
status

Definition at line 139 of file JStatus.hh.

140 {
141 return static_cast<JStatus&>(*this);
142 }

◆ setStatus()

void JLANG::JStatus::setStatus ( const JStatus & status)
inline

Set status.

Parameters
statusstatus

Definition at line 150 of file JStatus.hh.

151 {
152 this->status = status.status;
153 }

◆ equals()

bool JLANG::JStatus::equals ( const JStatus & status) const
inline

Equal method.

Parameters
statusstatus
Returns
true if this status equal to given status; else false

Definition at line 162 of file JStatus.hh.

163 {
164 return this->status == status.status;
165 }

◆ getAND()

JStatus JLANG::JStatus::getAND ( const JStatus & status) const
inline

Get combined status.

Parameters
statusstatus
Returns
status

Definition at line 174 of file JStatus.hh.

175 {
176 return JStatus(this->status & status.status);
177 }

◆ getOR()

JStatus JLANG::JStatus::getOR ( const JStatus & status) const
inline

Get combined status.

Parameters
statusstatus
Returns
status

Definition at line 186 of file JStatus.hh.

187 {
188 return JStatus(this->status | status.status);
189 }

◆ has()

bool JLANG::JStatus::has ( const int bit) const
inline

Test PMT status.

Parameters
bitbit
Returns
true if bit is set; else false

Definition at line 198 of file JStatus.hh.

199 {
200 return (this->status & (1<<bit)) != 0;
201 }

◆ set()

void JLANG::JStatus::set ( const int bit)
inline

Set PMT status.

Parameters
bitbit

Definition at line 209 of file JStatus.hh.

210 {
211 this->status |= (1<<bit);
212 }

◆ reset()

void JLANG::JStatus::reset ( const int bit)
inline

Reset PMT status.

Parameters
bitbit

Definition at line 220 of file JStatus.hh.

221 {
222 this->status &= ~(1<<bit);
223 }

Friends And Related Symbol Documentation

◆ operator>>

std::istream & operator>> ( std::istream & in,
JStatus & status )
friend

Read status from input.

Parameters
ininput stream
statusstatus
Returns
input stream

Definition at line 233 of file JStatus.hh.

234 {
235 return in >> status.status;
236 }

◆ operator<<

std::ostream & operator<< ( std::ostream & out,
const JStatus & status )
friend

Write status to output.

Parameters
outoutput stream
statusstatus
Returns
output stream

Definition at line 246 of file JStatus.hh.

247 {
248 return out << status.status;
249 }

Member Data Documentation

◆ NUMBER_OF_STATUS_BITS

const int JLANG::JStatus::NUMBER_OF_STATUS_BITS = sizeof(status_type) * 8
static

number of status bits

Definition at line 34 of file JStatus.hh.

◆ status

status_type JLANG::JStatus::status
protected

Definition at line 252 of file JStatus.hh.


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