MADARA
3.2.3
|
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 (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 | 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 (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 (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 (boost::python::object &callable) |
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 (unsigned char *source, int size, int max_size) const |
Calls decode on the the buffer filter chain. More... | |
void | filter_encode (unsigned 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 50 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 | ( | 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 53 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 81 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 98 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 114 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 130 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 161 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 189 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 209 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 231 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 243 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 250 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::clear_aggregate_filters | ( | void | ) |
Clears the aggregate filters.
Definition at line 268 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::clear_buffer_filters | ( | void | ) |
Clears the buffer filters.
Definition at line 275 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 315 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 601 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::filter_decode | ( | unsigned 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 768 of file KnowledgeRecordFilters.cpp.
void madara::knowledge::KnowledgeRecordFilters::filter_encode | ( | unsigned 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 779 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 798 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 805 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 791 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 41 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 282 of file KnowledgeRecordFilters.cpp.
|
protected |
List of aggregate filters.
Definition at line 262 of file KnowledgeRecordFilters.h.
|
protected |
List of buffer filters.
Definition at line 267 of file KnowledgeRecordFilters.h.
|
protected |
Context used by this filter.
Definition at line 272 of file KnowledgeRecordFilters.h.
|
protected |
Container for mapping types to filter chains.
Definition at line 257 of file KnowledgeRecordFilters.h.