ddnet/src/engine/engine.h

47 lines
1.1 KiB
C
Raw Normal View History

2011-02-27 14:03:57 +00:00
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef ENGINE_ENGINE_H
#define ENGINE_ENGINE_H
#include "kernel.h"
#include <engine/shared/jobs.h>
class CFutureLogger;
class ILogger;
class CHostLookup : public IJob
2011-02-27 14:03:57 +00:00
{
private:
void Run() override;
2011-02-27 14:03:57 +00:00
public:
CHostLookup();
CHostLookup(const char *pHostname, int Nettype);
int m_Result;
2011-02-27 14:03:57 +00:00
char m_aHostname[128];
int m_Nettype;
2011-02-27 14:03:57 +00:00
NETADDR m_Addr;
};
class IEngine : public IInterface
{
MACRO_INTERFACE("engine", 0)
protected:
2011-02-27 16:56:03 +00:00
class CJobPool m_JobPool;
2011-02-27 14:03:57 +00:00
public:
virtual ~IEngine() = default;
virtual void Init() = 0;
virtual void AddJob(std::shared_ptr<IJob> pJob) = 0;
virtual void SetAdditionalLogger(std::unique_ptr<ILogger> &&pLogger) = 0;
static void RunJobBlocking(IJob *pJob);
2011-02-27 14:03:57 +00:00
};
extern IEngine *CreateEngine(const char *pAppname, std::shared_ptr<CFutureLogger> pFutureLogger, int Jobs);
2021-04-17 14:05:24 +00:00
extern IEngine *CreateTestEngine(const char *pAppname, int Jobs);
2011-02-27 14:03:57 +00:00
#endif