summaryrefslogtreecommitdiff
path: root/src/sender_client.hh
blob: 54339cf739d8ce5742db86e82ef0367c876bac73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef SENDER_CLIENT_HH
#define SENDER_CLIENT_HH

#include <memory>
#include <string>

namespace stuff {

class Config;

class SenderClient {
public:
    class Error {
    public:
        virtual ~Error() {}

        virtual void error(const std::string& message) = 0;
        virtual void error(const std::string& message, int error) = 0;

    protected:
        Error() {}
    };

    virtual ~SenderClient() {}

    virtual void send(const std::string& channel,
                      const std::string& message) = 0;

    static std::unique_ptr<SenderClient> create(
            const Config* config, std::shared_ptr<Error> error = nullptr);

protected:
    SenderClient() {}

private:
    SenderClient(const SenderClient&) = delete;
    SenderClient& operator=(const SenderClient&) = delete;
};

}  // namespace stuff

#endif /* SENDER_CLIENT_HH */