3#include <boost/intrusive_ptr.hpp>
19 struct Deleter {
Deleter(
bool owner =
true) : owner(owner) { }
void operator()(
BrokerKey const* ptr)
const {
if (owner)
delete ptr; }
bool owner; };
20 using unique_ptr = std::unique_ptr<BrokerKey, Deleter>;
21 using const_unique_ptr = std::unique_ptr<BrokerKey const, Deleter>;
25 virtual uint64_t hash()
const = 0;
26 virtual void initialize(boost::intrusive_ptr<AIStatefulTask> task)
const = 0;
27 virtual unique_ptr copy()
const = 0;
29 virtual void print_on(std::ostream& os)
const = 0;
30 friend std::ostream&
operator<<(std::ostream& os,
BrokerKey const& data) { data.print_on(os);
return os; }
34 bool equal_to(
BrokerKey const& other)
const {
return typeid(*this) ==
typeid(other) && equal_to_impl(other); }
35 unique_ptr non_owning_ptr() {
return unique_ptr(
this,
false); }
36 const_unique_ptr non_owning_ptr()
const {
return const_unique_ptr(
this,
false); }
39 virtual bool equal_to_impl(BrokerKey
const&)
const = 0;
44 uint64_t operator()(BrokerKey::unique_ptr
const& ptr)
const {
return ptr->hash(); }
49 bool operator()(BrokerKey::unique_ptr
const& left, BrokerKey::unique_ptr
const& right)
const {
return left->equal_to(*right); }
std::ostream & operator<<(std::ostream &os, AIStatefulTask::Handler const &handler)
Write a Handler to an ostream.
Definition: AIStatefulTask.cxx:1118
Definition: AIStatefulTask.h:96
Definition: BrokerKey.h:17
Tasks defined by the library project are put into this namespace.
Definition: AIStatefulTask.h:857
Definition: BrokerKey.h:48
Definition: BrokerKey.h:43
Definition: BrokerKey.h:19