MADARA
3.1.8
Main Page
Namespaces
Classes
Files
File List
File Members
CounterFilter.cpp
Go to the documentation of this file.
1
#include "
CounterFilter.h
"
2
#include "
madara/utility/Utility.h
"
3
4
namespace
utility
=
madara::utility
;
5
typedef
madara::knowledge::KnowledgeRecord::Integer
Integer
;
6
7
madara::filters::CounterFilter::CounterFilter
()
8
: initialized_ (false),
9
packets_ (0), first_message_ (-1), last_message_ (-1)
10
{
11
}
12
13
madara::filters::CounterFilter::~CounterFilter
()
14
{
15
}
16
17
18
void
19
madara::filters::CounterFilter::filter
(
20
knowledge::KnowledgeMap
&
/*records*/
,
21
const
transport::TransportContext
& transport_context,
22
knowledge::Variables
&
/*vars*/
)
23
{
24
Integer
cur_time = (
Integer
) transport_context.
get_current_time
();
25
26
if
(!
initialized_
)
27
{
28
this->
initialized_
=
true
;
29
this->
first_message_
= cur_time;
30
}
31
32
++this->
packets_
;
33
this->
last_message_
= cur_time;
34
}
madara::filters::CounterFilter::CounterFilter
CounterFilter()
Constructor.
Definition:
CounterFilter.cpp:7
Integer
madara::knowledge::KnowledgeRecord::Integer Integer
Definition:
CounterFilter.cpp:5
madara::knowledge::KnowledgeRecord::Integer
int64_t Integer
Definition:
KnowledgeRecord.h:103
CounterFilter.h
madara::filters::CounterFilter::last_message_
knowledge::KnowledgeRecord::Integer last_message_
The time of the last clear of the peer_list.
Definition:
CounterFilter.h:99
madara::filters::CounterFilter::first_message_
knowledge::KnowledgeRecord::Integer first_message_
The time to keep record of a peer.
Definition:
CounterFilter.h:94
madara::transport::TransportContext
Provides context about the transport.
Definition:
TransportContext.h:19
madara::filters::CounterFilter::initialized_
bool initialized_
Tracks if the first timer has been initialized.
Definition:
CounterFilter.h:84
madara::transport::TransportContext::get_current_time
uint64_t get_current_time(void) const
Gets the current timestamp.
Definition:
TransportContext.inl:31
Integer
madara::knowledge::KnowledgeRecord::Integer Integer
Definition:
QoSTransportSettings.cpp:9
madara::knowledge::KnowledgeMap
::std::map< std::string, KnowledgeRecord > KnowledgeMap
Definition:
KnowledgeRecord.h:1457
madara::filters::CounterFilter::packets_
knowledge::KnowledgeRecord::Integer packets_
A map of discovered peers.
Definition:
CounterFilter.h:89
madara::filters::CounterFilter::filter
virtual void filter(knowledge::KnowledgeMap &records, const transport::TransportContext &transport_context, knowledge::Variables &vars)
Adds to the counter.
Definition:
CounterFilter.cpp:19
madara::utility
Provides utility functions and classes for common tasks and needs.
Definition:
IteratorImpl.h:14
Utility.h
madara::knowledge::Variables
Provides an interface for external functions into the MADARA KaRL variable settings.
Definition:
ExternFunctionVariables.h:51
madara::filters::CounterFilter::~CounterFilter
virtual ~CounterFilter()
Destructor.
Definition:
CounterFilter.cpp:13
include
madara
filters
CounterFilter.cpp
Generated on Wed May 9 2018 18:17:14 for MADARA by
1.8.11