CUBRID Engine  latest
cubpacking::packer Class Reference

#include <packer.hpp>

Collaboration diagram for cubpacking::packer:
Collaboration graph

Public Member Functions

 packer ()
 
 packer (char *storage, const size_t amount)
 
void set_buffer (char *storage, const size_t amount)
 
size_t get_packed_int_size (size_t curr_offset)
 
void pack_int (const int value)
 
size_t get_packed_size_overloaded (int value, size_t curr_offset)
 
void pack_overloaded (int value)
 
size_t get_packed_bool_size (size_t curr_offset)
 
void pack_bool (bool value)
 
size_t get_packed_size_overloaded (bool value, size_t curr_offset)
 
void pack_overloaded (bool value)
 
size_t get_packed_short_size (size_t curr_offset)
 
void pack_short (const short value)
 
size_t get_packed_size_overloaded (short value, size_t curr_offset)
 
void pack_overloaded (short value)
 
size_t get_packed_bigint_size (size_t curr_offset)
 
void pack_bigint (const std::int64_t &value)
 
void pack_bigint (const std::uint64_t &value)
 
size_t get_packed_size_overloaded (const std::int64_t &value, size_t curr_offset)
 
size_t get_packed_size_overloaded (const std::uint64_t &value, size_t curr_offset)
 
void pack_overloaded (const std::int64_t &value)
 
void pack_overloaded (const std::uint64_t &value)
 
void pack_int_array (const int *array, const int count)
 
size_t get_packed_int_vector_size (size_t curr_offset, const size_t count)
 
void pack_int_vector (const std::vector< int > &array)
 
size_t get_packed_db_value_size (const db_value &value, size_t curr_offset)
 
void pack_db_value (const db_value &value)
 
size_t get_packed_size_overloaded (const db_value &value, size_t curr_offset)
 
void pack_overloaded (const db_value &value)
 
size_t get_packed_small_string_size (const char *string, const size_t curr_offset)
 
void pack_small_string (const char *string, const size_t str_size=0)
 
size_t get_packed_large_string_size (const std::string &str, const size_t curr_offset)
 
void pack_large_string (const std::string &str)
 
size_t get_packed_string_size (const std::string &str, const size_t curr_offset)
 
void pack_string (const std::string &str)
 
size_t get_packed_size_overloaded (const std::string &value, size_t curr_offset)
 
void pack_overloaded (const std::string &str)
 
size_t get_packed_c_string_size (const char *str, const size_t str_size, const size_t curr_offset)
 
void pack_c_string (const char *str, const size_t str_size)
 
size_t get_packed_size_overloaded (const packable_object &po, size_t curr_offset)
 
void pack_overloaded (const packable_object &po)
 
size_t get_packed_oid_size (const size_t curr_offset)
 
void pack_oid (const OID &oid)
 
size_t get_packed_size_overloaded (const OID &oid, size_t curr_offset)
 
void pack_overloaded (const OID &oid)
 
void delegate_to_or_buf (const size_t size, or_buf &buf)
 
const char * get_curr_ptr (void)
 
size_t get_current_size (void)
 
void align (const size_t req_alignment)
 
const char * get_buffer_start (void)
 
const char * get_buffer_end (void)
 
bool is_ended (void)
 
std::size_t get_packed_buffer_size (const char *stream, const std::size_t length, const std::size_t curr_offset) const
 
void pack_buffer_with_length (const char *stream, const std::size_t length)
 
template<typename T >
void pack_to_int (const T &t)
 
template<typename... Args>
size_t get_all_packed_size (Args &&...args)
 
template<typename... Args>
size_t get_all_packed_size_starting_offset (size_t start_offset, Args &&...args)
 
template<typename... Args>
void pack_all (Args &&...args)
 
template<typename ExtBlk , typename... Args>
void set_buffer_and_pack_all (ExtBlk &eb, Args &&...args)
 
template<typename ExtBlk , typename... Args>
void append_to_buffer_and_pack_all (ExtBlk &eb, Args &&...args)
 

Private Member Functions

void pack_large_c_string (const char *string, const size_t str_size)
 
template<typename T , typename... Args>
size_t get_all_packed_size_recursive (size_t curr_offset, T &&t, Args &&...args)
 
template<typename T >
size_t get_all_packed_size_recursive (size_t curr_offset, T &&t)
 
template<typename T , typename... Args>
void pack_all_recursive (T &&t, Args &&...args)
 
template<typename T >
void pack_all_recursive (T &&t)
 

Private Attributes

const char * m_start_ptr
 
const char * m_end_ptr
 
char * m_ptr
 

Detailed Description

Definition at line 50 of file packer.hpp.

Constructor & Destructor Documentation

cubpacking::packer::packer ( void  )

Definition at line 63 of file packer.cpp.

cubpacking::packer::packer ( char *  storage,
const size_t  amount 
)

Definition at line 68 of file packer.cpp.

References set_buffer().

Member Function Documentation

template<typename ExtBlk , typename... Args>
void cubpacking::packer::append_to_buffer_and_pack_all ( ExtBlk &  eb,
Args &&...  args 
)
void cubpacking::packer::delegate_to_or_buf ( const size_t  size,
or_buf buf 
)

Definition at line 922 of file packer.cpp.

References cubpacking::check_range(), m_end_ptr, m_ptr, and OR_BUF_INIT.

template<typename... Args>
size_t cubpacking::packer::get_all_packed_size ( Args &&...  args)

Definition at line 289 of file packer.hpp.

References get_all_packed_size_recursive().

Referenced by append_to_buffer_and_pack_all(), clientids::get_packed_size(), boot_client_credential::get_packed_size(), and set_buffer_and_pack_all().

Here is the caller graph for this function:

template<typename T , typename... Args>
size_t cubpacking::packer::get_all_packed_size_recursive ( size_t  curr_offset,
T &&  t,
Args &&...  args 
)
private

Definition at line 311 of file packer.hpp.

References get_packed_size_overloaded().

Referenced by get_all_packed_size(), and get_all_packed_size_starting_offset().

Here is the caller graph for this function:

template<typename T >
size_t cubpacking::packer::get_all_packed_size_recursive ( size_t  curr_offset,
T &&  t 
)
private

Definition at line 304 of file packer.hpp.

References get_packed_size_overloaded().

template<typename... Args>
size_t cubpacking::packer::get_all_packed_size_starting_offset ( size_t  start_offset,
Args &&...  args 
)

Definition at line 296 of file packer.hpp.

References get_all_packed_size_recursive().

const char * cubpacking::packer::get_buffer_end ( void  )

Definition at line 954 of file packer.cpp.

References m_end_ptr.

Referenced by is_ended(), and cubpacking::unpacker::is_ended().

Here is the caller graph for this function:

const char * cubpacking::packer::get_buffer_start ( void  )

Definition at line 948 of file packer.cpp.

References m_start_ptr.

Referenced by append_to_buffer_and_pack_all(), get_current_size(), and cubpacking::unpacker::get_current_size().

Here is the caller graph for this function:

const char * cubpacking::packer::get_curr_ptr ( void  )

Definition at line 930 of file packer.cpp.

References m_ptr.

Referenced by append_to_buffer_and_pack_all(), get_current_size(), cubpacking::unpacker::get_current_size(), is_ended(), and cubpacking::unpacker::is_ended().

Here is the caller graph for this function:

size_t cubpacking::packer::get_current_size ( void  )

Definition at line 936 of file packer.cpp.

References get_buffer_start(), and get_curr_ptr().

Referenced by boot_register_client(), loaddb_init(), loaddb_install_class(), loaddb_load_batch(), sloaddb_fetch_status(), and sloaddb_load_batch().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_bigint_size ( size_t  curr_offset)
size_t cubpacking::packer::get_packed_bool_size ( size_t  curr_offset)

Definition at line 148 of file packer.cpp.

References get_packed_int_size().

Referenced by cubload::load_args::get_packed_size(), cubload::load_status::get_packed_size(), and get_packed_size_overloaded().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_buffer_size ( const char *  stream,
const std::size_t  length,
const std::size_t  curr_offset 
) const

Definition at line 851 of file packer.cpp.

References DB_ALIGN, INT_ALIGNMENT, NULL, and OR_INT_SIZE.

Referenced by record_descriptor::get_packed_size().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_c_string_size ( const char *  str,
const size_t  str_size,
const size_t  curr_offset 
)

Definition at line 650 of file packer.cpp.

References DB_ALIGN, INT_ALIGNMENT, MAX_SMALL_STRING_SIZE, OR_BYTE_SIZE, and OR_INT_SIZE.

Referenced by get_packed_string_size().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_db_value_size ( const db_value value,
size_t  curr_offset 
)

Definition at line 394 of file packer.cpp.

References DB_ALIGN, MAX_ALIGNMENT, and or_packed_value_size().

Referenced by get_packed_size_overloaded().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_int_size ( size_t  curr_offset)
size_t cubpacking::packer::get_packed_int_vector_size ( size_t  curr_offset,
const size_t  count 
)

Definition at line 351 of file packer.cpp.

References DB_ALIGN, INT_ALIGNMENT, and OR_INT_SIZE.

size_t cubpacking::packer::get_packed_large_string_size ( const std::string &  str,
const size_t  curr_offset 
)

Definition at line 529 of file packer.cpp.

References DB_ALIGN, INT_ALIGNMENT, and OR_INT_SIZE.

size_t cubpacking::packer::get_packed_oid_size ( const size_t  curr_offset)

Definition at line 771 of file packer.cpp.

References DB_ALIGN, INT_ALIGNMENT, and OR_OID_SIZE.

Referenced by get_packed_size_overloaded().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_short_size ( size_t  curr_offset)

Definition at line 187 of file packer.cpp.

References DB_ALIGN, OR_SHORT_SIZE, and SHORT_ALIGNMENT.

Referenced by record_descriptor::get_packed_size(), and get_packed_size_overloaded().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_size_overloaded ( int  value,
size_t  curr_offset 
)

Definition at line 111 of file packer.cpp.

References get_packed_int_size().

Referenced by get_all_packed_size_recursive().

Here is the caller graph for this function:

size_t cubpacking::packer::get_packed_size_overloaded ( bool  value,
size_t  curr_offset 
)

Definition at line 160 of file packer.cpp.

References get_packed_bool_size().

size_t cubpacking::packer::get_packed_size_overloaded ( short  value,
size_t  curr_offset 
)

Definition at line 203 of file packer.cpp.

References get_packed_short_size().

size_t cubpacking::packer::get_packed_size_overloaded ( const std::int64_t &  value,
size_t  curr_offset 
)

Definition at line 267 of file packer.cpp.

References get_packed_bigint_size().

size_t cubpacking::packer::get_packed_size_overloaded ( const std::uint64_t &  value,
size_t  curr_offset 
)

Definition at line 273 of file packer.cpp.

References get_packed_bigint_size().

size_t cubpacking::packer::get_packed_size_overloaded ( const db_value value,
size_t  curr_offset 
)

Definition at line 420 of file packer.cpp.

References get_packed_db_value_size().

size_t cubpacking::packer::get_packed_size_overloaded ( const std::string &  value,
size_t  curr_offset 
)

Definition at line 607 of file packer.cpp.

References get_packed_string_size().

size_t cubpacking::packer::get_packed_size_overloaded ( const packable_object po,
size_t  curr_offset 
)
size_t cubpacking::packer::get_packed_size_overloaded ( const OID oid,
size_t  curr_offset 
)

Definition at line 787 of file packer.cpp.

References get_packed_oid_size().

size_t cubpacking::packer::get_packed_small_string_size ( const char *  string,
const size_t  curr_offset 
)

Definition at line 453 of file packer.cpp.

References DB_ALIGN, INT_ALIGNMENT, OR_BYTE_SIZE, and strlen.

size_t cubpacking::packer::get_packed_string_size ( const std::string &  str,
const size_t  curr_offset 
)

Definition at line 593 of file packer.cpp.

References get_packed_c_string_size().

Referenced by cubload::batch::get_packed_size(), cubload::load_args::get_packed_size(), cubload::stats::get_packed_size(), and get_packed_size_overloaded().

Here is the caller graph for this function:

bool cubpacking::packer::is_ended ( void  )

Definition at line 960 of file packer.cpp.

References get_buffer_end(), and get_curr_ptr().

template<typename... Args>
void cubpacking::packer::pack_all ( Args &&...  args)

Definition at line 319 of file packer.hpp.

References pack_all_recursive().

Referenced by append_to_buffer_and_pack_all(), clientids::pack(), boot_client_credential::pack(), pack_all_recursive(), and set_buffer_and_pack_all().

Here is the caller graph for this function:

template<typename T , typename... Args>
void cubpacking::packer::pack_all_recursive ( T &&  t,
Args &&...  args 
)
private

Definition at line 333 of file packer.hpp.

References pack_all(), and pack_overloaded().

Referenced by pack_all().

Here is the caller graph for this function:

template<typename T >
void cubpacking::packer::pack_all_recursive ( T &&  t)
private

Definition at line 326 of file packer.hpp.

References pack_overloaded().

void cubpacking::packer::pack_bigint ( const std::int64_t &  value)
void cubpacking::packer::pack_bigint ( const std::uint64_t &  value)
void cubpacking::packer::pack_bool ( bool  value)

Definition at line 154 of file packer.cpp.

References pack_int().

Referenced by cubload::load_args::pack(), cubload::load_status::pack(), and pack_overloaded().

Here is the caller graph for this function:

void cubpacking::packer::pack_buffer_with_length ( const char *  stream,
const std::size_t  length 
)

Definition at line 866 of file packer.cpp.

References align(), cubpacking::check_range(), INT_ALIGNMENT, m_end_ptr, m_ptr, OR_INT_SIZE, and OR_PUT_INT.

Referenced by record_descriptor::pack().

Here is the caller graph for this function:

void cubpacking::packer::pack_c_string ( const char *  str,
const size_t  str_size 
)

Definition at line 667 of file packer.cpp.

References cubpacking::check_range(), LARGE_STRING_CODE, m_end_ptr, m_ptr, MAX_SMALL_STRING_SIZE, OR_INT_SIZE, OR_PUT_BYTE, pack_large_c_string(), and pack_small_string().

Referenced by pack_small_string(), and pack_string().

Here is the caller graph for this function:

void cubpacking::packer::pack_db_value ( const db_value value)

Definition at line 403 of file packer.cpp.

References align(), assert, cubpacking::check_range(), m_end_ptr, m_ptr, MAX_ALIGNMENT, or_pack_value(), and or_packed_value_size().

Referenced by pack_overloaded().

Here is the caller graph for this function:

void cubpacking::packer::pack_int ( const int  value)
void cubpacking::packer::pack_int_array ( const int *  array,
const int  count 
)
void cubpacking::packer::pack_int_vector ( const std::vector< int > &  array)
void cubpacking::packer::pack_large_c_string ( const char *  string,
const size_t  str_size 
)
private

Definition at line 539 of file packer.cpp.

References align(), cubpacking::check_range(), INT_ALIGNMENT, m_end_ptr, m_ptr, OR_INT_SIZE, OR_PUT_INT, and strlen.

Referenced by pack_c_string(), and pack_large_string().

Here is the caller graph for this function:

void cubpacking::packer::pack_large_string ( const std::string &  str)

Definition at line 565 of file packer.cpp.

References pack_large_c_string().

void cubpacking::packer::pack_oid ( const OID oid)

Definition at line 777 of file packer.cpp.

References align(), cubpacking::check_range(), INT_ALIGNMENT, m_end_ptr, m_ptr, OR_OID_SIZE, and OR_PUT_OID.

Referenced by pack_overloaded().

Here is the caller graph for this function:

void cubpacking::packer::pack_overloaded ( int  value)

Definition at line 117 of file packer.cpp.

References pack_int().

Referenced by pack_all_recursive().

Here is the caller graph for this function:

void cubpacking::packer::pack_overloaded ( bool  value)

Definition at line 166 of file packer.cpp.

References pack_bool().

void cubpacking::packer::pack_overloaded ( short  value)

Definition at line 209 of file packer.cpp.

References pack_short().

void cubpacking::packer::pack_overloaded ( const std::int64_t &  value)

Definition at line 279 of file packer.cpp.

References pack_bigint().

void cubpacking::packer::pack_overloaded ( const std::uint64_t &  value)

Definition at line 285 of file packer.cpp.

References pack_bigint().

void cubpacking::packer::pack_overloaded ( const db_value value)

Definition at line 426 of file packer.cpp.

References pack_db_value().

void cubpacking::packer::pack_overloaded ( const std::string &  str)

Definition at line 613 of file packer.cpp.

References pack_string().

void cubpacking::packer::pack_overloaded ( const packable_object po)

Definition at line 759 of file packer.cpp.

References cubpacking::packable_object::pack().

void cubpacking::packer::pack_overloaded ( const OID oid)

Definition at line 793 of file packer.cpp.

References pack_oid().

void cubpacking::packer::pack_short ( const short  value)

Definition at line 193 of file packer.cpp.

References align(), cubpacking::check_range(), m_end_ptr, m_ptr, OR_PUT_SHORT, OR_SHORT_SIZE, and SHORT_ALIGNMENT.

Referenced by record_descriptor::pack(), and pack_overloaded().

Here is the caller graph for this function:

void cubpacking::packer::pack_small_string ( const char *  string,
const size_t  str_size = 0 
)

Definition at line 463 of file packer.cpp.

References align(), assert, cubpacking::check_range(), INT_ALIGNMENT, m_end_ptr, m_ptr, MAX_SMALL_STRING_SIZE, OR_BYTE_SIZE, OR_PUT_BYTE, pack_c_string(), and strlen.

Referenced by pack_c_string().

Here is the caller graph for this function:

void cubpacking::packer::pack_string ( const std::string &  str)

Definition at line 599 of file packer.cpp.

References pack_c_string().

Referenced by cubload::batch::pack(), cubload::load_args::pack(), cubload::stats::pack(), and pack_overloaded().

Here is the caller graph for this function:

template<typename T >
void cubpacking::packer::pack_to_int ( const T &  t)

Definition at line 282 of file packer.hpp.

References pack_int().

void cubpacking::packer::set_buffer ( char *  storage,
const size_t  amount 
)

Definition at line 74 of file packer.cpp.

References m_end_ptr, m_ptr, and m_start_ptr.

Referenced by packer(), set_buffer_and_pack_all(), and cubpacking::unpacker::unpacker().

Here is the caller graph for this function:

template<typename ExtBlk , typename... Args>
void cubpacking::packer::set_buffer_and_pack_all ( ExtBlk &  eb,
Args &&...  args 
)

Member Data Documentation

const char* cubpacking::packer::m_start_ptr
private

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