Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
info_message.h
Go to the documentation of this file.
1 #pragma once
2 #include "event_message.h"
3 
4 namespace hgps {
5 
7 enum class ModelAction {
9  start,
10 
12  update,
13 
15  stop
16 };
17 
19 struct InfoEventMessage final : public EventMessage {
20 
21  InfoEventMessage() = delete;
22 
28  InfoEventMessage(std::string sender, ModelAction action, unsigned int run, int time) noexcept;
29 
36  InfoEventMessage(std::string sender, ModelAction action, unsigned int run, int time,
37  std::string msg) noexcept;
38 
41 
43  const int model_time{};
44 
46  const std::string message;
47 
48  int id() const noexcept override;
49 
50  std::string to_string() const override;
51 
52  void accept(EventMessageVisitor &visitor) const override;
53 };
54 
55 namespace detail {
57 const std::string model_action_str(const ModelAction action);
58 } // namespace detail
59 } // namespace hgps
Event message types visitor interface (double dispatcher)
Definition: event_visitor.h:10
const std::string model_action_str(const ModelAction action)
Converts enumeration to string, not pretty but no support in C++.
Definition: info_message.cpp:33
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
ModelAction
Enumerates simulation model actions.
Definition: info_message.h:7
@ update
Simulation time has updated, time = time + 1.
@ start
Simulation has started, time = start.
@ stop
Simulation has stopped, time = end.
Global namespace.
Definition: jsonparser.h:88
Simulation event messages interface.
Definition: event_message.h:25
Implements the simulation information event message data type.
Definition: info_message.h:19
const std::string message
Gets the notification message.
Definition: info_message.h:46
const ModelAction model_action
Gets the source action value.
Definition: info_message.h:40
int id() const noexcept override
Gets the unique message type identifier.
Definition: info_message.cpp:14
void accept(EventMessageVisitor &visitor) const override
Double dispatch the message using a visitor implementation.
Definition: info_message.cpp:29
const int model_time
Gets the associated Simulation time.
Definition: info_message.h:43
std::string to_string() const override
Create a string representation of this instance.
Definition: info_message.cpp:16