|
|
|||
File indexing completed on 2026-06-02 08:51:42
0001 #ifndef CHANNEL_TYPE_H 0002 #define CHANNEL_TYPE_H 0003 0004 /** 0005 * @file ChannelType.h 0006 * @author: Bryan BERTHOU (SPhN / CEA Saclay) 0007 * @date November 26, 2014 0008 * @version 1.0 0009 */ 0010 0011 #include <string> 0012 0013 namespace PARTONS { 0014 0015 /** 0016 * @class ChannelType 0017 * 0018 * @brief Definition of enumeration values for channels. 0019 * 0020 * This class defines a set of enumeration values that are used to distinguish between channels. In addition, a declared object of this class is always associated to one channel (see ChannelType::m_type), so member functions can act on it. E.g. 0021 \code{.cpp} 0022 //this is single enum variable - nothing to play with 0023 ChannelType::Type enum_variable = ChannelType::DVCS; 0024 0025 //this is declared object 0026 ChannelType enum_object; 0027 0028 //let us assign some type (default is ChannelType::UNDEFINED) 0029 enum_object.setType(enum_variable); 0030 0031 //with objects you can use available functions, e.g. you can represent enumeration type by a corresponding string 0032 std::string enum_string_1 = enum_object.toString(); 0033 0034 //you can achieve some basic operations without the explicit declaration of objects by using the assignment constructor 0035 std::string enum_string_2 = ChannelType(ChannelType::DVMP).toString(); 0036 0037 Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Channel is: " << enum_string_1); 0038 Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "Channel is: " << enum_string_2); 0039 \endcode 0040 which gives via Logger: 0041 \code 0042 20-05-2017 12:01:45 [INFO] (example::main) Channel is: DVCS 0043 20-05-2017 12:01:45 [INFO] (example::main) Channel is: DVMP 0044 \endcode 0045 */ 0046 class ChannelType { 0047 public: 0048 0049 /** 0050 * Definition of enumerate values corresponding to channels. 0051 */ 0052 enum Type { 0053 UNDEFINED = 0, //!< Undefined type. 0054 DVCS = 1, //!< Deeply Virtual Compton Scattering 0055 DVMP = 2, //!< Deeply Virtual Meson Production 0056 TCS = 3, //!< Time-like Compton Scattering 0057 GAM2 = 4, //!< Two photons production 0058 DDVCS = 5 //!< Double Deeply Virtual Compton Scattering 0059 }; 0060 0061 /** 0062 * Default constructor. 0063 */ 0064 ChannelType(); 0065 0066 /** 0067 * Assignment constructor. 0068 * @param type Type to be assigned. 0069 */ 0070 ChannelType(Type type); 0071 0072 /** 0073 * Destructor. 0074 */ 0075 virtual ~ChannelType(); 0076 0077 /** 0078 * Automatic cast to enum. 0079 */ 0080 operator Type() const; 0081 0082 /** 0083 * Get string representation of type being assigned to a declared object of this class. 0084 * @return String representation of assigned type, like "DVCS" for ChannelType::DVCS. 0085 */ 0086 std::string toString() const; 0087 0088 /** 0089 * Get short name representation of type being assigned to a declared object of this class. 0090 * @return Short string representation of assigned type, like "DVCS" for ChannelType:DVCS. 0091 */ 0092 std::string getShortName(); 0093 0094 //******************************************************** 0095 //*** SETTERS AND GETTERS ******************************** 0096 //******************************************************** 0097 0098 /** 0099 * Get type being assigned to a declared object of this class. 0100 */ 0101 ChannelType::Type getType() const; 0102 0103 /** 0104 * Assign type to a declared object of this class. 0105 */ 0106 void setType(Type type); 0107 0108 private: 0109 0110 /** 0111 * Type associated to a declared object of this class. 0112 */ 0113 ChannelType::Type m_type; 0114 }; 0115 0116 } /* namespace PARTONS */ 0117 0118 #endif /* CHANNEL_TYPE_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|