GAMS  1.2.2
MessageProfiling.h
Go to the documentation of this file.
1 
55 #ifndef _GAMS_ALGORITHMS_MESSAGE_PROFILING_H_
56 #define _GAMS_ALGORITHMS_MESSAGE_PROFILING_H_
57 
59 
60 #include <map>
61 #include <vector>
62 #include <string>
63 
64 #include "gams/variables/Sensor.h"
67 #include "gams/variables/Self.h"
68 
70 
71 #include "madara/filters/AggregateFilter.h"
72 #include "madara/transport/QoSTransportSettings.h"
73 
74 namespace gams
75 {
76  namespace algorithms
77  {
82  {
83  public:
93  const madara::knowledge::KnowledgeRecord& send,
94  madara::knowledge::KnowledgeBase * knowledge = 0,
95  platforms::Base * platform = 0,
96  variables::Sensors * sensors = 0,
97  variables::Self * self = 0);
98 
102  ~MessageProfiling ();
103 
107  void init_filtered_transport (madara::transport::QoSTransportSettings
108  settings);
109 
114  void operator= (const MessageProfiling & rhs);
115 
120  virtual int analyze (void);
121 
126  virtual int execute (void);
127 
132  virtual int plan (void);
133 
134  private:
138  const static std::string key_prefix_;
139 
141  madara::knowledge::KnowledgeBase * local_knowledge_;
142 
146  madara::knowledge::containers::String data_;
147 
151  //madara::knowledge::containers::Integer count_;
152 
157  class MessageFilter : public madara::filters::AggregateFilter
158  {
159  public:
163  virtual ~MessageFilter ();
164 
165  void filter (madara::knowledge::KnowledgeMap& records,
166  const madara::transport::TransportContext& transport_context,
167  madara::knowledge::Variables& var);
168 
169  std::string missing_messages_string () const;
170 
174  struct MessageData
175  {
176  size_t first;
177  size_t last;
178  std::vector<bool> present;
179  };
180 
184  //std::map<std::string, MessageData> msg_map;
185  std::map<std::string, size_t> msg_map;
186  };
187 
192 
196  size_t send_size_;
197  };
198 
203  {
204  public:
205 
220  virtual BaseAlgorithm * create (
221  const madara::knowledge::KnowledgeMap & args,
222  madara::knowledge::KnowledgeBase * knowledge,
223  platforms::BasePlatform * platform,
224  variables::Sensors * sensors,
225  variables::Self * self,
226  variables::Agents * agents);
227  };
228  }
229 }
230 
231 #endif // _GAMS_ALGORITHMS_MESSAGE_PROFILING_H_
Base class for algorithm factories that classes derived from.
An algorithm for profiling message generation and receipt.
size_t send_size_
size of message to send
Copyright (c) 2014 Carnegie Mellon University.
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
The base platform for all platforms to use.
Definition: BasePlatform.h:190
Copyright (c) 2014 Carnegie Mellon University.
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Copyright (c) 2014 Carnegie Mellon University.
A factory class for creating MessageProfiling Algorithms.
Contains all GAMS-related tools, classes and code.
madara::knowledge::KnowledgeBase * local_knowledge_
provides access to the knowledge base
A container for self referencing information.
Definition: Self.h:69
#define GAMS_EXPORT
Definition: GamsExport.h:20
std::map< std::string, size_t > msg_map
Keep a MessageData struct for each peer.
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:94
Copyright (c) 2014 Carnegie Mellon University.
static const std::string key_prefix_
Prefix for message keys.
madara::knowledge::containers::String data_
Container for storing data to be sent to other controllers.
MessageFilter filter_
Message Filter object.
Copyright (c) 2014 Carnegie Mellon University.