2 #ifndef _MADARA_AGGREGATE_FILTERS_H_ 3 #define _MADARA_AGGREGATE_FILTERS_H_ 7 #include "madara/MADARA_export.h" 15 #include "madara_jni.h" 18 #ifdef _MADARA_PYTHON_CALLBACKS_ 19 #include <boost/python.hpp> 58 : unnamed_filter (0), functor (0), type (UNINITIALIZED)
68 : unnamed_filter (extern_func), functor (0), type (EXTERN_UNNAMED)
76 : unnamed_filter (0), functor (filter), type (FUNCTOR)
87 : type (JAVA_CALLABLE)
90 JNIEnv* env = madara_jni_get_env();
91 java_object = (jobject) env->NewGlobalRef(
object);
94 bool is_java_callable (
void)
const 96 return type == JAVA_CALLABLE;
105 #ifdef _MADARA_PYTHON_CALLBACKS_ 110 : python_function (func), type (PYTHON_CALLABLE)
112 bool invalid_callable =
false;
115 if (0 == PyObject_HasAttrString (func.ptr (),
"__call__"))
120 "Handler must be a callable object");
122 boost::python::throw_error_already_set();
126 bool is_python_callable (
void)
const 128 return type == PYTHON_CALLABLE && !python_function.is_none ();
131 boost::python::object python_function;
136 return type == EXTERN_UNNAMED && unnamed_filter;
141 return type == EXTERN_NAMED && named_filter;
146 return type == FUNCTOR;
151 return type == UNINITIALIZED;
155 void (*unnamed_filter) (
160 void (*named_filter) (
162 const transport::TransportContext &,
182 #endif // _MADARA_AGGREGATE_FILTERS_H_
AggregateFilter(filters::AggregateFilter *filter)
Constructor for functor.
Abstract base class for implementing aggregate record filters via a functor interface.
filters::AggregateFilter * functor
mapped functor for aggregate filtering
bool is_extern_named(void) const
Provides context about the transport.
This class stores a function definition.
bool is_uninitialized(void) const
::std::map< std::string, KnowledgeRecord > KnowledgeMap
std::list< AggregateFilter > AggregateFilters
Typedef for a list of aggregate filters.
AggregateFilter(void(*extern_func)(KnowledgeMap &, const transport::TransportContext &, Variables &))
Constructor for function pointer.
bool is_functor(void) const
Provides functions and classes for the distributed knowledge base.
Types
Types of functions supported.
Copyright (c) 2015 Carnegie Mellon University.
AggregateFilter()
Default constructor.
Provides an interface for external functions into the MADARA KaRL variable settings.
bool is_extern_unnamed(void) const