From 4f276acdf3f57442c1988fdf58dc229a4e68786b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz> Date: Thu, 22 Jun 2017 21:24:40 +0200 Subject: [PATCH] Added operator!() to smart pointers --- src/TNL/DevicePointer.h | 12 ++++++++++++ src/TNL/SharedPointer.h | 12 ++++++++++++ src/TNL/UniquePointer.h | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/TNL/DevicePointer.h b/src/TNL/DevicePointer.h index fab718cf1d..23aaa54f5e 100644 --- a/src/TNL/DevicePointer.h +++ b/src/TNL/DevicePointer.h @@ -119,6 +119,12 @@ class DevicePointer< Object, Devices::Host > : public SmartPointer return this->pointer; } + __cuda_callable__ + bool operator!() const + { + return ! this->pointer; + } + template< typename Device = Devices::Host > __cuda_callable__ const Object& getData() const @@ -287,6 +293,12 @@ class DevicePointer< Object, Devices::Cuda > : public SmartPointer return this->pd; } + __cuda_callable__ + bool operator!() const + { + return ! this->pd; + } + template< typename Device = Devices::Host > __cuda_callable__ const Object& getData() const diff --git a/src/TNL/SharedPointer.h b/src/TNL/SharedPointer.h index c1a3e06347..addf6ab70c 100644 --- a/src/TNL/SharedPointer.h +++ b/src/TNL/SharedPointer.h @@ -167,6 +167,12 @@ class SharedPointer< Object, Devices::Host > : public SmartPointer return this->pd; } + __cuda_callable__ + bool operator!() const + { + return ! this->pd; + } + template< typename Device = Devices::Host > __cuda_callable__ const Object& getData() const @@ -402,6 +408,12 @@ class SharedPointer< Object, Devices::Cuda > : public SmartPointer return this->pd; } + __cuda_callable__ + bool operator!() const + { + return ! this->pd; + } + template< typename Device = Devices::Host > __cuda_callable__ const Object& getData() const diff --git a/src/TNL/UniquePointer.h b/src/TNL/UniquePointer.h index 01765d51b1..419bb67659 100644 --- a/src/TNL/UniquePointer.h +++ b/src/TNL/UniquePointer.h @@ -67,6 +67,12 @@ class UniquePointer< Object, Devices::Host > : public SmartPointer return this->pointer; } + __cuda_callable__ + bool operator!() const + { + return ! this->pointer; + } + template< typename Device = Devices::Host > const Object& getData() const { @@ -155,6 +161,12 @@ class UniquePointer< Object, Devices::Cuda > : public SmartPointer return this->pd; } + __cuda_callable__ + bool operator!() const + { + return ! this->pd; + } + template< typename Device = Devices::Host > const Object& getData() const { -- GitLab