39 lines
797 B
C
Raw Normal View History

2014-10-01 19:00:59 +03:00
// http://www.apache.org/licenses/LICENSE-2.0
// Copyright 2014 Perttu Ahola <celeron55@gmail.com>
#pragma once
#include "interface/event.h"
#include "interface/server.h"
#include "interface/module.h"
#include <functional>
namespace Urho3D
{
class Context;
class Scene;
2014-10-06 16:43:27 +03:00
}
2014-10-01 19:00:59 +03:00
2014-10-03 11:08:58 +03:00
namespace replicate
2014-10-01 19:00:59 +03:00
{
namespace magic = Urho3D;
using interface::Event;
typedef size_t PeerId;
2014-10-01 19:00:59 +03:00
struct Interface
{
virtual sv_<PeerId> find_peers_that_know_node(uint node_id) = 0;
virtual void emit_after_next_sync(Event event) = 0;
2014-10-01 19:00:59 +03:00
};
inline bool access(interface::Server *server,
std::function<void(replicate::Interface*)> cb)
2014-10-01 19:00:59 +03:00
{
2014-10-06 16:43:27 +03:00
return server->access_module("replicate", [&](interface::Module *module){
cb((replicate::Interface*)module->check_interface());
});
2014-10-01 19:00:59 +03:00
}
}
// vim: set noet ts=4 sw=4: