32 lines
702 B
C
Raw Normal View History

2014-09-29 09:15:18 +03:00
// http://www.apache.org/licenses/LICENSE-2.0
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
#pragma once
#include "core/json.h"
#include "interface/event.h"
#include "interface/server.h"
#include "interface/module.h"
#include <functional>
2014-09-30 13:34:22 +03:00
namespace interface
2014-09-29 09:15:18 +03:00
{
2014-09-30 13:34:22 +03:00
struct ModuleInfo;
2014-10-06 16:43:27 +03:00
}
2014-09-29 09:15:18 +03:00
2014-09-30 13:34:22 +03:00
namespace loader
{
2014-09-29 09:15:18 +03:00
struct Interface
{
virtual void activate() = 0;
2014-09-30 13:34:22 +03:00
virtual interface::ModuleInfo* get_module_info(const ss_ &name) = 0;
2014-09-29 09:15:18 +03:00
};
inline bool access(interface::Server *server,
std::function<void(loader::Interface*)> cb)
2014-09-29 09:15:18 +03:00
{
2014-10-06 16:43:27 +03:00
return server->access_module("loader", [&](interface::Module *module){
cb((loader::Interface*)module->check_interface());
});
2014-09-29 09:15:18 +03:00
}
}
// vim: set noet ts=4 sw=4: