An owning class to represent a singular value. More...
#include <scalar.hpp>
Public Member Functions | |
scalar & | operator= (scalar const &other)=delete |
scalar & | operator= (scalar &&other)=delete |
data_type | type () const noexcept |
Returns the scalar's logical value type. More... | |
void | set_valid_async (bool is_valid, rmm::cuda_stream_view stream=cudf::get_default_stream()) |
Updates the validity of the value. More... | |
bool | is_valid (rmm::cuda_stream_view stream=cudf::get_default_stream()) const |
Indicates whether the scalar contains a valid value. More... | |
bool * | validity_data () |
Returns a raw pointer to the validity bool in device memory. More... | |
bool const * | validity_data () const |
Return a const raw pointer to the validity bool in device memory. More... | |
Protected Member Functions | |
scalar (scalar &&other)=default | |
Move constructor for scalar. More... | |
scalar (scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) | |
Construct a new scalar object by deep copying another. More... | |
scalar (data_type type, bool is_valid=false, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref()) | |
Construct a new scalar object. More... | |
Protected Attributes | |
data_type | _type {type_id::EMPTY} |
Logical type of value in the scalar. | |
rmm::device_scalar< bool > | _is_valid |
Device bool signifying validity. | |
An owning class to represent a singular value.
A scalar is a singular value of any of the supported datatypes in cudf. Classes derived from this class are used to represent a scalar. Objects of derived classes should be upcasted to this class while passing to an external libcudf API.
Definition at line 48 of file scalar.hpp.
|
protecteddefault |
Move constructor for scalar.
other | The other scalar to move from. |
|
protected |
Construct a new scalar object by deep copying another.
other | The scalar to copy. |
stream | CUDA stream used for device memory operations. |
mr | Device memory resource to use for device memory allocation. |
|
protected |
Construct a new scalar object.
type | Data type of the scalar. |
is_valid | Whether the value held by the scalar is valid. |
stream | CUDA stream used for device memory operations. |
mr | Device memory resource to use for device memory allocation. |
bool cudf::scalar::is_valid | ( | rmm::cuda_stream_view | stream = cudf::get_default_stream() | ) | const |
Indicates whether the scalar contains a valid value.
is_valid() == false
is undefined behavior. In addition, this function does a stream synchronization.stream | CUDA stream used for device memory operations. |
void cudf::scalar::set_valid_async | ( | bool | is_valid, |
rmm::cuda_stream_view | stream = cudf::get_default_stream() |
||
) |
Updates the validity of the value.
is_valid | true: set the value to valid. false: set it to null. |
stream | CUDA stream used for device memory operations. |
|
noexcept |
Returns the scalar's logical value type.
bool* cudf::scalar::validity_data | ( | ) |
Returns a raw pointer to the validity bool in device memory.
bool const* cudf::scalar::validity_data | ( | ) | const |
Return a const raw pointer to the validity bool in device memory.