testmodules: Add example of simple inlined one-way call

This commit is contained in:
Perttu Ahola 2014-09-17 15:45:45 +03:00
parent 86e8fbb6fb
commit 2aa3b69a6d
2 changed files with 13 additions and 0 deletions

View File

@ -8,4 +8,11 @@ namespace test1
Thing(const ss_ &some_data = "default value"): some_data(some_data){}
};
inline void do_thing(interface::Server *server, const ss_ &some_data)
{
interface::Event event("test1:thing");
event.p.reset(new test1::Thing(some_data));
server->emit_event(event);
}
}

View File

@ -40,9 +40,15 @@ struct Module: public interface::Module
void start()
{
std::cout<<"test2 start(): Calling test1"<<std::endl;
// Basic way
interface::Event event("test1:thing");
event.p.reset(new test1::Thing("Nakki"));
m_server->emit_event(event);
// Simplified by inlining
test1::do_thing(m_server, "Kebab");
}
};