OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TextEncodingNone Struct Reference

#include <heavydbTypes.h>

Public Member Functions

 TextEncodingNone ()=default
 
 TextEncodingNone (const std::string &str)
 
 operator std::string () const
 
std::string getString () const
 
const char * getCString () const
 
DEVICE ALWAYS_INLINE char & operator[] (const unsigned int index)
 
DEVICE ALWAYS_INLINE bool operator== (const char *rhs) const
 
DEVICE ALWAYS_INLINE bool operator!= (const char *rhs) const
 
DEVICE ALWAYS_INLINE operator char * () const
 
DEVICE ALWAYS_INLINE int64_t size () const
 
DEVICE ALWAYS_INLINE bool isNull () const
 

Public Attributes

char * ptr_
 
int64_t size_
 
int8_t padding
 

Detailed Description

Definition at line 288 of file heavydbTypes.h.

Constructor & Destructor Documentation

TextEncodingNone::TextEncodingNone ( )
default
TextEncodingNone::TextEncodingNone ( const std::string &  str)
inline

Definition at line 297 of file heavydbTypes.h.

References allocate_varlen_buffer(), ptr_, and size_.

297  {
298  size_ = str.length();
299  if (str.empty()) {
300  ptr_ = nullptr;
301  } else {
302  // Memory must be manually released, otherwise leaks can happen.
303  // On UDFs, if it is the return argument, memory is released with
304  // register_buffer_with_executor_rsm
305  ptr_ = reinterpret_cast<char*>(
306  allocate_varlen_buffer((size_ + 1), static_cast<int64_t>(sizeof(char))));
307  strncpy(ptr_, str.c_str(), (size_ + 1));
308  }
309  }
EXTENSION_NOINLINE int8_t * allocate_varlen_buffer(int64_t element_count, int64_t element_size)

+ Here is the call graph for this function:

Member Function Documentation

const char* TextEncodingNone::getCString ( ) const
inline

Definition at line 312 of file heavydbTypes.h.

References ptr_.

312 { return ptr_; }
std::string TextEncodingNone::getString ( ) const
inline
DEVICE ALWAYS_INLINE bool TextEncodingNone::isNull ( ) const
inline

Definition at line 335 of file heavydbTypes.h.

References size_.

Referenced by strtok_to_array(), and strtok_to_array__1().

335 { return size_ == 0; }

+ Here is the caller graph for this function:

DEVICE ALWAYS_INLINE TextEncodingNone::operator char * ( ) const
inline

Definition at line 333 of file heavydbTypes.h.

References ptr_.

333 { return ptr_; }
TextEncodingNone::operator std::string ( ) const
inline

Definition at line 310 of file heavydbTypes.h.

References ptr_, and size_.

310 { return std::string(ptr_, size_); }
DEVICE ALWAYS_INLINE bool TextEncodingNone::operator!= ( const char *  rhs) const
inline

Definition at line 330 of file heavydbTypes.h.

References operator==().

330  {
331  return !(this->operator==(rhs));
332  }
DEVICE ALWAYS_INLINE bool operator==(const char *rhs) const
Definition: heavydbTypes.h:318

+ Here is the call graph for this function:

DEVICE ALWAYS_INLINE bool TextEncodingNone::operator== ( const char *  rhs) const
inline

Definition at line 318 of file heavydbTypes.h.

References ptr_, and size_.

Referenced by operator!=().

318  {
319 #ifdef __CUDACC__
320  for (int i = 0; i < size_; i++) {
321  if (rhs[i] == '\0' || ptr_[i] != rhs[i]) {
322  return false;
323  }
324  }
325  return rhs[size_] == '\0';
326 #else
327  return strcmp(ptr_, rhs) == 0;
328 #endif
329  }

+ Here is the caller graph for this function:

DEVICE ALWAYS_INLINE char& TextEncodingNone::operator[] ( const unsigned int  index)
inline

Definition at line 315 of file heavydbTypes.h.

References ptr_, and size_.

315  {
316  return index < size_ ? ptr_[index] : ptr_[size_ - 1];
317  }
DEVICE ALWAYS_INLINE int64_t TextEncodingNone::size ( ) const
inline

Definition at line 334 of file heavydbTypes.h.

References size_.

Referenced by ct_get_string_chars__template(), ct_hamming_distance(), and text_encoding_none_length().

334 { return size_; }

+ Here is the caller graph for this function:

Member Data Documentation

int8_t TextEncodingNone::padding

Definition at line 293 of file heavydbTypes.h.

char* TextEncodingNone::ptr_
int64_t TextEncodingNone::size_

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