| 123456789101112131415161718192021222324252627282930313233 |
- //
- // mailbox.h
- // engine
- //
- // Created by Sam Jaffe on 3/16/23.
- //
- #pragma once
- #include <string>
- #include <serializer/stringizer.h>
- namespace engine {
- /**
- * @brief A generic mailbox class that contains a system to message
- */
- class Mailbox {
- public:
- virtual ~Mailbox() = default;
- virtual void notify(std::string const & str) = 0;
- template <typename... Args> void notifyf(Args &&... args);
- private:
- };
- template <typename... Args> void Mailbox::notifyf(Args &&... args) {
- std::string str;
- using ::serializer::to_string;
- (str.append(to_string(std::forward<Args>(args))), ...);
- notify(str);
- }
- }
|