/*
|
|
* Simulation.h
|
|
*
|
|
* Created on: 16.01.2017
|
|
* Author: piotrek
|
|
*/
|
|
|
|
#ifndef SIMULATION_H_
|
|
#define SIMULATION_H_
|
|
|
|
#include "common.h"
|
|
#include "Log.h"
|
|
|
|
enum THREAD_TYPE
|
|
{
|
|
NODE_RECV,
|
|
SIM_TIMER,
|
|
SIM_RESIZE,
|
|
};
|
|
|
|
struct threadParams
|
|
{
|
|
THREAD_TYPE type;
|
|
void *context;
|
|
pthread_t thread_id;
|
|
};
|
|
|
|
class Simulation : public Log
|
|
{
|
|
map<string, struct threadParams> threads;
|
|
int cols, rows;
|
|
string name;
|
|
unsigned long startTime;
|
|
public:
|
|
Simulation();
|
|
~Simulation();
|
|
|
|
void createThread(string name, THREAD_TYPE type, void * context);
|
|
void destroyThread(string name);
|
|
static void * threadWrapper(void * context);
|
|
|
|
void resizeWnd();
|
|
void timer();
|
|
|
|
void p2pSimulation();
|
|
};
|
|
|
|
#endif /* SIMULATION_H_ */
|