#ifndef __CLUSTERWORKER_H__
#define __CLUSTERWORKER_H__

#include "clustermanager.h"  // for the message codes
#include "tcpconnection.h"
#include "mutualinformation.h"

class clusterworker
{
 public:
  clusterworker();
  ~clusterworker();
  int init( std::string ip, int port );
  int start( unsigned long int ts );

 private:

  int processwork();
  int getdata();
  int mainloop();
  int sendresult();

  tcpconnection cn;  ///< connection
  workunit cwu;      ///< current workunit
  std::string cmip;  ///< manager ip
  int cmport;        ///< manager port

  std::vector< image2d* > sa;
  std::vector< image2d* > sb;
  image2d mapa;
  image2d mapb;

  mutualinformation mi;

};

#endif
