tahoma2d/toonz/sources/include/tfarmserver.h

92 lines
1.9 KiB
C
Raw Normal View History

2016-03-19 06:57:51 +13:00
#ifndef TFARMSERVER_H
#define TFARMSERVER_H
2016-04-14 22:15:09 +12:00
#include <memory>
2016-03-19 06:57:51 +13:00
#include "tcommon.h"
#include <QString>
#include "tfarmplatforms.h"
//------------------------------------------------------------------------------
#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
//------------------------------------------------------------------------------
class TFARMAPI TFarmServer
{
public:
class HwInfo
{
public:
HwInfo()
: m_cpuCount(0), m_totPhysMem(0), m_availPhysMem(0), m_totVirtMem(0), m_availVirtMem(0), m_type(NoPlatform) {}
int m_cpuCount;
unsigned int m_totPhysMem;
unsigned int m_availPhysMem;
unsigned int m_totVirtMem;
unsigned int m_availVirtMem;
TFarmPlatform m_type;
};
virtual ~TFarmServer() {}
virtual int addTask(const QString &taskid, const QString &cmdline) = 0;
virtual int terminateTask(const QString &taskid) = 0;
virtual int getTasks(vector<QString> &tasks) = 0;
virtual void queryHwInfo(HwInfo &hwInfo) = 0;
// used (by a controller) to notify a controller start
virtual void attachController(const QString &name, const QString &addr, int port) = 0;
// used (by a controller) to notify a controller stop
virtual void detachController(const QString &name, const QString &addr, int port) = 0;
};
//------------------------------------------------------------------------------
class TFARMAPI TFarmServerFactory
{
public:
TFarmServerFactory();
~TFarmServerFactory();
int create(const QString &hostName, const QString &addr, int port, TFarmServer **tfserver);
};
//------------------------------------------------------------------------------
class TFARMAPI TFarmServerStub
{
public:
TFarmServerStub(TFarmServer *farmServer, int port);
~TFarmServerStub();
int run();
int shutdown();
int getPort() const;
private:
class Imp;
2016-04-14 22:15:09 +12:00
std::unique_ptr<Imp> m_imp;
2016-03-19 06:57:51 +13:00
};
#endif