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

Definition of comparison modes. More...

Public Types

enum  Type { UNDEFINED = 0 , EQUAL = 1 , INTERSECTION = 2 }
 

Public Member Functions

 ComparisonMode ()
 Default constructor. More...
 
 ComparisonMode (Type type)
 Assignment constructor. 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 () const
 Get short name representation of type being assigned to a declared object of this class. More...
 
ComparisonMode::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...
 

Private Attributes

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

Detailed Description

Definition of comparison modes.

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

//this is single enum variable - nothing to play with
//this is declared object
ComparisonMode enum_object;
//let us assign some type (default is ComparisonMode::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 = ComparisonMode(ComparisonMode::INTERSECTION).toString();
Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Comparison mode is: " << enum_string_1);
Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Comparison mode is: " << enum_string_2);
ComparisonMode()
Default constructor.
Definition: ComparisonMode.cpp:6
Type
Definition: ComparisonMode.h:57
@ EQUAL
Equal mode of comparison.
Definition: ComparisonMode.h:59
@ INTERSECTION
Intersection mode of comparison.
Definition: ComparisonMode.h:60
ElemUtils::LoggerManager * getLoggerManager() const
Definition: Partons.cpp:191
static Partons * getInstance()
Share a unique pointer of this class.
Definition: Partons.cpp:27

which gives via Logger:

20-05-2017 12:13:02 [INFO] (example::main) Comparison mode is: EQUAL
20-05-2017 12:13:02 [INFO] (example::main) Comparison mode is: INTERSECTION

Member Enumeration Documentation

◆ Type

Enumerator
UNDEFINED 

Undefined type.

EQUAL 

Equal mode of comparison.

INTERSECTION 

Intersection mode of comparison.

Constructor & Destructor Documentation

◆ ComparisonMode() [1/2]

PARTONS::ComparisonMode::ComparisonMode ( )

Default constructor.

◆ ComparisonMode() [2/2]

PARTONS::ComparisonMode::ComparisonMode ( Type  type)

Assignment constructor.

Parameters
typeType to be assigned.

Member Function Documentation

◆ getShortName()

std::string PARTONS::ComparisonMode::getShortName ( ) const

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

Returns
Short string representation of assigned type, like "ASCENDING" for ComparisonMode::EQUAL.

◆ getType()

ComparisonMode::Type PARTONS::ComparisonMode::getType ( ) const

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

◆ operator Type()

PARTONS::ComparisonMode::operator ComparisonMode::Type ( ) const

Automatic cast to enum.

◆ setType()

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

Assign type to a declared object of this class.

◆ toString()

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

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

Returns
String representation of assigned type, like "ASCENDING" for ComparisonMode::EQUAL.

Member Data Documentation

◆ m_type

ComparisonMode::Type PARTONS::ComparisonMode::m_type
private

Type associated to a declared object of this class.


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