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

Definition of sorting modes. More...

Public Types

enum  Type { UNDEFINED = 0 , ASCENDING = 1 , DESCENDING = 2 }
 

Public Member Functions

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

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

Detailed Description

Definition of sorting modes.

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

//this is single enum variable - nothing to play with
//this is declared object
SortingMode enum_object;
//let us assign some type (default is SortingMode::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 = SortingMode(SortingMode::DESCENDING).toString();
Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Sorting mode is: " << enum_string_1);
Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Sorting mode 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
SortingMode()
Default constructor.
Definition: SortingMode.cpp:6
Type
Definition: SortingMode.h:50
@ ASCENDING
Ascending sorting.
Definition: SortingMode.h:52
@ DESCENDING
Descending sorting.
Definition: SortingMode.h:53

which gives via Logger:

20-05-2017 12:13:02 [INFO] (example::main) Sorting mode is: ASCENDING
20-05-2017 12:13:02 [INFO] (example::main) Sorting mode is: DESCENDING

Member Enumeration Documentation

◆ Type

Enumerator
UNDEFINED 

Undefined type.

ASCENDING 

Ascending sorting.

DESCENDING 

Descending sorting.

Constructor & Destructor Documentation

◆ SortingMode() [1/2]

PARTONS::SortingMode::SortingMode ( )

Default constructor.

◆ SortingMode() [2/2]

PARTONS::SortingMode::SortingMode ( Type  type)

Assignment constructor.

Parameters
typeType to be assigned.

Member Function Documentation

◆ getShortName()

std::string PARTONS::SortingMode::getShortName ( )

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 SortingMode::ASCENDING.

◆ getType()

SortingMode::Type PARTONS::SortingMode::getType ( ) const

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

◆ operator Type()

PARTONS::SortingMode::operator SortingMode::Type ( ) const

Automatic cast to enum.

◆ setType()

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

Assign type to a declared object of this class.

◆ toString()

std::string PARTONS::SortingMode::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 SortingMode::ASCENDING.

Member Data Documentation

◆ m_type

SortingMode::Type PARTONS::SortingMode::m_type
private

Type associated to a declared object of this class.


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