32 #include "serializeble_struct_helper.h" 35 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY 36 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "net" 42 template<
class t_struct>
49 head.m_have_to_return_data =
true;
56 if(!StorageNamed::save_struct_as_storage_to_buff_t<t_struct, StorageNamed::DefaultStorageType>(t, buff_strg))
60 buff.append(buff_strg);
71 head.m_have_to_return_data =
true;
86 LOG_PRINT_L3(
"size of buff(" << buff.size() <<
") is too small, at load_struct_from_levin_message");
90 #if BYTE_ORDER == LITTLE_ENDIAN 103 LOG_PRINT_L3(
"Failed to read signature in levin message, at load_struct_from_levin_message");
108 LOG_PRINT_L3(
"sizes mismatch, at load_struct_from_levin_message");
114 command =
head.m_command;
118 template<
class t_struct>
123 LOG_ERROR(
"size of buff(" << buff.size() <<
") is too small, at load_struct_from_levin_message");
127 #if BYTE_ORDER == LITTLE_ENDIAN 140 LOG_ERROR(
"Failed to read signature in levin message, at load_struct_from_levin_message");
145 LOG_ERROR(
"sizes mismatch, at load_struct_from_levin_message");
152 if(!StorageNamed::load_struct_from_storage_buff_t<t_struct, StorageNamed::DefaultStorageType>(t, buff_strg))
154 LOG_ERROR(
"Failed to read storage, at load_struct_from_levin_message");
157 command =
head.m_command;
bool load_levin_data_from_levin_message(std::string &levin_data, const std::string &buff, int &command)
bool load_struct_from_levin_message(t_struct &t, const std::string &buff, int &command)
bool pack_data_to_levin_message(const std::string &data, std::string &buff, int command_id)
void rand(size_t N, uint8_t *bytes)
bool pack_struct_to_levin_message(const t_struct &t, std::string &buff, int command_id)