rotor
Event loop friendly C++ actor micro-framework
 
Loading...
Searching...
No Matches
message_stringifier.h
1#pragma once
2
3//
4// Copyright (c) 2019-2024 Ivan Baidakou (basiliscos) (the dot dmol at gmail dot com)
5//
6// Distributed under the MIT Software License
7//
8
9#include "rotor/export.h"
10
11#include <string>
12#include <ostream>
13#include <memory>
14
15#if defined(_MSC_VER)
16#pragma warning(push)
17#pragma warning(disable : 4251)
18#endif
19
20namespace rotor {
21
22struct message_base_t;
23
36struct ROTOR_API message_stringifier_t {
37 virtual ~message_stringifier_t() = default;
38
40 virtual std::string stringify(const message_base_t &) const;
41
43 virtual void stringify_to(std::ostream &, const message_base_t &) const = 0;
44};
45
47using message_stringifier_ptr_t = std::unique_ptr<message_stringifier_t>;
48
49}; // namespace rotor
50
51#if defined(_MSC_VER)
52#pragma warning(pop)
53#endif
Basic namespace for all rotor functionalities.
Definition rotor.hpp:21
std::unique_ptr< message_stringifier_t > message_stringifier_ptr_t
smart pointer for message stringifier
Definition message_stringifier.h:47
Base class for rotor message.
Definition message.h:52
Abstract interface for making textual/string representation of a message.
Definition message_stringifier.h:36
virtual std::string stringify(const message_base_t &) const
returns string representation of a message
virtual void stringify_to(std::ostream &, const message_base_t &) const =0
dumps string representation of a message to output stream