Symulacja NAT na przedmiot Symulacje Komputerowe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
713 B

  1. /*
  2. * Simulation.h
  3. *
  4. * Created on: 16.01.2017
  5. * Author: piotrek
  6. */
  7. #ifndef SIMULATION_H_
  8. #define SIMULATION_H_
  9. #include "common.h"
  10. #include "Log.h"
  11. enum THREAD_TYPE
  12. {
  13. NODE_RECV,
  14. SIM_TIMER,
  15. SIM_RESIZE,
  16. };
  17. struct threadParams
  18. {
  19. THREAD_TYPE type;
  20. void *context;
  21. pthread_t thread_id;
  22. };
  23. class Simulation : public Log
  24. {
  25. map<string, struct threadParams> threads;
  26. int cols, rows;
  27. string name;
  28. unsigned long startTime;
  29. public:
  30. Simulation();
  31. ~Simulation();
  32. void createThread(string name, THREAD_TYPE type, void * context);
  33. void destroyThread(string name);
  34. static void * threadWrapper(void * context);
  35. void resizeWnd();
  36. void timer();
  37. void p2pSimulation();
  38. };
  39. #endif /* SIMULATION_H_ */