testmodules: Add example of simple inlined one-way call
This commit is contained in:
parent
86e8fbb6fb
commit
2aa3b69a6d
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user