MADARA  3.2.3
TransportContext.inl
Go to the documentation of this file.
1 #ifndef _TRANSPORT_CONTEXT_INL_
2 #define _TRANSPORT_CONTEXT_INL_
3 
4 #include "TransportContext.h"
5 
6 inline void
8 {
9  records_.clear ();
10 }
11 
12 inline int64_t
14 {
15  return operation_;
16 }
17 
18 inline uint64_t
20 {
21  return receive_bandwidth_;
22 }
23 
24 inline uint64_t
26 {
27  return send_bandwidth_;
28 }
29 
30 inline uint64_t
32 {
33  return current_time_;
34 }
35 
36 inline uint64_t
38 {
39  return message_time_;
40 }
41 
42 inline void
44  int64_t operation)
45 {
46  operation_ = operation;
47 }
48 
49 inline void
51  uint64_t bandwidth)
52 {
53  receive_bandwidth_ = bandwidth;
54 }
55 
56 inline void
58  uint64_t bandwidth)
59 {
60  send_bandwidth_ = bandwidth;
61 }
62 
63 inline void
65  uint64_t current_time)
66 {
67  current_time_ = current_time;
68 }
69 
70 inline void
72  uint64_t message_time)
73 {
74  message_time_ = message_time;
75 }
76 
77 inline void
79  const std::string & key,
81 {
82  records_[key] = record;
83 }
84 
85 inline const madara::knowledge::KnowledgeMap &
87 {
88  return records_;
89 }
90 
91 inline void
93  const std::string & domain)
94 {
95  domain_ = domain;
96 }
97 
98 inline const std::string &
100 {
101  return domain_;
102 }
103 
104 inline void
106  const std::string & originator)
107 {
108  originator_ = originator;
109 }
110 
111 inline const std::string &
113 {
114  return originator_;
115 }
116 
117 inline void
119 const std::string & endpoint)
120 {
121  endpoint_ = endpoint;
122 }
123 
124 inline const std::string &
126 {
127  return endpoint_;
128 }
129 
130 inline void
132  const knowledge::KnowledgeMap & source)
133 {
134  records_ = source;
135 }
136 
137 #endif // _TRANSPORT_CONTEXT_INL_
This class encapsulates an entry in a KnowledgeBase.
void set_send_bandwidth(uint64_t bandwidth)
Sets the bandwidth used for sends/rebroadcast in bytes per second.
void clear_records(void)
Clears records added through filtering operations.
const knowledge::KnowledgeMap & get_records(void) const
Returns the additional records stored in the context.
uint64_t send_bandwidth_
Bandwidth being utilized for send operations.
knowledge::KnowledgeMap records_
Context specific records.
std::string originator_
Originator of the current message.
void set_operation(int64_t operation)
Sets the operation that the context is/should be performing.
uint64_t get_receive_bandwidth(void) const
Gets the receive bandwidth in bytes per second.
int64_t operation_
Operation being performed.
static struct madara::knowledge::tags::string_t string
uint64_t get_current_time(void) const
Gets the current timestamp.
int64_t get_operation(void) const
Get operation that the context is performing.
void set_domain(const std::string &domain)
Sets the network domain.
std::string endpoint_
Public endpoint of the current message.
void set_endpoint(const std::string &endpoint)
Sets the current message endpoint.
void set_receive_bandwidth(uint64_t bandwidth)
Sets the bandwidth used for receives in bytes per second.
::std::map< std::string, KnowledgeRecord > KnowledgeMap
void set_message_time(uint64_t message_time)
Sets the message time.
void add_record(const std::string &key, const madara::knowledge::KnowledgeRecord &record)
Adds a record to the list that should be appended to send or rebroadcast.
uint64_t receive_bandwidth_
Bandwidth being utilized for receive operations.
uint64_t get_message_time(void) const
Gets the message timestamp.
void set_originator(const std::string &originator)
Sets the current message originator.
uint64_t current_time_
Current timestamp.
std::string domain_
Networking domain.
const std::string & get_endpoint(void) const
Returns the current message endpoint.
void set_records(const knowledge::KnowledgeMap &source)
Sets the current message originator.
const std::string & get_domain(void) const
Returns the network domain.
const std::string & get_originator(void) const
Returns the current message originator.
void set_current_time(uint64_t current_time)
Sets the current time.
uint64_t message_time_
Message timestamp.
uint64_t get_send_bandwidth(void) const
Gets the send/rebroadcast bandwidth in bytes per second.