| 1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef DEPTHGUIDE_FRAG_BASE_HPP
- #define DEPTHGUIDE_FRAG_BASE_HPP
- #include "../impl_utility.hpp"
- #include <boost/signals2.hpp>
- class frag_base : public data_channel {
- public:
- struct create_config {
- data_channel_type low_channel;
- size_t queue_size = 1; // max incomplete messages in queue, >= 1
- };
- explicit frag_base(create_config conf) {
- low = std::move(conf.low_channel);
- q_size = conf.queue_size;
- low->set_recv_func([this](auto data) { append_data(data); });
- }
- size_t header_size() const override { return 0; }
- using signal_type = boost::signals2::signal<void()>;
- signal_type sig_msg_loss;
- protected:
- data_channel_type low;
- size_t q_size = 0;
- virtual void append_data(const data_type &data) = 0;
- };
- #endif //DEPTHGUIDE_FRAG_BASE_HPP
|