HepMC3 event record library
|
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
#include <Feature.h>
Public Types | |
using | Evaluator_type = std::function< Feature_type(ConstGenParticlePtr)> |
evaluator type More... | |
using | EvaluatorPtr = std::shared_ptr< Evaluator_type > |
shared pointer for evaluator type More... | |
Public Member Functions | |
Feature (Evaluator_type functor) | |
Feature. More... | |
Feature (const Feature ©) | |
Feature. More... | |
Feature< Feature_type > | abs () const |
abs function More... | |
Filter | operator> (double value) const |
greater operator More... | |
Filter | operator< (double value) const |
less operator More... | |
Filter | operator== (double value) const |
equal operator More... | |
Filter | operator>= (double value) const |
greater or equal operator More... | |
Filter | operator<= (double value) const |
less or equal operator More... | |
Filter | operator!= (double value) const |
not equal operator More... | |
Feature_type | operator() (ConstGenParticlePtr input) const |
access the underlying feature value More... | |
Filter | operator> (Feature_type value) const |
greater than operator More... | |
Filter | operator< (Feature_type value) const |
less than operator More... | |
Filter | operator>= (Feature_type value) const |
greater than or equals operator More... | |
Filter | operator<= (Feature_type value) const |
less than or equals operator More... | |
virtual Filter | operator== (Feature_type value) const |
equality operator More... | |
virtual Filter | operator!= (Feature_type value) const |
inequality operator More... | |
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 More... | |
|
inherited |
|
inherited |
|
inline |
|
inline |
abs function
Definition at line 226 of file Feature.h.
References HepMC3::abs(), and GenericFeature< Feature_type >::m_internal.
inequality operator
Reimplemented in Feature< Feature_type, typename std::enable_if< std::is_floating_point< Feature_type >::value, void >::type >.
Definition at line 107 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
access the underlying feature value
Definition at line 67 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
less than operator
Definition at line 79 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inline |
less operator
Definition at line 239 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
less than or equals operator
Definition at line 93 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inline |
|
inlinevirtualinherited |
equality operator
Reimplemented in Feature< Feature_type, typename std::enable_if< std::is_floating_point< Feature_type >::value, void >::type >.
Definition at line 100 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inline |
equal operator
Definition at line 245 of file Feature.h.
References HepMC3::abs(), and GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
greater than operator
Definition at line 73 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inline |
greater operator
Definition at line 233 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inlineinherited |
greater than or equals operator
Definition at line 86 of file Feature.h.
References GenericFeature< Feature_type >::m_internal.
|
inline |
|
protectedinherited |