#ifndef WORKER_H
#define WORKER_H

#include "timer.h"
#include <iostream>
namespace iv {

class Worker
{

public:
    enum
    {
        WS_INIT         = 0x001,
        WS_RUN          = 0x002,
        WS_SUSPEND      = 0x003,
        WS_TERMINATE    = 0x004,
    };

public:
    Worker(float hz=20);

    virtual ~Worker();

    virtual void DoWork() = 0;

    void Run();

    void Suspend();

    void Terminate();

protected:
    void MainThread();

protected:
    std::thread main_thread_;
    Timer timer_;
    std::uint16_t worker_state_;
};

}

#endif // WORKER_H