Minor improvements.

This commit is contained in:
levlam 2022-10-01 23:48:03 +03:00
parent d4d365d31f
commit 49e840aae5
2 changed files with 7 additions and 2 deletions

View File

@ -50,6 +50,7 @@ class ActorId {
}
ActorInfo *get_actor_info() const;
ActorType *get_actor_unsafe() const;
Slice get_name() const;
@ -63,8 +64,7 @@ class ActorId {
ObjectPool<ActorInfo>::WeakPtr ptr_;
};
// threat ActorId as pointer and ActorOwn as
// unique_ptr<ActorId>
// treat ActorId as pointer and ActorOwn as unique_ptr<ActorId>
template <class ActorType = Actor>
class ActorOwn {
public:

View File

@ -170,19 +170,24 @@ void ActorShared<ActorType>::reset(ActorId<ActorType> other) {
template <class T>
ActorRef::ActorRef(const ActorId<T> &actor_id) : actor_id_(actor_id) {
}
template <class T>
ActorRef::ActorRef(ActorId<T> &&actor_id) : actor_id_(actor_id) {
actor_id.clear();
}
template <class T>
ActorRef::ActorRef(const ActorShared<T> &actor_id) : actor_id_(actor_id.get()), token_(actor_id.token()) {
}
template <class T>
ActorRef::ActorRef(ActorShared<T> &&actor_id) : actor_id_(actor_id.release()), token_(actor_id.token()) {
}
template <class T>
ActorRef::ActorRef(const ActorOwn<T> &actor_id) : actor_id_(actor_id.get()) {
}
template <class T>
ActorRef::ActorRef(ActorOwn<T> &&actor_id) : actor_id_(actor_id.release()) {
}