3 #ifndef _MADARA_FILTERS_PREFIX_PRINT_H_
4 #define _MADARA_FILTERS_PREFIX_PRINT_H_
38 PrefixPrint(
const std::vector<std::string>& source_prefixes = {},
39 bool print_verbose =
true)
60 std::stringstream buffer;
64 buffer <<
"PrefixFilter Arguments:\n";
67 buffer <<
" Operation Type: ";
73 buffer <<
" Send Bandwidth: ";
78 buffer <<
" Receive Bandwidth: ";
83 buffer <<
" Update Time: ";
88 buffer <<
" Current Time: ";
93 buffer <<
" Knowledge Domain: ";
98 buffer <<
" Originator: ";
102 buffer <<
" Updates:\n";
106 for (
auto record : records)
109 bool accepted_prefix =
false;
117 accepted_prefix =
true;
124 accepted_prefix =
true;
128 if (!accepted_prefix)
132 "PrefixPrint::filter: "
133 "not printing variable %s\n",
134 record.first.c_str())
139 buffer <<
" " << record.first <<
" = ";
140 buffer << record.second.to_string() <<
"\n";
#define madara_logger_ptr_log(loggering, level,...)
Fast version of the madara::logger::log method for Logger pointers.
Abstract base class for implementing aggregate record filters via a functor interface.
Filter for printing variables as they arrive and excluding prefixes that are unwanted via a user-spec...
PrefixPrint(const std::vector< std::string > &source_prefixes={}, bool print_verbose=true)
Constructor.
virtual void filter(knowledge::KnowledgeMap &records, const transport::TransportContext &transport_context, knowledge::Variables &)
Prints records and transport context information.
std::vector< std::string > prefixes
Prefixes to print.
virtual ~PrefixPrint()
Destructor.
Provides an interface for external functions into the MADARA KaRL variable settings.
Provides context about the transport.
uint64_t get_send_bandwidth(void) const
Gets the send/rebroadcast bandwidth in bytes per second.
const std::string & get_domain(void) const
Returns the network domain.
int64_t get_operation(void) const
Get operation that the context is performing.
uint64_t get_current_time(void) const
Gets the current timestamp.
const std::string & get_originator(void) const
Returns the current message originator.
uint64_t get_receive_bandwidth(void) const
Gets the receive bandwidth in bytes per second.
uint64_t get_message_time(void) const
Gets the message timestamp.
T get(const KnowledgeRecord &kr)
Get the value of a KnowlegeRecord.
::std::map< std::string, KnowledgeRecord > KnowledgeMap
MADARA_EXPORT utility::Refcounter< logger::Logger > global_logger
std::string MADARA_EXPORT get_operation_type(int type)
Return the type of operation (usually from TransportContext)
MADARA_EXPORT bool begins_with(const std::string &input, const std::string &prefix)
Check if input contains prefix at the beginning.
Copyright(c) 2020 Galois.