CUBRID Engine
latest
|
#include <packer.hpp>
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 |
Definition at line 50 of file packer.hpp.
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().
void cubpacking::packer::align | ( | const size_t | req_alignment | ) |
Definition at line 942 of file packer.cpp.
References m_ptr, and PTR_ALIGN.
Referenced by pack_bigint(), pack_buffer_with_length(), pack_db_value(), pack_int(), pack_int_array(), pack_int_vector(), pack_large_c_string(), pack_oid(), pack_short(), pack_small_string(), cubpacking::unpacker::peek_unpack_int(), cubpacking::unpacker::unpack_bigint(), cubpacking::unpacker::unpack_buffer_with_length(), cubpacking::unpacker::unpack_c_string(), cubpacking::unpacker::unpack_db_value(), cubpacking::unpacker::unpack_int(), cubpacking::unpacker::unpack_int_array(), cubpacking::unpacker::unpack_int_vector(), cubpacking::unpacker::unpack_large_string(), cubpacking::unpacker::unpack_oid(), cubpacking::unpacker::unpack_short(), cubpacking::unpacker::unpack_small_string(), cubpacking::unpacker::unpack_string(), cubpacking::unpacker::unpack_string_size(), and cubpacking::unpacker::unpack_string_to_memblock().
void cubpacking::packer::append_to_buffer_and_pack_all | ( | ExtBlk & | eb, |
Args &&... | args | ||
) |
Definition at line 353 of file packer.hpp.
References assert, get_all_packed_size(), get_buffer_start(), get_curr_ptr(), m_end_ptr, m_ptr, m_start_ptr, pack_all(), and set_buffer_and_pack_all().
Definition at line 922 of file packer.cpp.
References cubpacking::check_range(), m_end_ptr, m_ptr, and OR_BUF_INIT.
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().
|
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().
|
private |
Definition at line 304 of file packer.hpp.
References get_packed_size_overloaded().
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().
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().
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().
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().
size_t cubpacking::packer::get_packed_bigint_size | ( | size_t | curr_offset | ) |
Definition at line 231 of file packer.cpp.
References DB_ALIGN, MAX_ALIGNMENT, and OR_BIGINT_SIZE.
Referenced by cubload::batch::get_packed_size(), cubload::load_args::get_packed_size(), cubload::stats::get_packed_size(), cubload::load_status::get_packed_size(), and get_packed_size_overloaded().
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().
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().
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().
Definition at line 394 of file packer.cpp.
References DB_ALIGN, MAX_ALIGNMENT, and or_packed_value_size().
Referenced by get_packed_size_overloaded().
size_t cubpacking::packer::get_packed_int_size | ( | size_t | curr_offset | ) |
Definition at line 95 of file packer.cpp.
References DB_ALIGN, INT_ALIGNMENT, and OR_INT_SIZE.
Referenced by get_packed_bool_size(), cubload::batch::get_packed_size(), cubload::load_args::get_packed_size(), cubload::stats::get_packed_size(), and get_packed_size_overloaded().
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().
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().
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().
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 | ||
) |
Definition at line 751 of file packer.cpp.
References DB_ALIGN, cubpacking::packable_object::get_packed_size(), and MAX_ALIGNMENT.
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().
bool cubpacking::packer::is_ended | ( | void | ) |
Definition at line 960 of file packer.cpp.
References get_buffer_end(), and get_curr_ptr().
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().
|
private |
Definition at line 333 of file packer.hpp.
References pack_all(), and pack_overloaded().
Referenced by pack_all().
|
private |
Definition at line 326 of file packer.hpp.
References pack_overloaded().
void cubpacking::packer::pack_bigint | ( | const std::int64_t & | value | ) |
Definition at line 237 of file packer.cpp.
References align(), cubpacking::check_range(), m_end_ptr, m_ptr, MAX_ALIGNMENT, OR_BIGINT_SIZE, and OR_PUT_INT64.
Referenced by cubload::batch::pack(), cubload::load_args::pack(), cubload::stats::pack(), cubload::load_status::pack(), and pack_overloaded().
void cubpacking::packer::pack_bigint | ( | const std::uint64_t & | value | ) |
Definition at line 257 of file packer.cpp.
References align(), cubpacking::check_range(), m_end_ptr, m_ptr, MAX_ALIGNMENT, OR_BIGINT_SIZE, and OR_PUT_INT64.
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().
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().
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().
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().
void cubpacking::packer::pack_int | ( | const int | value | ) |
Definition at line 101 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 cubload::batch::pack(), cubload::load_args::pack(), cubload::stats::pack(), pack_bool(), pack_overloaded(), and pack_to_int().
Definition at line 313 of file packer.cpp.
References align(), cubpacking::check_range(), cubregex::count(), i, INT_ALIGNMENT, m_end_ptr, m_ptr, OR_INT_SIZE, and OR_PUT_INT.
void cubpacking::packer::pack_int_vector | ( | const std::vector< int > & | array | ) |
Definition at line 357 of file packer.cpp.
References align(), cubpacking::check_range(), cubregex::count(), i, INT_ALIGNMENT, m_end_ptr, m_ptr, OR_INT_SIZE, and OR_PUT_INT.
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().
void cubpacking::packer::pack_large_string | ( | const std::string & | str | ) |
Definition at line 565 of file packer.cpp.
References pack_large_c_string().
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().
void cubpacking::packer::pack_overloaded | ( | int | value | ) |
Definition at line 117 of file packer.cpp.
References pack_int().
Referenced by pack_all_recursive().
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().
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().
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().
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().
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().
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().
void cubpacking::packer::set_buffer_and_pack_all | ( | ExtBlk & | eb, |
Args &&... | args | ||
) |
Definition at line 341 of file packer.hpp.
References get_all_packed_size(), pack_all(), and set_buffer().
Referenced by append_to_buffer_and_pack_all(), boot_register_client(), loaddb_init(), loaddb_install_class(), loaddb_load_batch(), sloaddb_fetch_status(), and sloaddb_load_batch().
|
private |
Definition at line 177 of file packer.hpp.
Referenced by append_to_buffer_and_pack_all(), delegate_to_or_buf(), cubpacking::unpacker::delegate_to_or_buf(), get_buffer_end(), cubpacking::unpacker::get_buffer_end(), pack_bigint(), pack_buffer_with_length(), pack_c_string(), pack_db_value(), pack_int(), pack_int_array(), pack_int_vector(), pack_large_c_string(), pack_oid(), pack_short(), pack_small_string(), cubpacking::unpacker::peek_unpack_int(), set_buffer(), cubpacking::unpacker::set_buffer(), cubpacking::unpacker::unpack_bigint(), cubpacking::unpacker::unpack_buffer_with_length(), cubpacking::unpacker::unpack_db_value(), cubpacking::unpacker::unpack_int(), cubpacking::unpacker::unpack_int_array(), cubpacking::unpacker::unpack_int_vector(), cubpacking::unpacker::unpack_large_string(), cubpacking::unpacker::unpack_oid(), cubpacking::unpacker::unpack_short(), cubpacking::unpacker::unpack_small_string(), cubpacking::unpacker::unpack_string(), and cubpacking::unpacker::unpack_string_size().
|
private |
Definition at line 178 of file packer.hpp.
Referenced by align(), cubpacking::unpacker::align(), append_to_buffer_and_pack_all(), delegate_to_or_buf(), cubpacking::unpacker::delegate_to_or_buf(), get_curr_ptr(), cubpacking::unpacker::get_curr_ptr(), pack_bigint(), pack_buffer_with_length(), pack_c_string(), pack_db_value(), pack_int(), pack_int_array(), pack_int_vector(), pack_large_c_string(), pack_oid(), pack_short(), pack_small_string(), cubpacking::unpacker::peek_unpack_int(), set_buffer(), cubpacking::unpacker::set_buffer(), cubpacking::unpacker::unpack_bigint(), cubpacking::unpacker::unpack_buffer_with_length(), cubpacking::unpacker::unpack_c_string(), cubpacking::unpacker::unpack_db_value(), cubpacking::unpacker::unpack_int(), cubpacking::unpacker::unpack_int_array(), cubpacking::unpacker::unpack_int_vector(), cubpacking::unpacker::unpack_large_string(), cubpacking::unpacker::unpack_oid(), cubpacking::unpacker::unpack_short(), cubpacking::unpacker::unpack_small_string(), cubpacking::unpacker::unpack_string(), cubpacking::unpacker::unpack_string_size(), and cubpacking::unpacker::unpack_string_to_memblock().
|
private |
Definition at line 176 of file packer.hpp.
Referenced by append_to_buffer_and_pack_all(), get_buffer_start(), cubpacking::unpacker::get_buffer_start(), set_buffer(), and cubpacking::unpacker::set_buffer().