MADARA  3.4.1
madara::filters::VariableMapFilter Class Reference

Filter for mapping variables in the KB into a filter's outgoing or incoming messages. More...

#include <VariableMapFilter.h>

Inheritance diagram for madara::filters::VariableMapFilter:
madara::filters::AggregateFilter

Public Member Functions

 VariableMapFilter (const std::string &filename="")
 Constructor. More...
 
virtual ~VariableMapFilter ()=default
 Destructor. More...
 
virtual void filter (knowledge::KnowledgeMap &records, const transport::TransportContext &, knowledge::Variables &vars)
 Adds to the counter. More...
 
void process_config (const std::string &config)
 Processes mappings from a config file. More...
 
void read_config (const std::string &filename)
 Reads a config file and processes the contents. More...
 

Protected Attributes

bool initialized_
 
std::map< std::string, std::pair< std::string, knowledge::VariableReference > > map_
 Map of local KB variable to a variable to add and a VariableReference to the local KB variable. More...
 

Detailed Description

Filter for mapping variables in the KB into a filter's outgoing or incoming messages.

Definition at line 32 of file VariableMapFilter.h.

Constructor & Destructor Documentation

◆ VariableMapFilter()

madara::filters::VariableMapFilter::VariableMapFilter ( const std::string &  filename = "")
inline

Constructor.

Parameters
filenamethe filename of the config to load mappings from

Definition at line 119 of file VariableMapFilter.h.

◆ ~VariableMapFilter()

virtual madara::filters::VariableMapFilter::~VariableMapFilter ( )
virtualdefault

Destructor.

Member Function Documentation

◆ filter()

virtual void madara::filters::VariableMapFilter::filter ( knowledge::KnowledgeMap records,
const transport::TransportContext ,
knowledge::Variables vars 
)
inlinevirtual

Adds to the counter.

Parameters
recordsthe aggregate records vector
varscontext for querying current program state

Implements madara::filters::AggregateFilter.

Definition at line 134 of file VariableMapFilter.h.

◆ process_config()

void madara::filters::VariableMapFilter::process_config ( const std::string &  config)
inline

Processes mappings from a config file.

Mappings should be in the form of "var_in_kb -> new_var".

Parameters
configthe configuration file contents to process

Definition at line 40 of file VariableMapFilter.h.

◆ read_config()

void madara::filters::VariableMapFilter::read_config ( const std::string &  filename)
inline

Reads a config file and processes the contents.

Mappings should be in the form of "var_in_kb -> new_var".

Parameters
filenamethe name of the configuration file to process

Definition at line 107 of file VariableMapFilter.h.

Member Data Documentation

◆ initialized_

bool madara::filters::VariableMapFilter::initialized_
protected

Definition at line 159 of file VariableMapFilter.h.

◆ map_

std::map<std::string, std::pair<std::string, knowledge::VariableReference> > madara::filters::VariableMapFilter::map_
protected

Map of local KB variable to a variable to add and a VariableReference to the local KB variable.

Definition at line 166 of file VariableMapFilter.h.


The documentation for this class was generated from the following file: