Program Listing for File serializer.hpp¶
↰ Return to documentation for file (include/concore/serializer.hpp)
#pragma once
#include "task.hpp"
#include "any_executor.hpp"
#include "except_fun_type.hpp"
#include <memory>
namespace concore {
inline namespace v1 {
class serializer {
public:
explicit serializer(any_executor base_executor = {}, any_executor cont_executor = {});
template <typename F>
void execute(F&& f) const {
do_enqueue(task{std::forward<F>(f)});
}
void execute(task t) const { do_enqueue(std::move(t)); }
void set_exception_handler(except_fun_t except_fun);
friend inline bool operator==(serializer l, serializer r) { return l.impl_ == r.impl_; }
friend inline bool operator!=(serializer l, serializer r) { return !(l == r); }
private:
struct impl;
std::shared_ptr<impl> impl_;
void do_enqueue(task t) const;
};
} // namespace v1
} // namespace concore