Public Types | Public Member Functions | Protected Attributes | List of all members
cudf::string_scalar Class Reference

An owning class to represent a string in device memory. More...

#include <scalar.hpp>

Inheritance diagram for cudf::string_scalar:
cudf::scalar

Public Types

using value_type = cudf::string_view
 

Public Member Functions

 string_scalar (string_scalar &&other)=default
 
 string_scalar (string_scalar const &other)=default
 
string_scalaroperator= (string_scalar const &other)=delete
 
string_scalaroperator= (string_scalar &&other)=delete
 
 string_scalar (std::string const &string, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a new string scalar object. More...
 
 string_scalar (value_type const &source, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a new string scalar object from string_view Note that this function copies the data pointed by string_view. More...
 
 string_scalar (rmm::device_scalar< value_type > &data, bool is_valid=true, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a new string scalar object from string_view in device memory Note that this function copies the data pointed by string_view. More...
 
 operator std::string () const
 Implicit conversion operator to get the value of the scalar in a host std::string.
 
std::string to_string (rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
 Get the value of the scalar in a host std::string. More...
 
value_type value (rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
 Get the value of the scalar as a string_view. More...
 
size_type size () const
 Returns the size of the string in bytes.
 
const char * data () const
 Returns a raw pointer to the string in device memory.
 
- Public Member Functions inherited from cudf::scalar
 scalar (scalar &&other)=default
 
 scalar (scalar const &other)=default
 
scalaroperator= (scalar const &other)=delete
 
scalaroperator= (scalar &&other)=delete
 
data_type type () const noexcept
 Returns the scalar's logical value type.
 
void set_valid (bool is_valid, rmm::cuda_stream_view stream=rmm::cuda_stream_default)
 Updates the validity of the value. More...
 
bool is_valid (rmm::cuda_stream_view stream=rmm::cuda_stream_default) const
 Indicates whether the scalar contains a valid value. More...
 
bool * validity_data ()
 Returns a raw pointer to the validity bool in device memory.
 
bool const * validity_data () const
 Returns a const raw pointer to the validity bool in device memory.
 

Protected Attributes

rmm::device_buffer _data {}
 device memory containing the string
 
- Protected Attributes inherited from cudf::scalar
data_type _type {type_id::EMPTY}
 Logical type of value in the scalar.
 
rmm::device_scalar< bool > _is_valid {}
 Device bool signifying validity.
 

Additional Inherited Members

- Protected Member Functions inherited from cudf::scalar
 scalar (data_type type, bool is_valid=false, rmm::cuda_stream_view stream=rmm::cuda_stream_default, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Construct a new scalar object. More...
 

Detailed Description

An owning class to represent a string in device memory.

Definition at line 394 of file scalar.hpp.

Constructor & Destructor Documentation

◆ string_scalar() [1/3]

cudf::string_scalar::string_scalar ( std::string const &  string,
bool  is_valid = true,
rmm::cuda_stream_view  stream = rmm::cuda_stream_default,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)
inline

Construct a new string scalar object.

Parameters
[in]valueThe value of the string
[in]is_validWhether the value held by the scalar is valid
[in]streamCUDA stream used for device memory operations.
[in]mrDevice memory resource to use for device memory allocation

Definition at line 413 of file scalar.hpp.

◆ string_scalar() [2/3]

cudf::string_scalar::string_scalar ( value_type const &  source,
bool  is_valid = true,
rmm::cuda_stream_view  stream = rmm::cuda_stream_default,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Construct a new string scalar object from string_view Note that this function copies the data pointed by string_view.

Parameters
[in]sourcestring_view pointing string value to copy
[in]is_validWhether the value held by the scalar is valid
[in]streamCUDA stream used for device memory operations.
[in]mrDevice memory resource to use for device memory allocation

◆ string_scalar() [3/3]

cudf::string_scalar::string_scalar ( rmm::device_scalar< value_type > &  data,
bool  is_valid = true,
rmm::cuda_stream_view  stream = rmm::cuda_stream_default,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Construct a new string scalar object from string_view in device memory Note that this function copies the data pointed by string_view.

Parameters
[in]datadevice_scalar string_view pointing string value to copy
[in]is_validWhether the value held by the scalar is valid
[in]streamCUDA stream used for device memory operations.
[in]mrDevice memory resource to use for device memory allocation

Member Function Documentation

◆ to_string()

std::string cudf::string_scalar::to_string ( rmm::cuda_stream_view  stream = rmm::cuda_stream_default) const

Get the value of the scalar in a host std::string.

Parameters
streamCUDA stream used for device memory operations.

◆ value()

value_type cudf::string_scalar::value ( rmm::cuda_stream_view  stream = rmm::cuda_stream_default) const

Get the value of the scalar as a string_view.

Parameters
streamCUDA stream used for device memory operations.

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