LRT13  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
RobotData.h
1 #ifndef ROBOT_DATA_H_
2 #define ROBOT_DATA_H_
3 
4 #include <string>
5 #include <vector>
6 
7 #include "../Network/NetPeer.h"
8 #include "../Network/NetConnectionType.h"
9 #include "../Network/NetBuffer.h"
10 
11 //#include "robotdata.pb.h"
12 
13 using namespace std;
14 
15 namespace data
16 {
21  class RobotData
22  {
23  public:
24  enum RobotState
25  {
26  AUTONOMOUS = 0,
27  TELEOP = 1,
28  DISABLED = 2
29  };
30 
31  static void IncrementFrisbeeCounter();
32  static void DecrementFrisbeeCounter();
33  static int GetFrisbeeCounter();
34 
35  static int GetMissedPacketsInLifetime();
36  static void IncrementMissedPacketsInLifetime();
37 
38  static int GetCycleCount();
39  static void IncrementCycleCount();
40 
41  static RobotState GetCurrentState();
42  static RobotState GetLastState();
43  static void SetRobotState(RobotState state);
44 
45  static int AllocateKey(string className);
46  static void AddValue(int key, string type, string serialized);
47 
48  static void Serialize();
49 
50  static void NewFrame();
51  static void EnqueueBuffer(NetBuffer buff, NetPeer netConn, NetChannel::Enum channelType, int channel);
52 
53 
54  private:
55 
56  static int m_missedPacketsInLifetime;
57 
58  static RobotState m_state;
59  static RobotState m_laststate;
60  static int _id;
61  static int m_frisbees;
62 
63 
64 #warning rename/refactor me
65  struct Data
66  {
67  string className;
68  vector<string> indexToTypeMap;
69  vector<string> indexToValueMap;
70  };
71 
72  struct DataPacket
73  {
74  DataPacket() : netConn("10.8.46.5", 80, Network::SERVER){};//Finish writing your code before you commit it, seriously, don't give me stuff with linker errors. I changed this to make it compile. FIx it so it actually works.
75  NetBuffer netBuff;
76  NetPeer netConn;
77  int channel;
78  NetChannel::Enum channelType;
79  };
80 
81  static vector<Data> m_loggedClasses;
82 
83  static vector<DataPacket> m_frameList;
84  static vector<vector<DataPacket> > m_lifetimeList;
85  };
86 };
87 
88 #endif