forked from 107-systems/107-Arduino-Cyphal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PublisherBase.hpp
55 lines (42 loc) · 1.83 KB
/
PublisherBase.hpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* This software is distributed under the terms of the MIT License.
* Copyright (c) 2020-2023 LXRobotics.
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com>
* Contributors: https://github.com/107-systems/107-Arduino-Cyphal/graphs/contributors.
*/
#ifndef INC_107_ARDUINO_CYPHAL_PUBLISHER_BASE_H
#define INC_107_ARDUINO_CYPHAL_PUBLISHER_BASE_H
/**************************************************************************************
* INCLUDE
**************************************************************************************/
#include <memory>
/**************************************************************************************
* NAMESPACE
**************************************************************************************/
namespace impl
{
/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/
template <typename T>
class PublisherBase
{
public:
PublisherBase() { }
virtual ~PublisherBase() { }
PublisherBase(PublisherBase const &) = delete;
PublisherBase(PublisherBase &&) = delete;
PublisherBase &operator=(PublisherBase const &) = delete;
PublisherBase &operator=(PublisherBase &&) = delete;
virtual bool publish(T const & msg) = 0;
};
/**************************************************************************************
* NAMESPACE
**************************************************************************************/
} /* impl */
/**************************************************************************************
* TYPEDEF
**************************************************************************************/
template <typename T>
using Publisher = std::shared_ptr<impl::PublisherBase<T>>;
#endif /* INC_107_ARDUINO_CYPHAL_PUBLISHER_BASE_H */