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
 The value type of the string scalar.
 

Public Member Functions

 string_scalar (string_scalar &&other)=default
 Move constructor for string_scalar. More...
 
string_scalaroperator= (string_scalar const &other)=delete
 
string_scalaroperator= (string_scalar &&other)=delete
 
 string_scalar (string_scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref 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=cudf::get_default_stream(), rmm::device_async_resource_ref 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=cudf::get_default_stream(), rmm::device_async_resource_ref 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=cudf::get_default_stream(), rmm::device_async_resource_ref 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=cudf::get_default_stream(), rmm::device_async_resource_ref 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=cudf::get_default_stream()) const
 Get the value of the scalar in a host std::string. More...
 
value_type value (rmm::cuda_stream_view stream=cudf::get_default_stream()) const
 Get the value of the scalar as a string_view. More...
 
size_type size () const
 Returns the size of the string in bytes. More...
 
char const * data () const
 Returns a raw pointer to the string in device memory. More...
 
- 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. 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 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
 Move constructor for scalar. More...
 
 scalar (scalar const &other, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref 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=cudf::get_default_stream(), rmm::device_async_resource_ref 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 431 of file scalar.hpp.

Constructor & Destructor Documentation

◆ string_scalar() [1/6]

cudf::string_scalar::string_scalar ( string_scalar &&  other)
default

Move constructor for string_scalar.

Parameters
otherThe other string_scalar to move from.

◆ string_scalar() [2/6]

cudf::string_scalar::string_scalar ( string_scalar const &  other,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  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() [3/6]

cudf::string_scalar::string_scalar ( std::string const &  string,
bool  is_valid = true,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = rmm::mr::get_current_device_resource() 
)

Construct a new string scalar object.

Exceptions
std::overflow_errorIf the size of the input string exceeds cudf::size_type
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() [4/6]

cudf::string_scalar::string_scalar ( value_type const &  source,
bool  is_valid = true,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  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() [5/6]

cudf::string_scalar::string_scalar ( rmm::device_scalar< value_type > &  data,
bool  is_valid = true,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  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() [6/6]

cudf::string_scalar::string_scalar ( rmm::device_buffer &&  data,
bool  is_valid = true,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  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

◆ data()

char const* cudf::string_scalar::data ( ) const

Returns a raw pointer to the string in device memory.

Returns
a raw pointer to the string in device memory

◆ size()

size_type cudf::string_scalar::size ( ) const

Returns the size of the string in bytes.

Returns
The size of the string in bytes

◆ to_string()

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

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

Parameters
streamCUDA stream used for device memory operations.
Returns
The value of the scalar in a host std::string

◆ value()

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

Get the value of the scalar as a string_view.

Parameters
streamCUDA stream used for device memory operations.
Returns
The value of the scalar as a string_view

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