2 #ifndef _MADARA_AGGREGATE_FILTERS_H_
3 #define _MADARA_AGGREGATE_FILTERS_H_
7 #include "madara/MadaraExport.h"
15 #include "madara_jni.h"
18 #ifdef _MADARA_PYTHON_CALLBACKS_
19 #include <boost/python.hpp>
64 : unnamed_filter(extern_func), functor(0),
type(EXTERN_UNNAMED)
72 : unnamed_filter(0), functor(filter),
type(FUNCTOR)
85 JNIEnv* env = madara_jni_get_env();
86 java_object = (jobject)env->NewGlobalRef(
object);
91 return type == JAVA_CALLABLE;
101 #ifdef _MADARA_PYTHON_CALLBACKS_
106 : python_function(func),
type(PYTHON_CALLABLE)
109 if (0 == PyObject_HasAttrString(func.ptr(),
"__call__"))
112 PyErr_SetString(PyExc_TypeError,
"Handler must be a callable object");
114 boost::python::throw_error_already_set();
120 return type == PYTHON_CALLABLE && !python_function.is_none();
128 return type == EXTERN_UNNAMED && unnamed_filter;
133 return type == EXTERN_NAMED && named_filter;
138 return type == FUNCTOR;
143 return type == UNINITIALIZED;
147 void (*unnamed_filter)(
Abstract base class for implementing aggregate record filters via a functor interface.
This class stores a function definition.
AggregateFilter(filters::AggregateFilter *filter)
Constructor for functor.
bool is_extern_named(void) const
AggregateFilter(boost::python::object &func)
Constructor for function pointer.
bool is_uninitialized(void) const
bool is_java_callable(void) const
bool is_extern_unnamed(void) const
AggregateFilter(void(*extern_func)(KnowledgeMap &, const transport::TransportContext &, Variables &))
Constructor for function pointer.
AggregateFilter()
Default constructor.
boost::python::object python_function
bool is_python_callable(void) const
Types
Types of functions supported.
AggregateFilter(jobject &object)
Constructor for java.
bool is_functor(void) const
filters::AggregateFilter * functor
mapped functor for aggregate filtering
Provides an interface for external functions into the MADARA KaRL variable settings.
Provides context about the transport.
Provides functions and classes for the distributed knowledge base.
std::list< AggregateFilter > AggregateFilters
Typedef for a list of aggregate filters.
::std::map< std::string, KnowledgeRecord > KnowledgeMap
Copyright(c) 2020 Galois.