4 #include <swarmio/data/discovery/Schema.pb.h> 48 void AddParameter(
const std::string& key, data::discovery::Type type)
50 _parameters[key] = type;
70 virtual data::discovery::Schema
DescribeEvent(
const std::string& name)
override 74 data::discovery::Schema schema;
75 for (
auto p : _parameters)
77 (*schema.mutable_fields())[p.first].set_type(p.second);
83 throw Exception(
"Fake event handler queried for unknown event.");
A special event handler that serves discovery information and ignores the event itself.
const std::string & GetName() const
Get the name of the event.
Exception class thrown by all library classes.
virtual data::discovery::Schema DescribeEvent(const std::string &name) override
Handlers may add parameter descriptors to the event descriptor when asked to do so by overriding this...
virtual void EventWasTriggered(const Node *node, const data::event::Notification &event) override
Handlers are notified using this method when an event has been triggered.
void AddParameter(const std::string &key, data::discovery::Type type)
Add a new parameter to serve for discovery.
std::map< std::string, data::discovery::Type > _parameters
Parameters.
std::string _name
Event name.
Abstract base class for Event handlers.
Represents a Node the Endpoint knows about and can send messages to.
FauxEventHandler(const std::string &name)
Create a new fake event handler.