MADARA
3.4.1
|
Provides map of data types to a filter chain to apply to the data. More...
#include <KnowledgeRecordFilters.h>
Public Member Functions | |
KnowledgeRecordFilters () | |
Default constructor. More... | |
KnowledgeRecordFilters (const KnowledgeRecordFilters &filters) | |
Copy constructor. More... | |
virtual | ~KnowledgeRecordFilters () |
Destructor. More... | |
void | add (boost::python::object &callable) |
Adds an aggregate filter. More... | |
void | add (filters::AggregateFilter *filter) |
Adds an aggregate filter functor. More... | |
void | add (filters::BufferFilter *filter) |
Adds a buffer filter to be applied to the message buffer just before a send, before a receive, and just before a rebroadcast. More... | |
void | add (jobject &callable) |
Adds an aggregate filter. More... | |
void | add (uint32_t types, boost::python::object &callable) |
Adds a python filter to the list of types. More... | |
void | add (uint32_t types, filters::RecordFilter *filter) |
Adds an individual record filter functor. More... | |
void | add (uint32_t types, jobject &callable) |
Adds a java filter to the list of types. More... | |
void | add (uint32_t types, knowledge::KnowledgeRecord(*function)(FunctionArguments &, Variables &)) |
Adds a filter to the list of types. More... | |
void | add (void(*function)(KnowledgeMap &, const transport::TransportContext &, Variables &)) |
Adds an aggregate filter. More... | |
void | attach (ThreadSafeContext *context) |
Attaches a context. More... | |
void | clear (uint32_t types) |
Clears the list of filters for the specified types. More... | |
void | clear_aggregate_filters (void) |
Clears the aggregate filters. More... | |
void | clear_buffer_filters (void) |
Clears the buffer filters. More... | |
knowledge::KnowledgeRecord | filter (const knowledge::KnowledgeRecord &input, const std::string &name, transport::TransportContext &context) const |
Filters an input according to its filter chain. More... | |
void | filter (KnowledgeMap &records, const transport::TransportContext &transport_context) const |
Calls aggregate filter chain on the provided aggregate records. More... | |
void | filter_decode (char *source, int size, int max_size) const |
Calls decode on the the buffer filter chain. More... | |
void | filter_encode (char *source, int size, int max_size) const |
Calls encode on the the buffer filter chain. More... | |
size_t | get_number_of_aggregate_filters (void) const |
Returns the number of aggregate update filters. More... | |
size_t | get_number_of_buffer_filters (void) const |
Returns the number of buffer filters. More... | |
size_t | get_number_of_filtered_types (void) const |
Returns the number of types that have filters. More... | |
void | operator= (const KnowledgeRecordFilters &rhs) |
Assignment operator. More... | |
void | print_num_filters (void) const |
Prints the number of filters chained for each type. More... | |
Protected Attributes | |
AggregateFilters | aggregate_filters_ |
List of aggregate filters. More... | |
filters::BufferFilters | buffer_filters_ |
List of buffer filters. More... | |
ThreadSafeContext * | context_ |
Context used by this filter. More... | |
FilterMap | filters_ |
Container for mapping types to filter chains. More... | |
Provides map of data types to a filter chain to apply to the data.
Definition at line 51 of file KnowledgeRecordFilters.h.
madara::knowledge::KnowledgeRecordFilters::KnowledgeRecordFilters | ( | ) |
Default constructor.
Definition at line 23 of file KnowledgeRecordFilters.cpp.
madara::knowledge::KnowledgeRecordFilters::KnowledgeRecordFilters | ( | const KnowledgeRecordFilters & | filters | ) |
Copy constructor.
Definition at line 28 of file KnowledgeRecordFilters.cpp.
|
virtual |
Destructor.
Definition at line 36 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | boost::python::object & | callable | ) |
Adds an aggregate filter.
callable | the function that will filter the aggregation |
Definition at line 209 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | filters::AggregateFilter * | filter | ) |
Adds an aggregate filter functor.
filter | the functor that will filter the aggregation |
Definition at line 89 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | filters::BufferFilter * | filter | ) |
Adds a buffer filter to be applied to the message buffer just before a send, before a receive, and just before a rebroadcast.
filter | the functor that will filter the message buffer |
Definition at line 103 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | jobject & | callable | ) |
Adds an aggregate filter.
callable | the function that will filter the aggregation |
Definition at line 171 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | uint32_t | types, |
boost::python::object & | callable | ||
) |
Adds a python filter to the list of types.
types | the types to add the filter to |
callable | the function that will take the knowledge record in FunctionArguments. |
Definition at line 188 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | uint32_t | types, |
filters::RecordFilter * | filter | ||
) |
Adds an individual record filter functor.
types | the types to add the filter to |
filter | the functor that will filter the aggregation |
Definition at line 117 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | uint32_t | types, |
jobject & | callable | ||
) |
Adds a java filter to the list of types.
types | the types to add the filter to |
callable | the function that will take the knowledge record in FunctionArguments. |
Definition at line 145 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | uint32_t | types, |
knowledge::KnowledgeRecord(*)(FunctionArguments &, Variables &) | function | ||
) |
Adds a filter to the list of types.
types | the types to add the filter to |
function | the function that will take the knowledge record in FunctionArguments. |
Definition at line 49 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::add | ( | void(*)(KnowledgeMap &, const transport::TransportContext &, Variables &) | function | ) |
Adds an aggregate filter.
function | the function that will filter the aggregation |
Definition at line 75 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::attach | ( | ThreadSafeContext * | context | ) |
Attaches a context.
If the context ever goes out of scope, a 0 should be passed into this function to reset the context.
context | context to be used for Variable lookups |
Definition at line 220 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::clear | ( | uint32_t | types | ) |
Clears the list of filters for the specified types.
types | the types to clear the filters of |
Definition at line 226 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::clear_aggregate_filters | ( | void | ) |
Clears the aggregate filters.
Definition at line 243 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::clear_buffer_filters | ( | void | ) |
Clears the buffer filters.
Definition at line 248 of file KnowledgeRecordFilters.cpp.
madara::knowledge::KnowledgeRecord madara::knowledge::KnowledgeRecordFilters::filter | ( | const knowledge::KnowledgeRecord & | input, |
const std::string & | name, | ||
transport::TransportContext & | context | ||
) | const |
Filters an input according to its filter chain.
The arguments passed to the filter are the following:
args[0] : The knowledge record that the filter is acting upon
args[1] : The name of the knowledge record, if applicable ("" if unnamed)
args[2] : The type of operation calling the filter (integer valued).
: IDLE_OPERATION (should never see)
: SENDING_OPERATION (transport is about to send the record)
: RECEIVING_OPERATION (transport has received the record and is : about to apply the update)
: REBROADCASTING_OPERATION (transport is about to rebroadcast the record – only happens if rebroadcast is enabled in Transport Settings)
args[3] : Bandwidth used while sending through this transport
args[4] : Bandwidth used while receiving from this transport
args[5] : Message timestamp (when the message was originally sent)
args[6] : Current timestamp (the result of utility::get_time ()
args[7] : Network domain (partition of the network knowledge)
args[8] : Knowledge originator (where this update comes fromm)
input | the argument to the filter chain |
name | variable name ("" if unnamed) |
context | the context of the transport |
arguments vector is modifiable by filter, so we have to resize every filter call to make sure we have adequate space
Create the variables java object
Definition at line 280 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::filter | ( | KnowledgeMap & | records, |
const transport::TransportContext & | transport_context | ||
) | const |
Calls aggregate filter chain on the provided aggregate records.
records | the aggregate record map |
transport_context | the context of the transport |
Create the variables java object
Definition at line 549 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::filter_decode | ( | char * | source, |
int | size, | ||
int | max_size | ||
) | const |
Calls decode on the the buffer filter chain.
source | the source and destination buffer |
size | the amount of data in the buffer in bytes |
max_size | the amount of bytes the buffer can hold |
Definition at line 700 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::filter_encode | ( | char * | source, |
int | size, | ||
int | max_size | ||
) | const |
Calls encode on the the buffer filter chain.
source | the source and destination buffer |
size | the amount of data in the buffer in bytes |
max_size | the amount of bytes the buffer can hold |
Definition at line 712 of file KnowledgeRecordFilters.cpp.
size_t madara::knowledge::KnowledgeRecordFilters::get_number_of_aggregate_filters | ( | void | ) | const |
Returns the number of aggregate update filters.
Definition at line 730 of file KnowledgeRecordFilters.cpp.
size_t madara::knowledge::KnowledgeRecordFilters::get_number_of_buffer_filters | ( | void | ) | const |
Returns the number of buffer filters.
Definition at line 736 of file KnowledgeRecordFilters.cpp.
size_t madara::knowledge::KnowledgeRecordFilters::get_number_of_filtered_types | ( | void | ) | const |
Returns the number of types that have filters.
Definition at line 723 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::operator= | ( | const KnowledgeRecordFilters & | rhs | ) |
Assignment operator.
rhs | the value to be copied into this class |
Definition at line 38 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::print_num_filters | ( | void | ) | const |
Prints the number of filters chained for each type.
Definition at line 253 of file KnowledgeRecordFilters.cpp.
|
protected |
List of aggregate filters.
Definition at line 258 of file KnowledgeRecordFilters.h.
|
protected |
List of buffer filters.
Definition at line 263 of file KnowledgeRecordFilters.h.
|
protected |
Context used by this filter.
Definition at line 268 of file KnowledgeRecordFilters.h.
|
protected |
Container for mapping types to filter chains.
Definition at line 253 of file KnowledgeRecordFilters.h.