22 #ifndef __M2ETIS_PUBSUB_FILTER__FILTEREXPRESSIONS_ATTRIBUTEFILTER_H__ 
   23 #define __M2ETIS_PUBSUB_FILTER__FILTEREXPRESSIONS_ATTRIBUTEFILTER_H__ 
   30 #include "boost/serialization/string.hpp" 
   39         template<
typename EventType, 
typename AttributeType>
 
   40         class AttributeFilter : 
public Predicate<EventType> {
 
   43                 AttributeFilter(
const AttributeName attribute_id, 
const std::vector<AttributeType> & constants): attribute_id_(attribute_id), constants_(constants) {}
 
   51                 virtual bool match(
const EventType & event)
 const override  {
 
   52                         auto attribute_value_iterator =  attributes_accessor_map.find(attribute_id_);
 
   54                         if (attribute_value_iterator == attributes_accessor_map.end()) {
 
   55                                 M2ETIS_THROW_API(
"AttributeFilter function match", 
"Attribute not found in attribute map.");
 
   61                 virtual bool matchAttribute(
const AttributeType & attribute_value) 
const = 0;
 
   67                         if (other_attribute_filter == 
nullptr) {
 
   70                         return overlaps(other_attribute_filter);
 
   75                 template<
typename OtherAttributeType>
 
   80                 const std::vector<AttributeType> 
get_constants()
 const { 
return constants_; }
 
   88                         if (other_AttributeFilter) {
 
   89                                 return (
typeid(*
this) == 
typeid(*other_AttributeFilter)  && attribute_id_ == other_AttributeFilter->attribute_id_ && constants_ == other_AttributeFilter->constants_);
 
   95                 virtual size_t doHash()
 const {
 
   97                         if (constants_.empty()) {
 
   98                                 return (std::hash<AttributeName>()(attribute_id_) ^ std::hash<std::string>()(std::string(
typeid(*this).name())));
 
  100                                 return ((std::hash<AttributeName>()(attribute_id_) ^ std::hash<AttributeType>()(*(constants_.begin()))) ^ std::hash<std::string>()(std::string(
typeid(*this).name())));
 
  105                 std::vector<AttributeType> constants_;
 
  108                 template<
typename Archive>
 
  109                 void serialize(Archive & ar, 
const unsigned int) {
 
  110                         ar & boost::serialization::base_object<Predicate<EventType>>(*this);
 
virtual ~AttributeFilter()
 
bool overlaps(const AttributeFilter< EventType, OtherAttributeType > *) const 
 
virtual bool matchAttribute(const AttributeType &attribute_value) const =0
 
virtual bool overlaps(const Predicate< EventType > *other_predicate) const override
 
virtual void getAttributeType(const GreaterThanAttributeFilter< EventType, std::string > *)
 
const std::vector< AttributeType > get_constants() const 
 
AttributeFilter(const AttributeName attribute_id, const std::vector< AttributeType > &constants)
 
M2ETIS_API std::map< filter::AttributeName, std::shared_ptr< filter::AttributeAccessor_Basic > > attributes_accessor_map
 
AttributeName get_attribute_id() const 
 
friend class boost::serialization::access
 
virtual void getAttributeType(FilterVisitor< EventType > &visitor) const override
 
virtual bool match(const EventType &event) const override
 
#define M2ETIS_THROW_API(module, message)
throws on wrong API usage