Advertisement
Guest User

protocol

a guest
May 5th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #ifndef PROTOCOL_H
  2. #define PROTOCOL_H
  3.  
  4. #include <vector>
  5.  
  6. enum RequestType {START, GET_DATA, GET_GRAPH, STOP};
  7. enum DatasetType {ZACHARY, MOVIELENS};
  8. enum ReplyType {STARTED, POST_DATA, POST_GRAPH, STOPPED};
  9. enum State {OK, FAIL};
  10.  
  11. struct Request { //Request to server
  12. RequestType type;
  13. DatasetType dataset;
  14. size_t filenameSize;
  15. string fileName;
  16. };
  17.  
  18. struct ReplyState { //Reply to a START/STOP Request
  19. ReplyType type;
  20. State state;
  21. };
  22.  
  23. struct ReplyData { //Reply to a GET_DATA Request
  24. ReplyType type;
  25. size_t num_vertex;
  26. vector<int> solution;
  27. double fitness;
  28. };
  29.  
  30. struct ReplyGraph { //Replay to a GET_GRAPH Request
  31. ReplyType type;
  32. size_t num_edges;
  33. std::vector<std::array<int, 2>> edges;
  34. };
  35.  
  36. #endif // PROTOCOL_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement