MADARA  3.4.1
KnowledgeRecordFilters.h
Go to the documentation of this file.
1 
2 
3 #ifndef _MADARA_KNOWLEDGE_RECORD_FILTERS_H_
4 #define _MADARA_KNOWLEDGE_RECORD_FILTERS_H_
5 
14 #include <string>
15 #include <vector>
16 #include <map>
17 #include <list>
23 #include "madara/utility/StdInt.h"
24 #include "madara/MadaraExport.h"
28 
29 #ifdef _MADARA_JAVA_
30 #include <jni.h>
31 #endif
32 
33 #ifdef _MADARA_PYTHON_CALLBACKS_
34 #include <boost/python.hpp>
35 #endif
36 
37 namespace madara
38 {
39 namespace knowledge
40 {
42 typedef std::list<Function> FilterChain;
43 
45 typedef std::map<uint32_t, FilterChain> FilterMap;
46 
51 class MADARA_EXPORT KnowledgeRecordFilters
52 {
53 public:
58 
63 
67  virtual ~KnowledgeRecordFilters();
68 
73  void operator=(const KnowledgeRecordFilters& rhs);
74 
81  void add(uint32_t types,
83 
88  void add(void (*function)(
90 
95  void add(filters::AggregateFilter* filter);
96 
102  void add(filters::BufferFilter* filter);
103 
109  void add(uint32_t types, filters::RecordFilter* filter);
110 
111 #ifdef _MADARA_JAVA_
112 
119  void add(uint32_t types, jobject& callable);
120 
125  void add(jobject& callable);
126 
127 #endif
128 
129 #ifdef _MADARA_PYTHON_CALLBACKS_
130 
137  void add(uint32_t types, boost::python::object& callable);
138 
143  void add(boost::python::object& callable);
144 
145 #endif
146 
152  void attach(ThreadSafeContext* context);
153 
158  void clear(uint32_t types);
159 
163  void clear_aggregate_filters(void);
164 
168  void clear_buffer_filters(void);
169 
198  const std::string& name, transport::TransportContext& context) const;
199 
205  void filter(KnowledgeMap& records,
206  const transport::TransportContext& transport_context) const;
207 
215  void filter_encode(char* source, int size, int max_size) const;
216 
224  void filter_decode(char* source, int size, int max_size) const;
225 
229  void print_num_filters(void) const;
230 
235  size_t get_number_of_filtered_types(void) const;
236 
241  size_t get_number_of_aggregate_filters(void) const;
242 
247  size_t get_number_of_buffer_filters(void) const;
248 
249 protected:
254 
259 
264 
269 };
270 }
271 }
272 
273 #endif // _MADARA_KNOWLEDGE_RECORD_FILTERS_H_
Abstract base class for implementing aggregate record filters via a functor interface.
Abstract base class for implementing buffer filters via a functor interface.
Definition: BufferFilter.h:27
Abstract base class for implementing individual record filters via a functor interface.
Definition: RecordFilter.h:34
Provides map of data types to a filter chain to apply to the data.
FilterMap filters_
Container for mapping types to filter chains.
ThreadSafeContext * context_
Context used by this filter.
AggregateFilters aggregate_filters_
List of aggregate filters.
filters::BufferFilters buffer_filters_
List of buffer filters.
This class encapsulates an entry in a KnowledgeBase.
This class stores variables and their values for use by any entity needing state information in a thr...
Provides an interface for external functions into the MADARA KaRL variable settings.
Definition: Variables.h:53
Provides context about the transport.
std::list< BufferFilter * > BufferFilters
Definition: BufferFilter.h:65
constexpr string_t string
Provides functions and classes for the distributed knowledge base.
std::list< AggregateFilter > AggregateFilters
Typedef for a list of aggregate filters.
std::list< Function > FilterChain
a chain of filters
std::vector< KnowledgeRecord > FunctionArguments
std::map< uint32_t, FilterChain > FilterMap
a map of types to filter chain
::std::map< std::string, KnowledgeRecord > KnowledgeMap
Copyright(c) 2020 Galois.