Jpp
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Protected Attributes | List of all members
JTRIGGER::JPreprocessor Struct Reference

Auxiliary class for specifying the way of pre-processing of hits. More...

#include <JPreprocessor.hh>

Inheritance diagram for JTRIGGER::JPreprocessor:

Public Types

enum  JOption_t { none_t = 0, join_t, filter_t }
 Preprocessing options. More...
 
typedef std::pair< JPreprocessor, JOption_tpair_type
 
typedef std::vector< pair_typemap_type
 

Public Member Functions

 JPreprocessor ()
 Default constructor. More...
 
 operator JOption_t () const
 Type conversion operator. More...
 

Static Public Member Functions

static JOption_t getOption (const JPreprocessor &option)
 Get option. More...
 
static std::vector< JPreprocessorgetOptions ()
 Get options. More...
 

Protected Member Functions

 JPreprocessor (const std::string &option)
 Constructor. More...
 

Static Protected Member Functions

static const map_typeget_options ()
 Get paired options. More...
 

Static Protected Attributes

static const char ENUM_EXTENSION = '_'
 Extension of enumeration names. More...
 

Detailed Description

Auxiliary class for specifying the way of pre-processing of hits.

Definition at line 31 of file JPreprocessor.hh.

Member Typedef Documentation

◆ pair_type

Definition at line 44 of file JPreprocessor.hh.

◆ map_type

Definition at line 45 of file JPreprocessor.hh.

Member Enumeration Documentation

◆ JOption_t

Preprocessing options.

Enumerator
none_t 

no pre-processing

join_t 

join consecutive hits according match criterion

filter_t 

filter-out consecutive hits according match criterion

Definition at line 37 of file JPreprocessor.hh.

37  {
38  none_t = 0, //!< no pre-processing
39  join_t, //!< join consecutive hits according match criterion
40  filter_t //!< filter-out consecutive hits according match criterion
41  };

Constructor & Destructor Documentation

◆ JPreprocessor() [1/2]

JTRIGGER::JPreprocessor::JPreprocessor ( )
inline

Default constructor.

Definition at line 51 of file JPreprocessor.hh.

51  :
52  std::string(get_options()[0].first)
53  {}

◆ JPreprocessor() [2/2]

JTRIGGER::JPreprocessor::JPreprocessor ( const std::string &  option)
inlineprotected

Constructor.

Parameters
optionoption

Definition at line 111 of file JPreprocessor.hh.

111  :
112  std::string(option)
113  {
114  using namespace std;
115 
116  const string::size_type pos = this->rfind(ENUM_EXTENSION);
117 
118  if (pos != string::npos) {
119  this->erase(pos);
120  }
121  }

Member Function Documentation

◆ operator JOption_t()

JTRIGGER::JPreprocessor::operator JOption_t ( ) const
inline

Type conversion operator.

Returns
option

Definition at line 61 of file JPreprocessor.hh.

62  {
63  return JPreprocessor::getOption(*this);
64  }

◆ getOption()

static JOption_t JTRIGGER::JPreprocessor::getOption ( const JPreprocessor option)
inlinestatic

Get option.

Parameters
optionoption
Returns
option

Definition at line 73 of file JPreprocessor.hh.

74  {
75  using namespace std;
76  using namespace JPP;
77 
78  map_type::const_iterator i = find_if(get_options().begin(),
79  get_options().end(),
80  make_predicate(&pair_type::first, JPreprocessor(option)));
81 
82  if (i != get_options().end()) {
83  return i->second;
84  } else {
85  THROW(JTypeInformationException, "Invalid option <" << option << ">");
86  }
87  };

◆ getOptions()

static std::vector<JPreprocessor> JTRIGGER::JPreprocessor::getOptions ( )
inlinestatic

Get options.

Returns
list of options

Definition at line 95 of file JPreprocessor.hh.

96  {
97  return JLANG::make_array(get_options().begin(),
98  get_options().end(),
99  &pair_type::first);
100  }

◆ get_options()

static const map_type& JTRIGGER::JPreprocessor::get_options ( )
inlinestaticprotected

Get paired options.

Returns
list of paired options

Definition at line 129 of file JPreprocessor.hh.

130  {
131  static map_type buffer;
132 
133  if (buffer.empty()) {
134 
135 #define MAKE_ENTRY(A) std::make_pair(JPreprocessor(#A), A)
136 
137  buffer.push_back(MAKE_ENTRY(none_t));
138  buffer.push_back(MAKE_ENTRY(join_t));
139  buffer.push_back(MAKE_ENTRY(filter_t));
140 
141 #undef MAKE_ENTRY
142  }
143 
144  return buffer;
145  }

Member Data Documentation

◆ ENUM_EXTENSION

const char JTRIGGER::JPreprocessor::ENUM_EXTENSION = '_'
staticprotected

Extension of enumeration names.

Definition at line 104 of file JPreprocessor.hh.


The documentation for this struct was generated from the following file:
JTRIGGER::JPreprocessor::map_type
std::vector< pair_type > map_type
Definition: JPreprocessor.hh:45
JTRIGGER::JPreprocessor::join_t
join consecutive hits according match criterion
Definition: JPreprocessor.hh:39
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JTRIGGER::JPreprocessor::none_t
no pre-processing
Definition: JPreprocessor.hh:38
THROW
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:669
JTRIGGER::JPreprocessor::getOption
static JOption_t getOption(const JPreprocessor &option)
Get option.
Definition: JPreprocessor.hh:73
JTRIGGER::JPreprocessor::filter_t
filter-out consecutive hits according match criterion
Definition: JPreprocessor.hh:40
JTRIGGER::JPreprocessor::ENUM_EXTENSION
static const char ENUM_EXTENSION
Extension of enumeration names.
Definition: JPreprocessor.hh:104
std
Definition: jaanetDictionary.h:36
JLANG::make_predicate
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
MAKE_ENTRY
#define MAKE_ENTRY(A)
JLANG::make_array
const std::vector< JValue_t > make_array(const JValue_t(&array)[N])
Method to create array of values.
Definition: JVectorize.hh:27
JTRIGGER::JPreprocessor::JPreprocessor
JPreprocessor()
Default constructor.
Definition: JPreprocessor.hh:51
JTRIGGER::JPreprocessor::get_options
static const map_type & get_options()
Get paired options.
Definition: JPreprocessor.hh:129