X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fbase%2Frefcnt.hh;h=d1663ad7297781acbb901cfc85935608b6026403;hb=2dd699ed3d31b5aee8fbb88948c4ea6083b1c8b0;hp=de589f7c5418ae690712e05e7ac9412668845c68;hpb=4a5b51b516853c9fcaabc44caacdd7e8e93dc0ef;p=gem5.git diff --git a/src/base/refcnt.hh b/src/base/refcnt.hh index de589f7c5..d1663ad72 100644 --- a/src/base/refcnt.hh +++ b/src/base/refcnt.hh @@ -24,12 +24,12 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Nathan Binkert */ -#ifndef __REFCNT_HH__ -#define __REFCNT_HH__ - -#include //For the NULL macro definition +#ifndef __BASE_REFCNT_HH__ +#define __BASE_REFCNT_HH__ class RefCounted { @@ -75,7 +75,7 @@ class RefCountingPtr public: - RefCountingPtr() : data(NULL) {} + RefCountingPtr() : data(0) {} RefCountingPtr(T *data) { copy(data); } RefCountingPtr(const RefCountingPtr &r) { copy(r.data); } ~RefCountingPtr() { del(); } @@ -88,8 +88,8 @@ class RefCountingPtr const T &operator*() const { return *data; } const T *get() const { return data; } - RefCountingPtr &operator=(T *p) { set(p); return *this; } - RefCountingPtr &operator=(const RefCountingPtr &r) + const RefCountingPtr &operator=(T *p) { set(p); return *this; } + const RefCountingPtr &operator=(const RefCountingPtr &r) { return operator=(r.data); } bool operator!() const { return data == 0; } @@ -120,4 +120,4 @@ template bool operator!=(const T &l, const RefCountingPtr &r) { return l != r.get(); } -#endif // __REFCNT_HH__ +#endif // __BASE_REFCNT_HH__