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

View File

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