#include <memory>
#include <string>
#include <cloe/core.hpp>
#include <cloe/trigger.hpp>
#include <cloe/trigger/helper_macros.hpp>
Go to the source code of this file.
|
|
#define | CLOE_TRIGGER_NIL_EVENT_HPP_ |
| |
| #define | DEFINE_NIL_EVENT(xName, xname, xdescription) |
| |
◆ DEFINE_NIL_EVENT
| #define DEFINE_NIL_EVENT |
( |
|
xName, |
|
|
|
xname, |
|
|
|
xdescription |
|
) |
| |
Value: public: \
explicit xName(
const std::string& name) : ::
cloe::Event(name) {} \
::cloe::EventPtr
clone()
const override {
return std::make_unique<xName>(
name()); } \
void
to_json(::cloe::Json&)
const override {} \
bool operator()(const ::cloe::Sync&) const { return true; } \
}; \
\
public: \
using EventType = xName; \
\
\
std::unique_ptr<::cloe::Event> make(const ::cloe::Conf&) const override { \
return std::make_unique<xName>(this->
name()); \
} \
\
std::unique_ptr<::cloe::Event> make(const std::string&) const override { \
return std::make_unique<xName>(this->
name()); \
} \
}; \
\
Definition: registrar.hpp:45
virtual void to_json(Json &) const =0
TriggerFactory< Event > EventFactory
Definition: trigger.hpp:516
Definition: coordinator.hpp:36
Definition: trigger.hpp:487
virtual EventPtr clone() const =0
Definition: trigger.hpp:300
std::string name() const
Definition: entity.hpp:68
Macro DEFINE_NIL_EVENT defines an event that has no state and no configuration.
- Parameters
-
| xName | identifier for event |
| xname | string identifier of event (lowercase) |
| xdescription | string description of event |
Given the stateless event "start of simulation", we can create it in code like so, note that the semicolon at the end is required.
This will define the following classes for us:
Event
EventFactory
EventCallback
This event can be registered with the register_event helper function.