Template Numerical Library: TNL::Pointers::DevicePointer< Object, Devices::Host > Class Template Reference

Template Numerical Library version\ main:c7077e4fd

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Attributes | List of all members
TNL::Pointers::DevicePointer< Object, Devices::Host > Class Template Reference

Specialization of the DevicePointer for the host system. More...

`#include <TNL/Pointers/DevicePointer.h>`

Inheritance diagram for TNL::Pointers::DevicePointer< Object, Devices::Host >:
[legend]
Collaboration diagram for TNL::Pointers::DevicePointer< Object, Devices::Host >:
[legend]

## Public Types
using | DeviceType = Devices::Host
| Type of the device where the object is to be mirrored.
using | ObjectType = Object
| Type of the object owned by the pointer.

## Public Member Functions
| DevicePointer (const DevicePointer &pointer)
| Copy constructor.
template<typename Object_, typename = Enabler< Object_ >>
| DevicePointer (const DevicePointer< Object_, DeviceType > &pointer)
| Copy constructor.
| DevicePointer (DevicePointer &&pointer) noexcept
| Move constructor.
template<typename Object_, typename = Enabler< Object_ >>
| DevicePointer (DevicePointer< Object_, DeviceType > &&pointer)
| Move constructor.
| DevicePointer (ObjectType &obj)
| Constructor with an object reference.
| DevicePointer (std::nullptr_t)
| Constructor of an empty pointer.
| ~DevicePointer () override=default
| Destructor.
template<typename Device = Devices::Host>
__cuda_callable__ const Object & | getData () const
| Constant object reference getter.
template<typename Device = Devices::Host>
__cuda_callable__ Object & | modifyData ()
| Non-constant object reference getter.
__cuda_callable__ | operator bool () const
| Conversion to boolean type.
__cuda_callable__ bool | operator! () const
| Negation operator.
Object & | operator* ()
| Dereferencing operator for accessing the object owned by non-constant smart pointer.
const Object & | operator* () const
| Dereferencing operator for accessing the object owned by constant smart pointer.
Object * | operator-> ()
| Arrow operator for accessing the object owned by non-constant smart pointer.
const Object * | operator-> () const
| Arrow operator for accessing the object owned by constant smart pointer.
const DevicePointer & | operator= (const DevicePointer &ptr)
| Assignment operator.
template<typename Object_, typename = Enabler< Object_ >>
const DevicePointer & | operator= (const DevicePointer< Object_, DeviceType > &ptr)
| Assignment operator for compatible object types.
const DevicePointer & | operator= (DevicePointer &&ptr) noexcept
| Move operator.
template<typename Object_, typename = Enabler< Object_ >>
const DevicePointer & | operator= (DevicePointer< Object_, DeviceType > &&ptr)
| Move operator.
void | swap (DevicePointer &ptr2) noexcept
| Swap the owned object with another pointer.
bool | synchronize () override
| Cross-device pointer synchronization.

## Protected Attributes
Object * | pointer

## Detailed Description

template<typename Object>
class TNL::Pointers::DevicePointer< Object, Devices::Host >

Specialization of the DevicePointer for the host system.

Template Parameters

  Object | is a type of object to be owned by the pointer.

## Constructor & Destructor Documentation

## ◆ DevicePointer() [1/5]

template<typename Object>

TNL::Pointers::DevicePointer< Object, Devices::Host >::DevicePointer | ( | ObjectType & | obj | ) |
| inlineexplicit

Constructor with an object reference.

Parameters

  obj | reference to an object to be managed by the pointer.

## ◆ DevicePointer() [2/5]

template<typename Object>

TNL::Pointers::DevicePointer< Object, Devices::Host >::DevicePointer | ( | const DevicePointer< Object, Devices::Host > & | pointer | ) |
| inline

Copy constructor.

Parameters

  pointer | is the source device pointer.

## ◆ DevicePointer() [3/5]

template<typename Object>
template<typename Object_, typename = Enabler< Object_ >>

TNL::Pointers::DevicePointer< Object, Devices::Host >::DevicePointer | ( | const DevicePointer< Object_, DeviceType > & | pointer | ) |
| inline

Copy constructor.

This is specialization for compatible object types.

Parameters

  pointer | is the source device pointer.

## ◆ DevicePointer() [4/5]

template<typename Object>

TNL::Pointers::DevicePointer< Object, Devices::Host >::DevicePointer | ( | DevicePointer< Object, Devices::Host > && | pointer | ) |
| inlinenoexcept

Move constructor.

Parameters

  pointer | is the source device pointer.

## ◆ DevicePointer() [5/5]

template<typename Object>
template<typename Object_, typename = Enabler< Object_ >>

TNL::Pointers::DevicePointer< Object, Devices::Host >::DevicePointer | ( | DevicePointer< Object_, DeviceType > && | pointer | ) |
| inline

Move constructor.

This is specialization for compatible object types.

Parameters

  pointer | is the source device pointer.

## Member Function Documentation

## ◆ getData()

template<typename Object>
template<typename Device = Devices::Host>

__cuda_callable__ const Object & TNL::Pointers::DevicePointer< Object, Devices::Host >::getData | ( |  | ) | const
| inlinenodiscard

Constant object reference getter.

No synchronization of this pointer will be performed due to calling this method.

Template Parameters

  Device | says what image of the object one want to dereference. It can be either DeviceType or Devices::Host.

Returns
  constant reference to the object image on given device.

## ◆ modifyData()

template<typename Object>
template<typename Device = Devices::Host>

__cuda_callable__ Object & TNL::Pointers::DevicePointer< Object, Devices::Host >::modifyData | ( |  | ) |
| inlinenodiscard

Non-constant object reference getter.

No synchronization of this pointer will be performed due to calling this method.

Template Parameters

  Device | says what image of the object one want to dereference. It can be either DeviceType or Devices::Host.

Returns
  constant reference to the object image on given device.

## ◆ operator bool()

template<typename Object>

__cuda_callable__ TNL::Pointers::DevicePointer< Object, Devices::Host >::operator bool | ( |  | ) | const
| inline

Conversion to boolean type.

Returns
  Returns true if the pointer is not empty, false otherwise.

## ◆ operator!()

template<typename Object>

__cuda_callable__ bool TNL::Pointers::DevicePointer< Object, Devices::Host >::operator! | ( |  | ) | const
| inline

Negation operator.

Returns
  Returns false if the pointer is not empty, true otherwise.

## ◆ operator*() [1/2]

template<typename Object>

Object & TNL::Pointers::DevicePointer< Object, Devices::Host >::operator* | ( |  | ) |
| inline

Dereferencing operator for accessing the object owned by non-constant smart pointer.

Returns
  reference to the object owned by this smart pointer.

## ◆ operator*() [2/2]

template<typename Object>

const Object & TNL::Pointers::DevicePointer< Object, Devices::Host >::operator* | ( |  | ) | const
| inline

Dereferencing operator for accessing the object owned by constant smart pointer.

Returns
  constant reference to the object owned by this smart pointer.

## ◆ operator->() [1/2]

template<typename Object>

Object * TNL::Pointers::DevicePointer< Object, Devices::Host >::operator-> | ( |  | ) |
| inline

Arrow operator for accessing the object owned by non-constant smart pointer.

Returns
  pointer to the object owned by this smart pointer.

## ◆ operator->() [2/2]

template<typename Object>

const Object * TNL::Pointers::DevicePointer< Object, Devices::Host >::operator-> | ( |  | ) | const
| inline

Arrow operator for accessing the object owned by constant smart pointer.

Returns
  constant pointer to the object owned by this smart pointer.

## ◆ operator=() [1/4]

template<typename Object>

const DevicePointer & TNL::Pointers::DevicePointer< Object, Devices::Host >::operator= | ( | const DevicePointer< Object, Devices::Host > & | ptr | ) |
| inline

Assignment operator.

It assigns object owned by the pointer ptr to this pointer.

Parameters

  ptr | input pointer

Returns
  constant reference to this

## ◆ operator=() [2/4]

template<typename Object>
template<typename Object_, typename = Enabler< Object_ >>

const DevicePointer & TNL::Pointers::DevicePointer< Object, Devices::Host >::operator= | ( | const DevicePointer< Object_, DeviceType > & | ptr | ) |
| inline

Assignment operator for compatible object types.

It assigns object owned by the pointer ptr to this pointer.

Parameters

  ptr | input pointer

Returns
  constant reference to this

## ◆ operator=() [3/4]

template<typename Object>

const DevicePointer & TNL::Pointers::DevicePointer< Object, Devices::Host >::operator= | ( | DevicePointer< Object, Devices::Host > && | ptr | ) |
| inlinenoexcept

Move operator.

It assigns object owned by the pointer ptr to this pointer.

Parameters

  ptr | input pointer

Returns
  constant reference to this

## ◆ operator=() [4/4]

template<typename Object>
template<typename Object_, typename = Enabler< Object_ >>

const DevicePointer & TNL::Pointers::DevicePointer< Object, Devices::Host >::operator= | ( | DevicePointer< Object_, DeviceType > && | ptr | ) |
| inline

Move operator.

It assigns object owned by the pointer ptr to this pointer.

Parameters

  ptr | input pointer

Returns
  constant reference to this

## ◆ swap()

template<typename Object>

void TNL::Pointers::DevicePointer< Object, Devices::Host >::swap | ( | DevicePointer< Object, Devices::Host > & | ptr2 | ) |
| inlinenoexcept

Swap the owned object with another pointer.

Parameters

  ptr2 | the other device pointer for swapping.

## ◆ synchronize()

template<typename Object>

bool TNL::Pointers::DevicePointer< Object, Devices::Host >::synchronize | ( |  | ) |
| inlineoverridevirtual

Cross-device pointer synchronization.

For the smart pointers on the host, this method does nothing.

Returns
  true.

Implements TNL::Pointers::SmartPointer.

The documentation for this class was generated from the following file:

- src/TNL/Pointers/DevicePointer.h