MARLEY (Model of Argon Reaction Low Energy Yields)
v1.2.0
A Monte Carlo event generator for tens-of-MeV neutrino interactions
|
Type-safe representation of a parity value (either +1 or -1) More...
#include <Parity.hh>
Public Member Functions | |
constexpr | Parity () |
Default constructor chooses positive parity. | |
constexpr | Parity (bool is_positive) |
Create a Parity object from a boolean value. More... | |
Parity (int i) | |
Create a Parity object from an integer. More... | |
void | from_char (const char c) |
Assign a value to this Parity object from a char. | |
constexpr | operator bool () const |
Convert the Parity object to a bool (true for +1, false for -1) | |
operator int () const | |
Parity & | operator! () |
Unary operator that flips a Parity value in place. | |
bool | operator!= (const marley::Parity &p) const |
int | operator* (const int &i) const |
marley::Parity | operator* (const marley::Parity &p) const |
constexpr marley::Parity | operator- () const |
Creates a copy of the Parity object with a flipped value. | |
marley::Parity & | operator= (const int &i) |
Assigns a parity value using an integer. More... | |
bool | operator== (const marley::Parity &p) const |
char | to_char () const |
Convert the Parity object to a char. | |
Protected Attributes | |
bool | is_positive_ |
Boolean representation of the parity value that is true when the parity is +1 and false when it is -1. | |
Type-safe representation of a parity value (either +1 or -1)
|
inlineexplicitconstexpr |
Create a Parity object from a boolean value.
is_positive | Boolean parameter that is true for +1, or false for -1. |
|
explicit |
Create a Parity object from an integer.
If an int value other than +1 or -1 is passed to this constructor, a marley::Error will be thrown.
|
inlineexplicit |
marley::Parity & marley::Parity::operator= | ( | const int & | i | ) |
Assigns a parity value using an integer.
If an int value other than +1 or -1 is used, a marley::Error will be thrown.