MADARA  3.2.3
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 
13 #include <string>
14 #include <vector>
15 #include <map>
16 #include <list>
22 #include "madara/utility/StdInt.h"
23 #include "madara/MadaraExport.h"
27 
28 #ifdef _MADARA_JAVA_
29  #include <jni.h>
30 #endif
31 
32 #ifdef _MADARA_PYTHON_CALLBACKS_
33  #include <boost/python.hpp>
34 #endif
35 
36 namespace madara
37 {
38  namespace knowledge
39  {
41  typedef std::list <Function> FilterChain;
42 
44  typedef std::map <uint32_t, FilterChain> FilterMap;
45 
50  class MADARA_EXPORT KnowledgeRecordFilters
51  {
52  public:
57 
62 
66  virtual ~KnowledgeRecordFilters ();
67 
72  void operator= (const KnowledgeRecordFilters & rhs);
73 
80  void add (uint32_t types,
82 
83 
88  void add (void (*function) (
90  Variables &));
91 
96  void add (filters::AggregateFilter * filter);
97 
103  void add (filters::BufferFilter * filter);
104 
110  void add (uint32_t types, filters::RecordFilter * filter);
111 
112 #ifdef _MADARA_JAVA_
113 
120  void add (uint32_t types,
121  jobject & callable);
122 
127  void add (jobject & callable);
128 
129 #endif
130 
131 #ifdef _MADARA_PYTHON_CALLBACKS_
132 
139  void add (uint32_t types,
140  boost::python::object & callable);
141 
146  void add (boost::python::object & callable);
147 
148 #endif
149 
155  void attach (ThreadSafeContext * context);
156 
161  void clear (uint32_t types);
162 
166  void clear_aggregate_filters (void);
167 
171  void clear_buffer_filters (void);
172 
201  const std::string & name,
202  transport::TransportContext & context) const;
203 
209  void filter (KnowledgeMap & records,
210  const transport::TransportContext & transport_context) const;
211 
219  void filter_encode (unsigned char * source, int size, int max_size) const;
220 
228  void filter_decode (unsigned char * source, int size, int max_size) const;
229 
233  void print_num_filters (void) const;
234 
239  size_t get_number_of_filtered_types (void) const;
240 
245  size_t get_number_of_aggregate_filters (void) const;
246 
251  size_t get_number_of_buffer_filters (void) const;
252 
253  protected:
257  FilterMap filters_;
258 
263 
268 
273  };
274  }
275 }
276 
277 #endif // _MADARA_KNOWLEDGE_RECORD_FILTERS_H_
This class encapsulates an entry in a KnowledgeBase.
Abstract base class for implementing aggregate record filters via a functor interface.
filters::BufferFilters buffer_filters_
List of buffer filters.
ThreadSafeContext * context_
Context used by this filter.
This class stores variables and their values for use by any entity needing state information in a thr...
Abstract base class for implementing individual record filters via a functor interface.
Definition: RecordFilter.h:33
Provides map of data types to a filter chain to apply to the data.
std::vector< KnowledgeRecord > FunctionArguments
Provides context about the transport.
static struct madara::knowledge::tags::string_t string
AggregateFilters aggregate_filters_
List of aggregate filters.
::std::map< std::string, KnowledgeRecord > KnowledgeMap
std::list< AggregateFilter > AggregateFilters
Typedef for a list of aggregate filters.
std::list< BufferFilter * > BufferFilters
Definition: BufferFilter.h:56
Provides functions and classes for the distributed knowledge base.
std::map< uint32_t, FilterChain > FilterMap
a map of types to filter chain
Copyright (c) 2015 Carnegie Mellon University.
Abstract base class for implementing buffer filters via a functor interface.
Definition: BufferFilter.h:26
Provides an interface for external functions into the MADARA KaRL variable settings.
std::list< Function > FilterChain
a chain of filters
FilterMap filters_
Container for mapping types to filter chains.