-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.hpp
More file actions
41 lines (34 loc) · 1016 Bytes
/
stream.hpp
File metadata and controls
41 lines (34 loc) · 1016 Bytes
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
#ifndef _STREAM_HPP_
#define _STREAM_HPP_
#ifdef __STDC_HOSTED__
#include <utility>
#else
namespace std = hls;
#endif
namespace hls
{
template <typename SinkImpl>
class StreamSink
{
protected:
// Cannot be deleted through a pointer to the base type, thus we avoid a vtable
// By not having to define a virtual destructor
~StreamSink() = default;
public:
auto open_sink()
{
return static_cast<SinkImpl *>(this)->open_sink_impl();
}
template <typename DataType, typename... CtxArgs>
auto receive_data(DataType &&data, CtxArgs &&...ctx_args)
{
return static_cast<SinkImpl *>(this)->receive_data_impl(std::forward<DataType>(data),
std::forward<CtxArgs>(ctx_args)...);
}
auto close_sink()
{
return static_cast<SinkImpl *>(this)->close_sink_impl();
}
};
} // namespace hls
#endif