5#include <Common/assertion.h>
6#include <Common/primitive_type.h>
7#include <Utility/utility.h>
8#include <Utility/traits.h>
27template<
typename Target,
typename Performer = TQueryPerformer<Target>>
33 TQuery(std::shared_ptr<Performer> performer,
EQuery mode);
37 template<CDerived<Performer> DerivedPerformer>
42 template<CDerived<Performer> DerivedPerformer>
50 bool run(Target& target);
69 const Performer&
get()
const;
73 template<CDerived<Performer> DerivedPerformer = Performer,
typename... Args>
77 std::make_shared<DerivedPerformer>(std::forward<Args>(args)...),
EQuery::Once);
80 template<CDerived<Performer> DerivedPerformer = Performer,
typename... Args>
84 std::make_shared<DerivedPerformer>(std::forward<Args>(args)...),
EQuery::AutoRetry);
88 std::shared_ptr<Performer> m_performer;
89 uint32 m_numRetries = 0;
94 template<
typename OtherTarget,
typename OtherPerformer>
98template<
typename Target,
typename Performer>
101 m_performer =
nullptr;
104template<
typename Target,
typename Performer>
107 return m_performer ==
nullptr;
110template<
typename Target,
typename Performer>
114 PH_ASSERT(m_performer);
118template<
typename Target,
typename Performer>
122 PH_ASSERT(m_performer);
126template<
typename Target,
typename Performer>
133template<
typename Target,
typename Performer>
bool isEmpty() const
Definition TQuery.h:105
bool isCanceled() const
Whether the query is canceled.
Definition TQuery.ipp:88
PH_DEFINE_INLINE_RULE_OF_5_MEMBERS_NO_DTOR(TQuery)
void clear()
Clear the underlying query performer. After this call, isEmpty() is true.
Definition TQuery.h:99
friend class TQuery
Definition TQuery.h:95
Performer * operator->()
Definition TQuery.h:127
void cancel()
Cancel the query. Does nothing if isEmpty() is true.
Definition TQuery.ipp:79
bool run(Target &target)
Definition TQuery.ipp:40
const Performer & get() const
Definition TQuery.h:119
static auto autoRetry(Args &&... args) -> TQuery< Target, DerivedPerformer >
Definition TQuery.h:81
Performer & get()
Definition TQuery.h:111
static auto once(Args &&... args) -> TQuery< Target, DerivedPerformer >
Definition TQuery.h:74
Definition ph_editor.h:10
@ AutoRetry
Definition fwd.h:9