2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TFARMEXECUTOR_H
|
|
|
|
#define TFARMEXECUTOR_H
|
|
|
|
|
|
|
|
#include "ttcpip.h"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
|
|
|
|
#ifdef TFARMAPI
|
|
|
|
#undef TFARMAPI
|
|
|
|
#endif
|
|
|
|
|
2016-04-15 17:11:23 +12:00
|
|
|
#ifdef _WIN32
|
2016-03-19 06:57:51 +13:00
|
|
|
#ifdef TFARM_EXPORTS
|
|
|
|
#define TFARMAPI __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define TFARMAPI __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define TFARMAPI
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//==============================================================================
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
class TFARMAPI TFarmExecutor : public TTcpIpServer {
|
2016-03-19 06:57:51 +13:00
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TFarmExecutor(int port);
|
|
|
|
virtual ~TFarmExecutor() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
// TTcpIpServer overrides
|
2016-06-19 20:06:29 +12:00
|
|
|
void onReceive(int socket, const QString &data) override;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
protected:
|
2016-06-15 18:43:10 +12:00
|
|
|
virtual QString execute(const std::vector<QString> &argv) = 0;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
private:
|
2016-06-15 18:43:10 +12:00
|
|
|
TTcpIpServer *m_tcpipServer;
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|