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_scalaroperator= (string_scalar const &other)=delete
 
string_scalaroperator= (string_scalar &&other)=delete
 
 string_scalar (string_scalar const &other, 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 by deep copying another string_scalar. More...
 
 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. 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. More...
 
 string_scalar (rmm::device_buffer &&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 by moving an existing string data buffer. More...
 
 operator std::string () const
 Explicit 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
scalaroperator= (scalar const &other)=delete
 
scalaroperator= (scalar &&other)=delete
 
data_type type () const noexcept
 Returns the scalar's logical value type.
 
void set_valid_async (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 (scalar &&other)=default
 
 scalar (scalar const &other, 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 by deep copying another. More...
 
 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 390 of file scalar.hpp.

Constructor & Destructor Documentation

◆ string_scalar() [1/5]

cudf::string_scalar::string_scalar ( string_scalar const &  other,
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 by deep copying another string_scalar.

Parameters
otherThe other string_scalar to copy.
streamCUDA stream used for device memory operations.
mrDevice memory resource to use for device memory allocation.

◆ string_scalar() [2/5]

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() 
)

Construct a new string scalar object.

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

◆ string_scalar() [3/5]

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
sourceThe string_view pointing the string value to copy.
is_validWhether the value held by the scalar is valid.
streamCUDA stream used for device memory operations.
mrDevice memory resource to use for device memory allocation.

◆ string_scalar() [4/5]

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
dataThe device_scalar of string_view pointing to the string value to copy.
is_validWhether the value held by the scalar is valid.
streamCUDA stream used for device memory operations.
mrDevice memory resource to use for device memory allocation.

◆ string_scalar() [5/5]

cudf::string_scalar::string_scalar ( rmm::device_buffer &&  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 by moving an existing string data buffer.

Note that this constructor moves the existing buffer into the internal data buffer; no copy is performed.

Parameters
dataThe existing buffer to take over.
is_validWhether the value held by the scalar is valid.
streamCUDA stream used for device memory operations.
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: