Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
sync_message.h
Go to the documentation of this file.
1#pragma once
2
3namespace hgps {
4
7 public:
11 explicit SyncMessage(const int run, const int time) : run_{run}, time_{time} {}
12
13 SyncMessage(const SyncMessage &) = delete;
14 SyncMessage &operator=(const SyncMessage &) = delete;
16 virtual ~SyncMessage() = default;
17
20 int run() const noexcept { return run_; }
21
24 int time() const noexcept { return time_; }
25
26 protected:
29 SyncMessage(SyncMessage &&other) = default;
30
34 SyncMessage &operator=(SyncMessage &&other) = default;
35
36 private:
37 int run_;
38 int time_;
39};
40
43template <typename PayloadType> class SyncDataMessage final : public SyncMessage {
44 public:
49 explicit SyncDataMessage(const int run, const int time, PayloadType &&data)
50 : SyncMessage(run, time), data_{std::move(data)} {}
51
54 const PayloadType &data() const noexcept { return data_; }
55
56 private:
57 PayloadType data_;
58};
59} // namespace hgps
Implements a synchronisation message with payload.
Definition sync_message.h:43
const PayloadType & data() const noexcept
Gets the message payload data.
Definition sync_message.h:54
SyncDataMessage(const int run, const int time, PayloadType &&data)
Initialises a new instance of the SyncMessage class.
Definition sync_message.h:49
Scenario data synchronisation message data type.
Definition sync_message.h:6
SyncMessage & operator=(const SyncMessage &)=delete
SyncMessage(SyncMessage &&other)=default
Moves the target of other to the target of *this.
int time() const noexcept
Gets the Simulation time.
Definition sync_message.h:24
virtual ~SyncMessage()=default
Destroys a SyncMessage instance.
SyncMessage(const int run, const int time)
Initialises a new instance of the SyncMessage class.
Definition sync_message.h:11
int run() const noexcept
Gets the Simulation run number.
Definition sync_message.h:20
SyncMessage(const SyncMessage &)=delete
SyncMessage & operator=(SyncMessage &&other)=default
Moves the target of other to *this.
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8
Global namespace.
Definition column_iterator.h:123