PARTONS  
PARtonic Tomography Of Nucleon Software
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
PARTONS::QuarkFlavor Class Reference

Definition of enumeration values for quark flavors. More...

Public Types

enum  Type {
  UNDEFINED = 0 , UP = 1 , DOWN = 2 , STRANGE = 3 ,
  CHARM = 4 , BOTTOM = 5 , TOP = 6
}
 Definition of enumerate values corresponding to quark flavors. More...
 

Public Member Functions

 QuarkFlavor ()
 Default constructor. More...
 
 QuarkFlavor (const QuarkFlavor &other)
 Copy constructor. More...
 
 QuarkFlavor (Type type)
 Assignment constructor. More...
 
virtual ~QuarkFlavor ()
 Destructor. More...
 
 operator Type () const
 Automatic cast to enum. More...
 
std::string toString () const
 Get string representation of type being assigned to a declared object of this class. More...
 
std::string getShortName ()
 Get short name representation of type being assigned to a declared object of this class. More...
 
QuarkFlavor::Type getType () const
 Get type being assigned to a declared object of this class. More...
 
void setType (Type type)
 Assign type to a declared object of this class. More...
 

Static Public Member Functions

static QuarkFlavor::Type fromString (const std::string &quarkFlavorStr)
 Try to match quark flavor from given string. More...
 

Static Public Attributes

static const std::string QUARK_FLAVOR_TYPE_DB_COLUMN_NAME
 Name of table in the database corresponding to this class. More...
 

Private Attributes

QuarkFlavor::Type m_type
 Type associated to a declared object of this class. More...
 

Detailed Description

Definition of enumeration values for quark flavors.

This class defines a set of enumeration values that are used to distinguish between quark flavors. In addition, a declared object of this class is always associated to one quark flavor type (see QuarkFlavor::m_type), so member functions can act on it. E.g.

//this is single enum variable - nothing to play with
//this is declared object
QuarkFlavor enum_object;
//let us assign some type (default is QuarkFlavor::UNDEFINED)
enum_object.setType(enum_variable);
//with objects you can use available functions, e.g. you can represent enumeration type by a corresponding string
std::string enum_string_1 = enum_object.toString();
//you can achieve some basic operations without the explicit declaration of objects by using the assignment constructor
std::string enum_string_2 = QuarkFlavor(QuarkFlavor::DOWN).toString();
Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Quark flavor is: " << enum_string_1);
Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Quark flavor is: " << enum_string_2);
ElemUtils::LoggerManager * getLoggerManager() const
Definition: Partons.cpp:191
static Partons * getInstance()
Share a unique pointer of this class.
Definition: Partons.cpp:27
QuarkFlavor()
Default constructor.
Definition: QuarkFlavor.cpp:10
Type
Definition of enumerate values corresponding to quark flavors.
Definition: QuarkFlavor.h:58
@ UP
Quark flavor up.
Definition: QuarkFlavor.h:60
@ DOWN
Quark flavor down.
Definition: QuarkFlavor.h:61

which gives via Logger:

20-05-2017 12:09:19 [INFO] (example::main) Quark flavor is: UP
20-05-2017 12:09:19 [INFO] (example::main) Quark flavor is: DOWN

Member Enumeration Documentation

◆ Type

Definition of enumerate values corresponding to quark flavors.

Enumerator
UNDEFINED 

Undefined type.

UP 

Quark flavor up.

DOWN 

Quark flavor down.

STRANGE 

Quark flavor strange.

CHARM 

Quark flavor charm.

BOTTOM 

Quark flavor bottom.

TOP 

Quark flavor top.

Constructor & Destructor Documentation

◆ QuarkFlavor() [1/3]

PARTONS::QuarkFlavor::QuarkFlavor ( )

Default constructor.

◆ QuarkFlavor() [2/3]

PARTONS::QuarkFlavor::QuarkFlavor ( const QuarkFlavor other)

Copy constructor.

Parameters
otherObject to be copied.

◆ QuarkFlavor() [3/3]

PARTONS::QuarkFlavor::QuarkFlavor ( Type  type)

Assignment constructor.

Parameters
typeType to be assigned.

◆ ~QuarkFlavor()

PARTONS::QuarkFlavor::~QuarkFlavor ( )
virtual

Destructor.

Member Function Documentation

◆ fromString()

QuarkFlavor::Type PARTONS::QuarkFlavor::fromString ( const std::string &  quarkFlavorStr)
static

Try to match quark flavor from given string.

Parameters
quarkFlavorStrString to be matched.
Returns
Matched type or QuarkFlavor::UNDEFINED if unable to match.

◆ getShortName()

std::string PARTONS::QuarkFlavor::getShortName ( )

Get short name representation of type being assigned to a declared object of this class.

Returns
Short string representation of assigned type, like "u" for QuarkFlavor::UP.

◆ getType()

QuarkFlavor::Type PARTONS::QuarkFlavor::getType ( ) const

Get type being assigned to a declared object of this class.

◆ operator Type()

PARTONS::QuarkFlavor::operator QuarkFlavor::Type ( ) const

Automatic cast to enum.

◆ setType()

void PARTONS::QuarkFlavor::setType ( Type  type)

Assign type to a declared object of this class.

◆ toString()

std::string PARTONS::QuarkFlavor::toString ( ) const

Get string representation of type being assigned to a declared object of this class.

Returns
String representation of assigned type, like "UP" for QuarkFlavor::UP.

Member Data Documentation

◆ m_type

QuarkFlavor::Type PARTONS::QuarkFlavor::m_type
private

Type associated to a declared object of this class.

◆ QUARK_FLAVOR_TYPE_DB_COLUMN_NAME

const std::string PARTONS::QuarkFlavor::QUARK_FLAVOR_TYPE_DB_COLUMN_NAME
static
Initial value:
=
"quark_flavor_type"

Name of table in the database corresponding to this class.


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