15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_POLLING_POLICY_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_POLLING_POLICY_H
18 #include "google/cloud/internal/backoff_policy.h"
19 #include "google/cloud/internal/retry_policy.h"
20 #include "google/cloud/status.h"
21 #include "google/cloud/version.h"
93 template <
typename Retry,
typename Backoff>
97 : retry_prototype_(std::move(retry_policy)),
98 backoff_prototype_(std::move(backoff_policy)),
99 retry_clone_(maybe_deref(retry_prototype_).clone()),
100 backoff_clone_(maybe_deref(backoff_prototype_).clone()) {}
106 backoff_prototype_));
110 return retry_clone_->OnFailure(status);
114 return backoff_clone_->OnCompletion();
119 template <
typename T>
120 T& maybe_deref(T& v) {
123 template <
typename T>
124 T& maybe_deref(std::shared_ptr<T>& v) {
128 Retry retry_prototype_;
129 Backoff backoff_prototype_;
131 std::unique_ptr<internal::RetryPolicy> retry_clone_;
132 std::unique_ptr<internal::BackoffPolicy> backoff_clone_;