Remove unused Event::clone method.

This commit is contained in:
levlam 2022-07-17 10:41:17 +03:00
parent 72bc285637
commit 04a7583bd0
2 changed files with 0 additions and 38 deletions

View File

@ -49,7 +49,6 @@ class CustomEvent {
virtual ~CustomEvent() = default;
virtual void run(Actor *actor) = 0;
virtual CustomEvent *clone() const = 0;
virtual void start_migrate(int32 sched_id) {
}
virtual void finish_migrate() {
@ -62,9 +61,6 @@ class ClosureEvent final : public CustomEvent {
void run(Actor *actor) final {
closure_.run(static_cast<typename ClosureT::ActorType *>(actor));
}
CustomEvent *clone() const final {
return new ClosureEvent<ClosureT>(closure_.clone());
}
template <class... ArgsT>
explicit ClosureEvent(ArgsT &&...args) : closure_(std::forward<ArgsT>(args)...) {
}
@ -93,10 +89,6 @@ class LambdaEvent final : public CustomEvent {
void run(Actor *actor) final {
f_();
}
CustomEvent *clone() const final {
LOG(FATAL) << "Not supported";
return nullptr;
}
template <class FromLambdaT, std::enable_if_t<!std::is_same<std::decay_t<FromLambdaT>, LambdaEvent>::value, int> = 0>
explicit LambdaEvent(FromLambdaT &&lambda) : f_(std::forward<FromLambdaT>(lambda)) {
}
@ -181,17 +173,6 @@ class Event {
destroy();
}
Event clone() const {
Event res;
res.type = type;
if (type == Type::Custom) {
res.data.custom_event = data.custom_event->clone();
} else {
res.data = data;
}
return res;
}
bool empty() const {
return type == Type::NoType;
}

View File

@ -94,10 +94,6 @@ class DelayedClosure {
using ActorType = ActorT;
using Delayed = DelayedClosure<ActorT, FunctionT, ArgsT...>;
DelayedClosure clone() const {
return do_clone(*this);
}
explicit DelayedClosure(ImmediateClosure<ActorT, FunctionT, ArgsT...> &&other) : args(std::move(other.args)) {
}
@ -128,21 +124,6 @@ class DelayedClosure {
std::abort();
}
template <class FromActorT, class FromFunctionT, class... FromArgsT>
std::enable_if_t<!LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value,
DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>>
do_clone(const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &value) const {
LOG(FATAL) << "Trying to clone DelayedClosure that contains noncopyable elements";
std::abort();
}
template <class FromActorT, class FromFunctionT, class... FromArgsT>
std::enable_if_t<LogicAnd<std::is_copy_constructible<FromArgsT>::value...>::value,
DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>>
do_clone(const DelayedClosure<FromActorT, FromFunctionT, FromArgsT...> &value) const {
return DelayedClosure<FromActorT, FromFunctionT, FromArgsT...>(value);
}
public:
auto run(ActorT *actor) -> decltype(mem_call_tuple(actor, std::move(args))) {
return mem_call_tuple(actor, std::move(args));