tahoma2d/toonz/sources/include/tfarmserver.h

98 lines
2.1 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
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
//------------------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class TFARMAPI TFarmServer {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
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(std::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;
2016-03-19 06:57:51 +13:00
};
//------------------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class TFARMAPI TFarmServerFactory {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TFarmServerFactory();
~TFarmServerFactory();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
int create(const QString &hostName, const QString &addr, int port,
TFarmServer **tfserver);
2016-03-19 06:57:51 +13:00
};
//------------------------------------------------------------------------------
2016-06-15 18:43:10 +12:00
class TFARMAPI TFarmServerStub {
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TFarmServerStub(TFarmServer *farmServer, int port);
~TFarmServerStub();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
int run();
int shutdown();
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
int getPort() const;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
class Imp;
std::unique_ptr<Imp> m_imp;
2016-03-19 06:57:51 +13:00
};
#endif