static_assert(std::is_same<Device,Devices::Host>::value||std::is_same<Device,Devices::Cuda>::value,"Only Devices::Host or Devices::Cuda devices are accepted here.");
Assert(this->pointer,);
Assert(this->cuda_pointer,);
if(std::is_same<Device,Devices::Host>::value)
return*(this->pointer);
if(std::is_same<Device,Devices::Cuda>::value)
return*(this->cuda_pointer);
}
template<typenameDevice=Devices::Host>
__cuda_callable__
Object&modifyData()
{
static_assert(std::is_same<Device,Devices::Host>::value||std::is_same<Device,Devices::Cuda>::value,"Only Devices::Host or Devices::Cuda devices are accepted here.");
Assert(this->pointer,);
Assert(this->cuda_pointer,);
if(std::is_same<Device,Devices::Host>::value)
{
this->modified=true;
return*(this->pointer);
}
if(std::is_same<Device,Devices::Cuda>::value)
{
return*(this->cuda_pointer);
}
}
// this is needed only to avoid the default compiler-generated operator
constThisType&operator=(constThisType&ptr)
{
this->free();
this->pointer=ptr.pointer;
this->cuda_pointer=ptr.cuda_pointer;
this->modified=ptr.modified;
this->counter=ptr.counter;
*(this->counter)+=1;
return*this;
}
// conditional operator for non-const -> const data