HepMC3 event record library
Feature< Feature_type, typename std::enable_if< std::is_integral< Feature_type >::value, void >::type > Class Template Reference

Detailed Description

template<typename Feature_type>
class HepMC3::Feature< Feature_type, typename std::enable_if< std::is_integral< Feature_type >::value, void >::type >

Specialisation of Feature for integral types.

It is a valid operator to compare an int to a float, but the generic version of these operators in the base class will first cast input float to an int, then compare that. In some cases the comparison will be incorrect because of rounding the float. e.g. int x=5; float y=5.5; bool result = x<y; would be wrong because y first gets converted to int 5.

To solve this, we provide specialised comparison operators for integral type and double. Note that the opposite specialisation in which the Feature_type is floating_point is not necessary

Definition at line 213 of file Feature.h.

#include <Feature.h>

+ Inheritance diagram for Feature< Feature_type, typename std::enable_if< std::is_integral< Feature_type >::value, void >::type >:
+ Collaboration diagram for Feature< Feature_type, typename std::enable_if< std::is_integral< Feature_type >::value, void >::type >:

Public Types

using Evaluator_type
 evaluator type
 
using EvaluatorPtr
 shared pointer for evaluator type
 

Public Member Functions

 Feature (Evaluator_type functor)
 Feature.
 
 Feature (const Feature &copy)
 Feature.
 
Feature< Feature_type > abs () const
 abs function
 
Filter operator> (double value) const
 greater operator
 
Filter operator< (double value) const
 less operator
 
Filter operator== (double value) const
 equal operator
 
Filter operator>= (double value) const
 greater or equal operator
 
Filter operator<= (double value) const
 less or equal operator
 
Filter operator!= (double value) const
 not equal operator
 
 Feature (Evaluator_type functor)
 Feature.
 
 Feature (const Feature &copy)
 Copy.
 
Feature< Feature_type > abs () const
 Abs function.
 
Feature_type operator() (ConstGenParticlePtr input) const
 access the underlying feature value
 
Filter operator> (Feature_type value) const
 greater than operator
 
Filter operator< (Feature_type value) const
 less than operator
 
Filter operator>= (Feature_type value) const
 greater than or equals operator
 
Filter operator<= (Feature_type value) const
 less than or equals operator
 
virtual Filter operator== (Feature_type value) const
 equality operator
 
virtual Filter operator!= (Feature_type value) const
 inequality operator
 

Protected Attributes

EvaluatorPtr m_internal
 internal copy of func for evaluation on the heap so will persist in resulting Filters even if parent Feature object was destroyed
 

Member Typedef Documentation

◆ Evaluator_type

evaluator type

Definition at line 62 of file Feature.h.

◆ EvaluatorPtr

using EvaluatorPtr

shared pointer for evaluator type

Definition at line 64 of file Feature.h.

Constructor & Destructor Documentation

◆ Feature() [1/4]

template<typename Feature_type>
Feature ( Evaluator_type functor)
inline

Feature.

Definition at line 229 of file Feature.h.

References GenericFeature< Feature_type >::GenericFeature().

◆ Feature() [2/4]

template<typename Feature_type>
Feature ( const Feature< Feature_type, typename std::enable_if< std::is_integral< Feature_type >::value, void >::type > & copy)
inline

Feature.

Definition at line 231 of file Feature.h.

References Feature(), and GenericFeature< Feature_type >::GenericFeature().

◆ Feature() [3/4]

Feature ( Evaluator_type functor)
inline

Feature.

Definition at line 185 of file Feature.h.

◆ Feature() [4/4]

Feature ( const Feature< Feature_type, typename std::enable_if< std::is_integral< Feature_type >::value, void >::type > & copy)
inline

Copy.

Definition at line 187 of file Feature.h.

Member Function Documentation

◆ abs() [1/2]

Feature< Feature_type > abs ( ) const
inline

Abs function.

Definition at line 190 of file Feature.h.

◆ abs() [2/2]

template<typename Feature_type>
Feature< Feature_type > abs ( ) const
inline

abs function

Definition at line 234 of file Feature.h.

References Feature< Feature_type, Dummy >::Feature(), Feature(), and m_internal.

◆ operator!=() [1/2]

template<typename Feature_type>
Filter operator!= ( double value) const
inline

not equal operator

Definition at line 268 of file Feature.h.

◆ operator!=() [2/2]

virtual Filter operator!= ( Feature_type value) const
inlinevirtual

inequality operator

Returns
Filter function

Definition at line 107 of file Feature.h.

◆ operator()()

Feature_type operator() ( ConstGenParticlePtr input) const
inline

access the underlying feature value

Definition at line 67 of file Feature.h.

◆ operator<() [1/2]

template<typename Feature_type>
Filter operator< ( double value) const
inline

less operator

Definition at line 247 of file Feature.h.

References m_internal.

◆ operator<() [2/2]

Filter operator< ( Feature_type value) const
inline

less than operator

Returns
Filter function

Definition at line 79 of file Feature.h.

◆ operator<=() [1/2]

template<typename Feature_type>
Filter operator<= ( double value) const
inline

less or equal operator

Definition at line 265 of file Feature.h.

◆ operator<=() [2/2]

Filter operator<= ( Feature_type value) const
inline

less than or equals operator

Returns
Filter function

Definition at line 93 of file Feature.h.

◆ operator==() [1/2]

template<typename Feature_type>
Filter operator== ( double value) const
inline

equal operator

Definition at line 253 of file Feature.h.

References m_internal.

◆ operator==() [2/2]

virtual Filter operator== ( Feature_type value) const
inlinevirtual

equality operator

Returns
Filter function

Definition at line 100 of file Feature.h.

◆ operator>() [1/2]

template<typename Feature_type>
Filter operator> ( double value) const
inline

greater operator

Definition at line 241 of file Feature.h.

References m_internal.

◆ operator>() [2/2]

Filter operator> ( Feature_type value) const
inline

greater than operator

Returns
Filter function

Definition at line 73 of file Feature.h.

◆ operator>=() [1/2]

template<typename Feature_type>
Filter operator>= ( double value) const
inline

greater or equal operator

Definition at line 262 of file Feature.h.

◆ operator>=() [2/2]

Filter operator>= ( Feature_type value) const
inline

greater than or equals operator

Returns
Filter function

Definition at line 86 of file Feature.h.

Field Documentation

◆ m_internal

EvaluatorPtr m_internal
protected

internal copy of func for evaluation on the heap so will persist in resulting Filters even if parent Feature object was destroyed

Definition at line 130 of file Feature.h.


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