X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2807fde4fd1f59c230d69a934634c5dfb77905f2..31a818b15a9657dd08268d473255481b2a2d197b:/src/mc/remote/RemotePtr.hpp diff --git a/src/mc/remote/RemotePtr.hpp b/src/mc/remote/RemotePtr.hpp index d92eb7a2a5..5d13c42c00 100644 --- a/src/mc/remote/RemotePtr.hpp +++ b/src/mc/remote/RemotePtr.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2008-2017. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2008-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -7,12 +6,7 @@ #ifndef SIMGRID_MC_REMOTE_PTR_HPP #define SIMGRID_MC_REMOTE_PTR_HPP -#include -#include -#include - -#include -#include +#include "src/simix/smx_private.hpp" namespace simgrid { namespace mc { @@ -81,9 +75,10 @@ template class RemotePtr { public: RemotePtr() : address_(0) {} - RemotePtr(std::uint64_t address) : address_(address) {} - RemotePtr(T* address) : address_((std::uintptr_t)address) {} - RemotePtr(Remote p) : RemotePtr(*p.getBuffer()) {} + explicit RemotePtr(std::nullptr_t) : address_(0) {} + explicit RemotePtr(std::uint64_t address) : address_(address) {} + explicit RemotePtr(T* address) : address_((std::uintptr_t)address) {} + explicit RemotePtr(Remote p) : address_((std::uintptr_t)*p.getBuffer()) {} std::uint64_t address() const { return address_; } /** Turn into a local pointer @@ -94,6 +89,11 @@ public: operator bool() const { return address_; } bool operator!() const { return not address_; } operator RemotePtr() const { return RemotePtr(address_); } + RemotePtr& operator=(std::nullptr_t) + { + address_ = 0; + return *this; + } RemotePtr operator+(std::uint64_t n) const { return RemotePtr(address_ + n * sizeof(T)); } RemotePtr operator-(std::uint64_t n) const { return RemotePtr(address_ - n * sizeof(T)); } RemotePtr& operator+=(std::uint64_t n)