Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::impl Namespace Reference

Classes

struct  abi_from_variant
 
class  abi_from_variant_visitor
 
struct  abi_to_variant
 
class  abi_to_variant_visitor
 
struct  abi_traverse_context
 
struct  abi_traverse_context_with_path
 
struct  array_index_path_item
 
struct  array_type_path_root
 
struct  binary_to_variant_context
 
struct  empty_path_item
 
struct  empty_path_root
 
struct  field_path_item
 
struct  generate_path_string_visitor
 
struct  path_item_type_visitor
 
struct  struct_type_path_root
 
struct  type_requires_abi
 
struct  type_requires_abi< Container< T, Args... > >
 
struct  variant_path_item
 
struct  variant_to_binary_context
 
struct  variant_type_path_root
 

Typedefs

using path_root = std::variant<empty_path_root, array_type_path_root, struct_type_path_root, variant_type_path_root>
 
using path_item = std::variant<empty_path_item, array_index_path_item, field_path_item, variant_path_item>
 
template<typename T >
using not_require_abi_t = std::enable_if_t<!type_requires_abi_v<T>(), int>
 
template<typename T >
using require_abi_t = std::enable_if_t<type_requires_abi_v<T>(), int>
 

Functions

constexpr size_t const_strlen (const char *str)
 
void output_name (std::ostream &s, const string_view &str, bool shorten, size_t max_length=64)
 
string limit_size (const std::string_view &str)
 limits the string size to default max_length of output_name
 
template<typename T >
constexpr bool single_type_requires_abi_v ()
 
template<typename T >
constexpr bool type_requires_abi_v ()
 

Typedef Documentation

◆ not_require_abi_t

template<typename T >
using sysio::chain::impl::not_require_abi_t = std::enable_if_t<!type_requires_abi_v<T>(), int>

convenience aliases for creating overload-guards based on whether the type contains ABI related info

Definition at line 326 of file abi_serializer.hpp.

◆ path_item

◆ path_root

◆ require_abi_t

template<typename T >
using sysio::chain::impl::require_abi_t = std::enable_if_t<type_requires_abi_v<T>(), int>

Definition at line 329 of file abi_serializer.hpp.

Function Documentation

◆ const_strlen()

size_t sysio::chain::impl::const_strlen ( const char * str)
constexpr

Definition at line 703 of file abi_serializer.cpp.

704 {
705 return (*str == 0) ? 0 : const_strlen(str + 1) + 1;
706 }
constexpr size_t const_strlen(const char *str)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ limit_size()

string sysio::chain::impl::limit_size ( const std::string_view & str)

Definition at line 880 of file abi_serializer.cpp.

880 {
881 std::stringstream s;
882 output_name( s, str, false );
883 return s.str();
884 }
void output_name(std::ostream &s, const string_view &str, bool shorten, size_t max_length=64)
char * s
Here is the call graph for this function:
Here is the caller graph for this function:

◆ output_name()

void sysio::chain::impl::output_name ( std::ostream & s,
const string_view & str,
bool shorten,
size_t max_length = 64 )

Definition at line 708 of file abi_serializer.cpp.

708 {
709 constexpr size_t min_num_characters_at_ends = 4;
710 constexpr size_t preferred_num_tail_end_characters = 6;
711 constexpr const char* fill_in = "...";
712
713 static_assert( min_num_characters_at_ends <= preferred_num_tail_end_characters,
714 "preferred number of tail end characters cannot be less than the imposed absolute minimum" );
715
716 constexpr size_t fill_in_length = const_strlen( fill_in );
717 constexpr size_t min_length = fill_in_length + 2*min_num_characters_at_ends;
718 constexpr size_t preferred_min_length = fill_in_length + 2*preferred_num_tail_end_characters;
719
720 max_length = std::max( max_length, min_length );
721
722 if( !shorten || str.size() <= max_length ) {
723 s << str;
724 return;
725 }
726
727 size_t actual_num_tail_end_characters = preferred_num_tail_end_characters;
728 if( max_length < preferred_min_length ) {
729 actual_num_tail_end_characters = min_num_characters_at_ends + (max_length - min_length)/2;
730 }
731
732 s.write( str.data(), max_length - fill_in_length - actual_num_tail_end_characters );
733 s.write( fill_in, fill_in_length );
734 s.write( str.data() + (str.size() - actual_num_tail_end_characters), actual_num_tail_end_characters );
735 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ single_type_requires_abi_v()

template<typename T >
bool sysio::chain::impl::single_type_requires_abi_v ( )
constexpr

Determine if a type contains ABI related info, perhaps deeply nested

Template Parameters
T- the type to check

Definition at line 284 of file abi_serializer.hpp.

284 {
285 return std::is_base_of<transaction, T>::value ||
286 std::is_same<T, packed_transaction>::value ||
287 std::is_same<T, transaction_trace>::value ||
288 std::is_same<T, transaction_receipt>::value ||
289 std::is_same<T, action_trace>::value ||
290 std::is_same<T, signed_transaction>::value ||
291 std::is_same<T, signed_block>::value ||
292 std::is_same<T, action>::value;
293 }
Here is the caller graph for this function:

◆ type_requires_abi_v()

template<typename T >
bool sysio::chain::impl::type_requires_abi_v ( )
constexpr

Definition at line 318 of file abi_serializer.hpp.

Here is the call graph for this function: