diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/endo_scalar.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/endo_scalar.hpp index 53c74ec28b..cdc290a8c9 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/endo_scalar.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/endo_scalar.hpp @@ -214,11 +214,11 @@ namespace nil { typename BlueprintFieldType::integral_type(scalar.data); std::vector bits_msb(component.scalar_size); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; assert(component.scalar_size <= BlueprintFieldType::modulus_bits); std::array bits_msb_all = - nil::marshalling::pack(integral_scalar, status); + nil::crypto3::marshalling::pack(integral_scalar, status); THROW_IF_ERROR_STATUS(status, "plonk_endo_scalar::generate_assignments"); diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/fixed_base_scalar_mul_9_wires.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/fixed_base_scalar_mul_9_wires.hpp index 6c4a1a7946..f670c7f8f0 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/fixed_base_scalar_mul_9_wires.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/fixed_base_scalar_mul_9_wires.hpp @@ -249,7 +249,7 @@ namespace nil { std::size_t component_start_row) { std::array b = - nil::marshalling::pack(params.s); + nil::crypto3::marshalling::pack(params.s); private_assignment.witness(W1)[j] = b[0]; private_assignment.witness(W2)[j] = b[1]; diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_endo_scalar_mul_15_wires.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_endo_scalar_mul_15_wires.hpp index 5c747bd05e..bb87c186e6 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_endo_scalar_mul_15_wires.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_endo_scalar_mul_15_wires.hpp @@ -174,9 +174,9 @@ namespace nil { std::array bits = {false}; { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bits_all = - nil::marshalling::pack(integral_b, status); + nil::crypto3::marshalling::pack(integral_b, status); THROW_IF_ERROR_STATUS(status, "curve_element_variable_base_endo_scalar_mul::generate_assignments"); std::copy(bits_all.end() - 128, bits_all.end(), bits.begin()); } diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_scalar_mul.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_scalar_mul.hpp index dd62ef9e11..f7663c34f6 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_scalar_mul.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/curves/pasta/plonk/variable_base_scalar_mul.hpp @@ -245,9 +245,9 @@ namespace nil { typename CurveType::scalar_field_type::integral_type integral_b = typename CurveType::scalar_field_type::integral_type(b.data); const std::size_t scalar_size = 255; - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bits = - nil::marshalling::pack(integral_b, status); + nil::crypto3::marshalling::pack(integral_b, status); THROW_IF_ERROR_STATUS(status, "curve_element_variable_base_scalar_mul::generate_assignments"); typename BlueprintFieldType::value_type z_n2; @@ -267,7 +267,7 @@ namespace nil { typename CurveType::scalar_field_type::integral_type(aux.data); const std::size_t base_size = 255; std::array aux_bits = - nil::marshalling::pack(integral_aux, status); + nil::crypto3::marshalling::pack(integral_aux, status); THROW_IF_ERROR_STATUS(status, "curve_element_variable_base_scalar_mul::generate_assignments"); typename BlueprintFieldType::value_type n = 0; diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/bit_decomposition.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/bit_decomposition.hpp index 7bff2448b4..66e3a93b25 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/bit_decomposition.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/bit_decomposition.hpp @@ -190,9 +190,9 @@ namespace nil { }; std::vector bits(bits_amount); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bytes_all = - nil::marshalling::pack(input, status); + nil::crypto3::marshalling::pack(input, status); THROW_IF_ERROR_STATUS(status, "bit_decomposition::calculate"); std::copy(bytes_all.end() - bits_amount, bytes_all.end(), bits.begin()); } @@ -221,9 +221,9 @@ namespace nil { std::vector input_bits(component.bits_amount); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bytes_all = - nil::marshalling::pack( + nil::crypto3::marshalling::pack( var_value(assignment, instance_input.input), status); THROW_IF_ERROR_STATUS(status, "bit_decomposition::generate_assignments"); std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(), input_bits.begin()); diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_checked.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_checked.hpp index dd6af53221..da28dc68e2 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_checked.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_checked.hpp @@ -494,9 +494,9 @@ namespace nil { bits[i].resize(component.bits_amount + component.padding_bits); std::fill(bits[i].begin(), bits[i].end(), false); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bytes_all = - nil::marshalling::pack(integrals[i], status); + nil::crypto3::marshalling::pack(integrals[i], status); THROW_IF_ERROR_STATUS(status, "comparison_checked::generate_assignments"); std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(), bits[i].begin() + component.padding_bits); diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_flag.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_flag.hpp index e4c9d32371..63be0da4e9 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_flag.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/non_native/comparison_flag.hpp @@ -311,9 +311,9 @@ namespace nil { std::fill(bits[i].begin(), bits[i].end(), false); bits[i].resize(arg_bits_amount + padding_bits); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bytes_all = - nil::marshalling::pack(integrals[i], status); + nil::crypto3::marshalling::pack(integrals[i], status); THROW_IF_ERROR_STATUS(status, "comparison_flag::calculate"); std::copy(bytes_all.end() - arg_bits_amount, bytes_all.end(), @@ -468,9 +468,9 @@ namespace nil { std::fill(bits[i].begin(), bits[i].end(), false); bits[i].resize(component.bits_amount + component.padding_bits); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bytes_all = - nil::marshalling::pack(integrals[i], status); + nil::crypto3::marshalling::pack(integrals[i], status); THROW_IF_ERROR_STATUS(status, "comparison_flag::generate_assignments"); std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(), bits[i].begin() + component.padding_bits); diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/range_check.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/range_check.hpp index c7367b7928..aa4b4aeeb7 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/range_check.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/algebra/fields/plonk/range_check.hpp @@ -264,9 +264,9 @@ namespace nil { std::vector bits(component.bits_amount + component.padding_bits); std::fill(bits.begin(), bits.end(), false); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array bytes_all = - nil::marshalling::pack(x_integral, status); + nil::crypto3::marshalling::pack(x_integral, status); THROW_IF_ERROR_STATUS(status, "range_check::generate_assignments"); std::copy(bytes_all.end() - component.bits_amount, bytes_all.end(), bits.begin() + component.padding_bits); diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/sha_table_generators.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/sha_table_generators.hpp index 43b478dc6a..608672165f 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/sha_table_generators.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/detail/sha_table_generators.hpp @@ -64,8 +64,8 @@ namespace nil { SumHash> &input, std::ostream &stream) { using value_type = typename BlueprintFieldType::value_type; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using marshalling_value_type = crypto3::marshalling::types::field_element; stream << input.size() << std::endl; for (const auto &[preimage, image] : input) { diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha256_process.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha256_process.hpp index d68874c4f4..b9da22b9b3 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha256_process.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha256_process.hpp @@ -211,9 +211,9 @@ namespace nil { typename BlueprintFieldType::integral_type(input_state[i].data); std::vector input_state_sparse(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector input_state_sparse_all = - nil::marshalling::pack(integral_input_state_sparse, + nil::crypto3::marshalling::pack(integral_input_state_sparse, status); std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(), input_state_sparse.begin()); @@ -230,9 +230,9 @@ namespace nil { typename BlueprintFieldType::integral_type(input_state[i].data); std::vector input_state_sparse(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector input_state_sparse_all = - nil::marshalling::pack(integral_input_state_sparse, + nil::crypto3::marshalling::pack(integral_input_state_sparse, status); std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(), input_state_sparse.begin()); @@ -254,9 +254,9 @@ namespace nil { typename BlueprintFieldType::integral_type(message_scheduling_words[(i - row) / 5 + 1].data); std::vector a(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector a_all = - nil::marshalling::pack(integral_a, status); + nil::crypto3::marshalling::pack(integral_a, status); std::copy(a_all.end() - 32, a_all.end(), a.begin()); } @@ -276,9 +276,9 @@ namespace nil { typename BlueprintFieldType::integral_type(message_scheduling_words[(i - row) / 5 + 14].data); std::vector b(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector b_all = - nil::marshalling::pack(integral_b, status); + nil::crypto3::marshalling::pack(integral_b, status); std::copy(b_all.end() - 32, b_all.end(), b.begin()); } @@ -313,9 +313,9 @@ namespace nil { typename BlueprintFieldType::integral_type(e.data); std::vector e_bits(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector e_bits_all = - nil::marshalling::pack(integral_e, status); + nil::crypto3::marshalling::pack(integral_e, status); std::copy(e_bits_all.end() - 32, e_bits_all.end(), e_bits.begin()); } @@ -370,9 +370,9 @@ namespace nil { typename BlueprintFieldType::integral_type(a.data); std::vector a_bits(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector a_bits_all = - nil::marshalling::pack(integral_a, status); + nil::crypto3::marshalling::pack(integral_a, status); std::copy(a_bits_all.end() - 32, a_bits_all.end(), a_bits.begin()); } @@ -1393,9 +1393,9 @@ namespace nil { typename BlueprintFieldType::integral_type(input_state[i].data); std::vector input_state_sparse(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector input_state_sparse_all = - nil::marshalling::pack(integral_input_state_sparse, + nil::crypto3::marshalling::pack(integral_input_state_sparse, status); std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(), input_state_sparse.begin()); @@ -1415,9 +1415,9 @@ namespace nil { typename BlueprintFieldType::integral_type(input_state[i].data); std::vector input_state_sparse(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector input_state_sparse_all = - nil::marshalling::pack(integral_input_state_sparse, + nil::crypto3::marshalling::pack(integral_input_state_sparse, status); std::copy(input_state_sparse_all.end() - 32, input_state_sparse_all.end(), input_state_sparse.begin()); @@ -1444,9 +1444,9 @@ namespace nil { assignment.witness(component.W(0), i) = message_scheduling_words[(i - row) / 5 + 1]; std::vector a(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector a_all = - nil::marshalling::pack(integral_a, status); + nil::crypto3::marshalling::pack(integral_a, status); std::copy(a_all.end() - 32, a_all.end(), a.begin()); } @@ -1486,9 +1486,9 @@ namespace nil { typename BlueprintFieldType::integral_type(message_scheduling_words[(i - row) / 5 + 14].data); std::vector b(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector b_all = - nil::marshalling::pack(integral_b, status); + nil::crypto3::marshalling::pack(integral_b, status); std::copy(b_all.end() - 32, b_all.end(), b.begin()); } @@ -1555,9 +1555,9 @@ namespace nil { typename BlueprintFieldType::integral_type(e.data); std::vector e_bits(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector e_bits_all = - nil::marshalling::pack(integral_e, status); + nil::crypto3::marshalling::pack(integral_e, status); std::copy(e_bits_all.end() - 32, e_bits_all.end(), e_bits.begin()); } @@ -1655,9 +1655,9 @@ namespace nil { typename BlueprintFieldType::integral_type(a.data); std::vector a_bits(32); { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector a_bits_all = - nil::marshalling::pack(integral_a, status); + nil::crypto3::marshalling::pack(integral_a, status); std::copy(a_bits_all.end() - 32, a_bits_all.end(), a_bits.begin()); } diff --git a/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha512_process.hpp b/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha512_process.hpp index ff0e4bf8c8..72754474d9 100644 --- a/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha512_process.hpp +++ b/crypto3/libs/blueprint/include/nil/blueprint/components/hashes/sha2/plonk/sha512_process.hpp @@ -462,8 +462,8 @@ namespace nil { typename BlueprintFieldType::integral_type(input_state[i].data); std::vector input_state_sparse(64); { - nil::marshalling::status_type status; - std::array input_state_sparse_all = nil::marshalling::pack(integral_input_state_sparse, status); + nil::crypto3::marshalling::status_type status; + std::array input_state_sparse_all = nil::crypto3::marshalling::pack(integral_input_state_sparse, status); std::copy(input_state_sparse_all.end() - 64, input_state_sparse_all.end(), input_state_sparse.begin()); } @@ -480,8 +480,8 @@ namespace nil { typename BlueprintFieldType::integral_type(input_state[i].data); std::vector input_state_sparse(64); { - nil::marshalling::status_type status; - std::array input_state_sparse_all = nil::marshalling::pack(integral_input_state_sparse, status); + nil::crypto3::marshalling::status_type status; + std::array input_state_sparse_all = nil::crypto3::marshalling::pack(integral_input_state_sparse, status); std::copy(input_state_sparse_all.end() - 64, input_state_sparse_all.end(), input_state_sparse.begin()); } @@ -506,8 +506,8 @@ namespace nil { assignment.witness(component.W(0), i) = message_scheduling_words[(i - row) / 6 + 1]; std::vector a(64); { - nil::marshalling::status_type status; - std::array a_all = nil::marshalling::pack(integral_a, status); + nil::crypto3::marshalling::status_type status; + std::array a_all = nil::crypto3::marshalling::pack(integral_a, status); std::copy(a_all.end() - 64, a_all.end(), a.begin()); } @@ -560,8 +560,8 @@ namespace nil { message_scheduling_words[(i - row) / 6 + 14].data); std::vector b(64); { - nil::marshalling::status_type status; - std::array b_all = nil::marshalling::pack(integral_b, status); + nil::crypto3::marshalling::status_type status; + std::array b_all = nil::crypto3::marshalling::pack(integral_b, status); std::copy(b_all.end() - 64, b_all.end(), b.begin()); } @@ -627,8 +627,8 @@ namespace nil { typename BlueprintFieldType::integral_type(e.data); std::vector e_bits(64); { - nil::marshalling::status_type status; - std::array e_bits_all = nil::marshalling::pack(integral_e, status); + nil::crypto3::marshalling::status_type status; + std::array e_bits_all = nil::crypto3::marshalling::pack(integral_e, status); std::copy(e_bits_all.end() - 64, e_bits_all.end(), e_bits.begin()); } @@ -730,8 +730,8 @@ namespace nil { typename BlueprintFieldType::integral_type(a.data); std::vector a_bits(64); { - nil::marshalling::status_type status; - std::array a_bits_all = nil::marshalling::pack(integral_a, status); + nil::crypto3::marshalling::status_type status; + std::array a_bits_all = nil::crypto3::marshalling::pack(integral_a, status); std::copy(a_bits_all.end() - 64, a_bits_all.end(), a_bits.begin()); } diff --git a/crypto3/libs/blueprint/test/algebra/curves/plonk/endo_scalar.cpp b/crypto3/libs/blueprint/test/algebra/curves/plonk/endo_scalar.cpp index 6bec01b428..0658ac911a 100644 --- a/crypto3/libs/blueprint/test/algebra/curves/plonk/endo_scalar.cpp +++ b/crypto3/libs/blueprint/test/algebra/curves/plonk/endo_scalar.cpp @@ -89,11 +89,11 @@ typename CurveType::scalar_field_type::value_type calculate_endo_scalar(typename typename BlueprintFieldType::integral_type(scalar.data); std::array bits_msb; { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; BOOST_CHECK(ScalarSize <= 255); std::array bits_msb_all = - nil::marshalling::pack(integral_scalar, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::pack(integral_scalar, status); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); std::copy(bits_msb_all.end() - ScalarSize, bits_msb_all.end(), bits_msb.begin()); for(std::size_t i = 0; i < 255 - ScalarSize; ++i) { diff --git a/crypto3/libs/blueprint/test/test_plonk_component.hpp b/crypto3/libs/blueprint/test/test_plonk_component.hpp index bf100d9884..bf01579f35 100644 --- a/crypto3/libs/blueprint/test/test_plonk_component.hpp +++ b/crypto3/libs/blueprint/test/test_plonk_component.hpp @@ -97,8 +97,8 @@ namespace nil { ){ using ArithmetizationType = nil::crypto3::zk::snark::plonk_constraint_system; using AssignmentType = nil::crypto3::zk::snark::plonk_table>; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; { std::ofstream otable; @@ -107,7 +107,7 @@ namespace nil { std::vector cv; cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); otable.write(reinterpret_cast(cv.data()), cv.size()); otable.close(); } @@ -119,7 +119,7 @@ namespace nil { std::vector cv; cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); ocircuit.write(reinterpret_cast(cv.data()), cv.size()); ocircuit.close(); } @@ -153,8 +153,8 @@ namespace nil { using ColumnType = nil::crypto3::zk::snark::plonk_column; using AssignmentTableType = nil::crypto3::zk::snark::plonk_table; using TableDescriptionType = nil::crypto3::zk::snark::plonk_table_description; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; ConstraintSystemType constraint_system; { diff --git a/crypto3/libs/blueprint/test/verifiers/placeholder/verifier.cpp b/crypto3/libs/blueprint/test/verifiers/placeholder/verifier.cpp index 52dcaf8af7..c35189c3b0 100644 --- a/crypto3/libs/blueprint/test/verifiers/placeholder/verifier.cpp +++ b/crypto3/libs/blueprint/test/verifiers/placeholder/verifier.cpp @@ -91,8 +91,8 @@ struct default_zkllvm_params { nil::crypto3::zk::snark::plonk_constraint_system; using table_description_type = nil::crypto3::zk::snark::plonk_table_description; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using ColumnType = nil::crypto3::zk::snark::plonk_column; using assignment_table_type = @@ -175,8 +175,8 @@ template static nil::crypto3::zk::snark::placeholder_proof load_proof(std::string filename) { std::cout << "Loading proof from " << filename << std::endl; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; std::ifstream iproof; iproof.open(filename); @@ -193,7 +193,7 @@ template proof_marshalling_type marshalled_proof_data; auto read_iter = v.begin(); auto status = marshalled_proof_data.read(read_iter, v.size()); - if (status != nil::marshalling::status_type::success) { + if (status != nil::crypto3::marshalling::status_type::success) { std::cerr << "Status is " << make_error_code(status) << std::endl; throw "Reading a marshalled object from buffer failed."; } @@ -221,7 +221,7 @@ static typename nil::crypto3::zk::snark::placeholder_public_preprocessor marshalled_data; auto read_iter = v.begin(); auto status = marshalled_data.read(read_iter, v.size()); - return nil::crypto3::marshalling::types::make_placeholder_common_data( + return nil::crypto3::marshalling::types::make_placeholder_common_data( marshalled_data ); } @@ -239,8 +239,8 @@ struct dst_params{ nil::crypto3::zk::snark::plonk_constraint_system; using table_description_type = nil::crypto3::zk::snark::plonk_table_description; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using ColumnType = nil::crypto3::zk::snark::plonk_column; using assignment_table_type = diff --git a/crypto3/libs/hash/include/nil/crypto3/hash/find_group_hash.hpp b/crypto3/libs/hash/include/nil/crypto3/hash/find_group_hash.hpp index 0333e29d8c..341a60af77 100644 --- a/crypto3/libs/hash/include/nil/crypto3/hash/find_group_hash.hpp +++ b/crypto3/libs/hash/include/nil/crypto3/hash/find_group_hash.hpp @@ -84,7 +84,7 @@ namespace nil { struct construction { struct params_type { - typedef nil::marshalling::option::little_endian digest_endian; + typedef marshalling::option::little_endian digest_endian; }; typedef void type; }; @@ -114,7 +114,7 @@ namespace nil { } static inline result_type process(internal_accumulator_type &acc) { - nil::marshalling::status_type status; + marshalling::status_type status; group_value_type point; std::uint8_t i = 0; @@ -129,8 +129,8 @@ namespace nil { nil::crypto3::accumulators::extract::hash(acc_copy); // TODO: generalize pack interface to accept arbitrary containers std::vector H_vec(std::cbegin(H), std::cend(H)); - point = nil::marshalling::pack(H_vec, status); - if (status == nil::marshalling::status_type::success) { + point = marshalling::pack(H_vec, status); + if (status == marshalling::status_type::success) { break; } diff --git a/crypto3/libs/hash/include/nil/crypto3/hash/h2c.hpp b/crypto3/libs/hash/include/nil/crypto3/hash/h2c.hpp index 5fddbc5fc9..06ebfc585f 100644 --- a/crypto3/libs/hash/include/nil/crypto3/hash/h2c.hpp +++ b/crypto3/libs/hash/include/nil/crypto3/hash/h2c.hpp @@ -85,7 +85,7 @@ namespace nil { struct construction { struct params_type { - typedef nil::marshalling::option::big_endian digest_endian; + typedef marshalling::option::big_endian digest_endian; }; typedef void type; }; diff --git a/crypto3/libs/hash/include/nil/crypto3/hash/h2f.hpp b/crypto3/libs/hash/include/nil/crypto3/hash/h2f.hpp index 3cc1e1868a..55ff6ec610 100644 --- a/crypto3/libs/hash/include/nil/crypto3/hash/h2f.hpp +++ b/crypto3/libs/hash/include/nil/crypto3/hash/h2f.hpp @@ -100,7 +100,7 @@ namespace nil { struct construction { struct params_type { - typedef nil::marshalling::option::big_endian digest_endian; + typedef nil::crypto3::marshalling::option::big_endian digest_endian; }; typedef void type; }; @@ -140,9 +140,9 @@ namespace nil { std::copy(std::cbegin(uniform_bytes) + elm_offset, std::cbegin(uniform_bytes) + elm_offset + L, std::back_inserter(imported_octets)); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; nil::crypto3::multiprecision::big_uint tmp = - nil::marshalling::pack(imported_octets, status); + nil::crypto3::marshalling::pack(imported_octets, status); THROW_IF_ERROR_STATUS(status, "h2f::process"); coordinates[j] = modular_type(tmp); } @@ -169,9 +169,9 @@ namespace nil { std::copy(std::cbegin(uniform_bytes) + elm_offset, std::cbegin(uniform_bytes) + elm_offset + L, std::back_inserter(imported_octets)); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; nil::crypto3::multiprecision::big_uint tmp = - nil::marshalling::pack(imported_octets, status); + nil::crypto3::marshalling::pack(imported_octets, status); THROW_IF_ERROR_STATUS(status, "h2f::process"); coordinates[j] = modular_type(tmp); } diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/inference.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/inference.hpp index 3ba6dcfc7b..4d95c8acc3 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/inference.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/inference.hpp @@ -55,9 +55,6 @@ namespace nil { extended_field_element, pure_field_element>::type; } // namespace types - } // namespace marshalling - } // namespace crypto3 - namespace marshalling { template class is_compatible; @@ -79,13 +76,14 @@ namespace nil { public: template using type = nil::crypto3::marshalling::types::field_element< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, T>; static const bool value = true; static const bool fixed_size = true; }; - } // namespace marshalling + } // namespace marshalling + } // namespace crypto3 } // namespace nil #endif // CRYPTO3_MARSHALLING_ALGEBRA_INFERENCE_TYPE_TRAITS_HPP diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/alt_bn128.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/alt_bn128.hpp index c137899292..0ec9ce28b2 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/alt_bn128.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/alt_bn128.hpp @@ -53,7 +53,7 @@ namespace nil { template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::alt_bn128_254::template g1_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -64,11 +64,11 @@ namespace nil { using g1_field_type = typename group_value_type::field_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { /* Point is always encoded in compressed form, only X coordinate. * Highest bit is Infinity flag @@ -80,7 +80,7 @@ namespace nil { auto point_affine = point.to_affine(); - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); @@ -92,13 +92,13 @@ namespace nil { *iter |= S_bit; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::alt_bn128_254::template g2_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -109,11 +109,11 @@ namespace nil { using g2_field_type = typename group_value_type::field_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { /* Point is always encoded in compressed form, only X coordinate. * Highest bit is Infinity flag @@ -135,12 +135,12 @@ namespace nil { form>::value_type point_affine = point.to_affine(); TIter write_iter = iter; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[1].data), write_iter); write_iter += sizeof_field_element_chunks_count; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[0].data), write_iter); @@ -153,14 +153,14 @@ namespace nil { *iter |= S_bit; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::alt_bn128_254::template g1_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -169,11 +169,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -186,12 +186,12 @@ namespace nil { chunk_type I_bit = *iter & 0x80; chunk_type S_bit = *iter & 0x40; - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); if (I_bit) { // point at infinity point = g1_value_type(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } g1_field_value_type x_mod(x); @@ -209,13 +209,13 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::alt_bn128_254::template g2_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -224,11 +224,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -246,14 +246,14 @@ namespace nil { chunk_type S_bit = *iter & 0x40; TIter read_iter = iter; - integral_type x_1 = read_data(read_iter); + integral_type x_1 = multiprecision::processing::read_data(read_iter); read_iter += sizeof_field_element_chunks_count; - integral_type x_0 = read_data(read_iter); + integral_type x_0 = multiprecision::processing::read_data(read_iter); if (I_bit) { // point at infinity point = group_value_type(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } g2_field_value_type x_mod(x_0, x_1); @@ -271,7 +271,7 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/babyjubjub.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/babyjubjub.hpp index 85975b54a9..bf7075bb67 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/babyjubjub.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/babyjubjub.hpp @@ -62,7 +62,7 @@ namespace nil { template struct curve_element_writer< - nil::marshalling::endian::little_endian, + nil::crypto3::marshalling::endian::little_endian, typename algebra::curves::babyjubjub::template g1_type> { using group_type = @@ -71,14 +71,14 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::little_endian; + using endianness = nil::crypto3::marshalling::endian::little_endian; using params_type = curve_element_marshalling_params; using encoded_integral_type = typename algebra::fields::field<256>::integral_type; template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(const group_value_type &point, TIter &iter) { using base_field_type = typename group_type::field_type; using base_integral_type = typename base_field_type::integral_type; @@ -98,7 +98,7 @@ namespace nil { uint8_t s = detail::sign_gf_p(point_affine.X) ? (0x40) : 0; auto tmp_iter = std::begin(encoded_value); - write_data(static_cast(point_affine.Y.data), + multiprecision::processing::write_data(static_cast(point_affine.Y.data), tmp_iter); assert(!(encoded_value[encoded_size - 1] & 0xC0)); @@ -106,14 +106,14 @@ namespace nil { std::copy(std::cbegin(encoded_value), std::cend(encoded_value), iter); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::little_endian, + nil::crypto3::marshalling::endian::little_endian, typename algebra::curves::babyjubjub::template g1_type> { using group_type = @@ -122,7 +122,7 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::little_endian; + using endianness = nil::crypto3::marshalling::endian::little_endian; using params_type = curve_element_marshalling_params; using group_affine_value_type = @@ -132,7 +132,7 @@ namespace nil { template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(group_value_type &point, TIter &iter) { using base_field_type = typename group_type::field_type; @@ -146,7 +146,7 @@ namespace nil { "wrong size"); base_integral_type y = - read_data(iter); + multiprecision::processing::read_data(iter); bool sign = *(iter + encoded_size - 1) & (1 << 6); auto decoded_point_affine = @@ -157,7 +157,7 @@ namespace nil { } point = decoded_point_affine.value(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/bls12.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/bls12.hpp index 09a597df3a..6d2711adc7 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/bls12.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/bls12.hpp @@ -129,7 +129,7 @@ namespace nil { using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const chunk_type I_bit = 0x40; @@ -138,13 +138,13 @@ namespace nil { point.to_affine(); chunk_type m_unit = detail::evaluate_m_unit(point, true); if (!(I_bit & m_unit)) { - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); } (*iter) |= m_unit; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; @@ -163,7 +163,7 @@ namespace nil { using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -180,19 +180,19 @@ namespace nil { chunk_type m_unit = detail::evaluate_m_unit(point, true); if (!(I_bit & m_unit)) { TIter write_iter = iter; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[1].data), write_iter); write_iter += sizeof_field_element_chunks_count; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[0].data), write_iter); } (*iter) |= m_unit; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; @@ -210,7 +210,7 @@ namespace nil { using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const chunk_type I_bit = 0x40; @@ -219,13 +219,13 @@ namespace nil { point.to_affine(); chunk_type m_unit = detail::evaluate_m_unit(point, true); if (!(I_bit & m_unit)) { - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); } (*iter) |= m_unit; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; @@ -244,7 +244,7 @@ namespace nil { using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -261,26 +261,26 @@ namespace nil { chunk_type m_unit = detail::evaluate_m_unit(point, true); if (!(I_bit & m_unit)) { TIter write_iter = iter; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[1].data), write_iter); write_iter += sizeof_field_element_chunks_count; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[0].data), write_iter); } (*iter) |= m_unit; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::bls12_381::template g1_type> { using group_type = typename algebra::curves::bls12_381:: @@ -288,11 +288,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; const chunk_type m_unit = *iter & 0xE0; @@ -316,10 +316,10 @@ namespace nil { BOOST_VERIFY(iter + sizeof_field_element_chunks_count == std::find(iter, iter + sizeof_field_element_chunks_count, true)); point = g1_value_type(); // point at infinity - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); g1_field_value_type x_mod(x); g1_field_value_type y2_mod = x_mod.pow(3u) + group_type::params_type::b; @@ -336,13 +336,13 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::bls12_381::template g2_type> { using group_type = typename algebra::curves::bls12_381:: @@ -350,11 +350,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; const chunk_type m_unit = *iter & 0xE0; @@ -378,15 +378,15 @@ namespace nil { BOOST_ASSERT(iter + 2 * sizeof_field_element_chunks_count == std::find(iter, iter + 2 * sizeof_field_element_chunks_count, true)); point = g2_value_type(); // point at infinity - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } TIter read_iter = iter; - integral_type x_1 = read_data(read_iter); + integral_type x_1 = multiprecision::processing::read_data(read_iter); read_iter += sizeof_field_element_chunks_count; - integral_type x_0 = read_data(read_iter); + integral_type x_0 = multiprecision::processing::read_data(read_iter); g2_field_value_type x_mod(x_0, x_1); g2_field_value_type y2_mod = x_mod.pow(3u) + group_type::params_type::b; @@ -403,13 +403,13 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::bls12_377::template g1_type> { using group_type = typename algebra::curves::bls12_377:: @@ -417,11 +417,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; const chunk_type m_unit = *iter & 0xE0; @@ -445,10 +445,10 @@ namespace nil { BOOST_VERIFY(iter + sizeof_field_element_chunks_count == std::find(iter, iter + sizeof_field_element_chunks_count, true)); point = g1_value_type(); // point at infinity - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); g1_field_value_type x_mod(x); g1_field_value_type y2_mod = x_mod.pow(3u) + group_type::params_type::b; @@ -465,13 +465,13 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::bls12_377::template g2_type> { using group_type = typename algebra::curves::bls12_377:: @@ -479,11 +479,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; const chunk_type m_unit = *iter & 0xE0; @@ -507,15 +507,15 @@ namespace nil { BOOST_ASSERT(iter + 2 * sizeof_field_element_chunks_count == std::find(iter, iter + 2 * sizeof_field_element_chunks_count, true)); point = g2_value_type(); // point at infinity - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } TIter read_iter = iter; - integral_type x_1 = read_data(read_iter); + integral_type x_1 = multiprecision::processing::read_data(read_iter); read_iter += sizeof_field_element_chunks_count; - integral_type x_0 = read_data(read_iter); + integral_type x_0 = multiprecision::processing::read_data(read_iter); g2_field_value_type x_mod(x_0, x_1); g2_field_value_type y2_mod = x_mod.pow(3u) + group_type::params_type::b; @@ -532,7 +532,7 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/detail/curve_element.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/detail/curve_element.hpp index 8d08c49a50..adc613a6db 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/detail/curve_element.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/detail/curve_element.hpp @@ -108,7 +108,7 @@ namespace nil { std::enable_if< std::is_same::value, - outcome::result >::type + outcome::result >::type recover_x(const typename GroupAffineElement::field_type::integral_type &y_int, bool sign, bool rfc8032 = false) { using base_field_type = typename GroupAffineElement::field_type; @@ -118,13 +118,13 @@ namespace nil { using group_affine_value_type = GroupAffineElement; if (y_int >= base_field_type::modulus) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } base_field_value_type y(y_int); base_field_value_type y2 = y * y; base_field_value_type y2dp1 = group_type::params_type::a - y2 * group_type::params_type::d; if (y2dp1.is_zero()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } base_field_value_type x2 = (base_integral_type(1) - y2) * y2dp1.inversed(); @@ -132,7 +132,7 @@ namespace nil { return group_affine_value_type(base_field_value_type::zero(), y); } if (!x2.is_square()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } base_field_value_type x = x2.sqrt(); auto x_int = static_cast(x.data); diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/ed25519.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/ed25519.hpp index 0b1a6f7a9a..23b1e94808 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/ed25519.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/ed25519.hpp @@ -54,7 +54,7 @@ namespace nil { // https://datatracker.ietf.org/doc/html/rfc8032#section-5.1.3 template struct curve_element_writer< - nil::marshalling::endian::little_endian, + nil::crypto3::marshalling::endian::little_endian, typename algebra::curves::ed25519::template g1_type> { using group_type = @@ -63,13 +63,13 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::little_endian; + using endianness = nil::crypto3::marshalling::endian::little_endian; using params_type = curve_element_marshalling_params; template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(const group_value_type &point, TIter &iter) { using base_field_type = typename group_type::field_type; using base_integral_type = typename base_field_type::integral_type; @@ -87,7 +87,7 @@ namespace nil { } auto tmp_iter = std::begin(encoded_value); - write_data(static_cast(point_affine.Y.data), + multiprecision::processing::write_data(static_cast(point_affine.Y.data), tmp_iter); assert(!(encoded_value[encoded_size - 1] & 0x80)); bool sign = (point_affine.X.data.base() & 1u) != 0u; @@ -96,14 +96,14 @@ namespace nil { std::copy(std::cbegin(encoded_value), std::cend(encoded_value), iter); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::little_endian, + nil::crypto3::marshalling::endian::little_endian, typename algebra::curves::ed25519::template g1_type> { using group_type = @@ -112,7 +112,7 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::little_endian; + using endianness = nil::crypto3::marshalling::endian::little_endian; using params_type = curve_element_marshalling_params; using group_affine_value_type = @@ -122,7 +122,7 @@ namespace nil { template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(group_value_type &point, TIter &iter) { @@ -137,7 +137,7 @@ namespace nil { "wrong size"); base_integral_type y = - read_data(iter); + multiprecision::processing::read_data(iter); bool sign = *(iter + encoded_size - 1) & (1 << 7); auto decoded_point_affine = @@ -148,7 +148,7 @@ namespace nil { } point = decoded_point_affine.value(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/jubjub.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/jubjub.hpp index c972a3d16a..ef02d2408f 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/jubjub.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/jubjub.hpp @@ -50,7 +50,7 @@ namespace nil { template struct curve_element_writer< - nil::marshalling::endian::little_endian, + nil::crypto3::marshalling::endian::little_endian, typename algebra::curves::jubjub::template g1_type> { using group_type = @@ -59,23 +59,23 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::little_endian; + using endianness = nil::crypto3::marshalling::endian::little_endian; using params_type = curve_element_marshalling_params; /// https://zips.z.cash/protocol/protocol.pdf#concreteextractorjubjub template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { - write_data( + multiprecision::processing::write_data( static_cast(point.to_affine().X.data), iter); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template<> struct curve_element_reader< - nil::marshalling::endian::little_endian, + nil::crypto3::marshalling::endian::little_endian, typename algebra::curves::jubjub::template g1_type> { using group_type = @@ -84,7 +84,7 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::little_endian; + using endianness = nil::crypto3::marshalling::endian::little_endian; using params_type = curve_element_marshalling_params; /// abst_J(LEOS2BSP_{256}(iter)) @@ -92,21 +92,21 @@ namespace nil { template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(group_value_type &point, TIter &iter) { using field_type = typename group_value_type::field_type; using scalar_type = typename algebra::curves::jubjub::scalar_field_type; using integral_type = typename field_type::integral_type; - integral_type int_u = read_data(iter); + integral_type int_u = multiprecision::processing::read_data(iter); if (int_u >= group_value_type::field_type::modulus) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } if (int_u.is_zero()) { point = group_value_type(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } field_type::value_type field_u(int_u); @@ -114,7 +114,7 @@ namespace nil { field_type::value_type denominator = (field_type::value_type::one() - field_type::value_type(group_type::params_type::d) * uu); if (denominator.is_zero()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } field_type::value_type fraction = @@ -122,7 +122,7 @@ namespace nil { * denominator.inversed(); if (!fraction.is_square()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } field_type::value_type v = fraction.sqrt(); @@ -130,17 +130,17 @@ namespace nil { // ... at most one of (u, v) and (u, −v) is in J(𝑟) point = group_value_type(field_u, v); if ( (point * (scalar_type::modulus - 1) + point).is_zero() ) { - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } point = group_value_type(field_u, -v); if ( (point * (scalar_type::modulus - 1) + point).is_zero() ) { - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } // If neither has order r, then point is of mixed order and should be rejected point = group_value_type(); - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } }; } // namespace processing diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt4.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt4.hpp index ba1b270ff8..4be174a646 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt4.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt4.hpp @@ -82,7 +82,7 @@ namespace nil { template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt4_298::template g1_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -93,11 +93,11 @@ namespace nil { using g1_field_type = typename group_value_type::field_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { /* Point is encoded in compressed form, only X coordinate. * Highest bit is Infinity flag @@ -109,7 +109,7 @@ namespace nil { auto point_affine = point.to_affine(); - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); @@ -121,13 +121,13 @@ namespace nil { *iter |= S_bit; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt4_298::template g2_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -138,11 +138,11 @@ namespace nil { using g2_field_type = typename group_value_type::field_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { /* Point is always encoded in compressed form, only X coordinate. * Highest bit is Infinity flag @@ -162,12 +162,12 @@ namespace nil { auto point_affine = point.to_affine(); TIter write_iter = iter; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[1].data), write_iter); write_iter += sizeof_field_element_chunks_count; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[0].data), write_iter); @@ -179,13 +179,13 @@ namespace nil { *iter |= S_bit; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt4_298::template g1_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -194,11 +194,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -211,12 +211,12 @@ namespace nil { chunk_type I_bit = *iter & 0x80; chunk_type S_bit = *iter & 0x40; - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); if (I_bit) { // point at infinity point = g1_value_type(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } g1_field_value_type x_mod(x); @@ -236,13 +236,13 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt4_298::template g2_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -251,11 +251,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -273,14 +273,14 @@ namespace nil { chunk_type S_bit = *iter & 0x40; TIter read_iter = iter; - integral_type x_1 = read_data(read_iter); + integral_type x_1 = multiprecision::processing::read_data(read_iter); read_iter += sizeof_field_element_chunks_count; - integral_type x_0 = read_data(read_iter); + integral_type x_0 = multiprecision::processing::read_data(read_iter); if (I_bit) { // point at infinity point = group_value_type(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } g2_field_value_type x_mod(x_0, x_1); @@ -300,7 +300,7 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; } // namespace processing diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt6.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt6.hpp index 6f051e1ea9..322b24acd4 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt6.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/mnt6.hpp @@ -83,7 +83,7 @@ namespace nil { template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt6_298::template g1_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -94,11 +94,11 @@ namespace nil { using g1_field_type = typename group_value_type::field_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { /* Point is encoded in compressed form, only X coordinate. * Highest bit is Infinity flag @@ -110,7 +110,7 @@ namespace nil { auto point_affine = point.to_affine(); - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); @@ -122,13 +122,13 @@ namespace nil { *iter |= S_bit; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt6_298::template g2_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -139,11 +139,11 @@ namespace nil { using g2_field_type = typename group_value_type::field_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(const group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(const group_value_type &point, TIter &iter) { /* Point is always encoded in compressed form, only X coordinate. * Highest bit is Infinity flag @@ -163,19 +163,19 @@ namespace nil { auto point_affine = point.to_affine(); TIter write_iter = iter; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[2].data), write_iter); write_iter += sizeof_field_element_chunks_count; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[1].data), write_iter); write_iter += sizeof_field_element_chunks_count; - write_data( + multiprecision::processing::write_data( static_cast( point_affine.X.data[0].data), write_iter); @@ -188,14 +188,14 @@ namespace nil { *iter |= S_bit; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt6_298::template g1_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -204,11 +204,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -221,12 +221,12 @@ namespace nil { chunk_type I_bit = *iter & 0x80; chunk_type S_bit = *iter & 0x40; - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); if (I_bit) { // point at infinity point = g1_value_type(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } g1_field_value_type x_mod(x); @@ -246,13 +246,13 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::mnt6_298::template g2_type< Coordinates, algebra::curves::forms::short_weierstrass>> { @@ -261,11 +261,11 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template - static nil::marshalling::status_type process(group_value_type &point, TIter &iter) { + static nil::crypto3::marshalling::status_type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; constexpr static const std::size_t sizeof_field_element = @@ -283,16 +283,16 @@ namespace nil { chunk_type S_bit = *iter & 0x40; TIter read_iter = iter; - integral_type x_2 = read_data(read_iter); + integral_type x_2 = multiprecision::processing::read_data(read_iter); read_iter += sizeof_field_element_chunks_count; - integral_type x_1 = read_data(read_iter); + integral_type x_1 = multiprecision::processing::read_data(read_iter); read_iter += sizeof_field_element_chunks_count; - integral_type x_0 = read_data(read_iter); + integral_type x_0 = multiprecision::processing::read_data(read_iter); if (I_bit) { // point at infinity point = group_value_type(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } g2_field_value_type x_mod(x_0, x_1, x_2); @@ -312,7 +312,7 @@ namespace nil { point = result; } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/pallas.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/pallas.hpp index 27445b0f13..977e46d705 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/pallas.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/pallas.hpp @@ -86,7 +86,7 @@ namespace nil { * */ template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::pallas::template g1_type> { using group_type = typename algebra::curves::pallas:: @@ -94,34 +94,34 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(const group_value_type &point, TIter &iter) { if (point.is_zero()) { *iter++ = 0x00; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } typename group_type::curve_type::template g1_type::value_type point_affine = point.to_affine(); *iter++ = (point_affine.Y.data.base() & 1u) == 0u ? 0x02 : 0x03; - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::pallas::template g1_type> { using group_type = typename algebra::curves::pallas:: @@ -129,7 +129,7 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; using curve_params = typename group_type::params_type; using integral_type = typename group_value_type::field_type::integral_type; @@ -139,7 +139,7 @@ namespace nil { template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; @@ -148,21 +148,21 @@ namespace nil { if (0x00 == prefix) { point = group_value_type::zero(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } if (prefix != 0x02 && prefix != 0x03) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } constexpr static const std::size_t sizeof_field_element = params_type::bit_length() / (group_value_type::field_type::arity); - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); g1_field_value_type x_mod(x); g1_field_value_type y2_mod = x_mod * x_mod * x_mod + curve_params::a * x_mod + curve_params::b; if (!y2_mod.is_square()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } g1_field_value_type y_mod = y2_mod.sqrt(); @@ -175,7 +175,7 @@ namespace nil { point = group_value_type(x_mod, -y_mod); } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_k1.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_k1.hpp index 89121617d8..0b6e15171f 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_k1.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_k1.hpp @@ -90,7 +90,7 @@ namespace nil { * */ template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::detail::secp_k1_g1< Version, algebra::curves::forms::short_weierstrass, @@ -99,41 +99,41 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(const group_value_type &point, TIter &iter) { if (point.is_zero()) { *iter++ = 0x00; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } typename group_type::curve_type::template g1_type::value_type point_affine = point.to_affine(); *iter++ = (point_affine.Y.data.base() & 1u) == 0u ? 0x02 : 0x03; - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::detail::secp_k1_g1> { using group_type = typename algebra::curves::secp_k1::template g1_type<>; using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; using curve_params = typename group_type::params_type; using integral_type = typename group_value_type::field_type::integral_type; @@ -143,7 +143,7 @@ namespace nil { template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; @@ -152,21 +152,21 @@ namespace nil { if (0x00 == prefix) { point = group_value_type::zero(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } if (prefix != 0x02 && prefix != 0x03) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } constexpr static const std::size_t sizeof_field_element = params_type::bit_length() / (group_value_type::field_type::arity); - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); g1_field_value_type x_mod(x); g1_field_value_type y2_mod = x_mod * x_mod * x_mod + curve_params::a * x_mod + curve_params::b; if (!y2_mod.is_square()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } g1_field_value_type y_mod = y2_mod.sqrt(); @@ -179,7 +179,7 @@ namespace nil { point = group_value_type(x_mod, -y_mod); } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_r1.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_r1.hpp index 562c6f6278..e44638b057 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_r1.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/secp_r1.hpp @@ -90,7 +90,7 @@ namespace nil { * */ template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::detail::secp_r1_g1< Version, algebra::curves::forms::short_weierstrass, @@ -99,41 +99,41 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(const group_value_type &point, TIter &iter) { if (point.is_zero()) { *iter++ = 0x00; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } typename group_type::curve_type::template g1_type::value_type point_affine = point.to_affine(); *iter++ = (point_affine.Y.data.base() & 1u) == 0u ? 0x02 : 0x03; - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::detail::secp_r1_g1> { using group_type = typename algebra::curves::secp_r1::template g1_type<>; using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; using curve_params = typename group_type::params_type; using integral_type = typename group_value_type::field_type::integral_type; @@ -143,7 +143,7 @@ namespace nil { template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; @@ -152,21 +152,21 @@ namespace nil { if (0x00 == prefix) { point = group_value_type::zero(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } if (prefix != 0x02 && prefix != 0x03) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } constexpr static const std::size_t sizeof_field_element = params_type::bit_length() / (group_value_type::field_type::arity); - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); g1_field_value_type x_mod(x); g1_field_value_type y2_mod = x_mod * x_mod * x_mod + curve_params::a * x_mod + curve_params::b; if (!y2_mod.is_square()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } g1_field_value_type y_mod = y2_mod.sqrt(); @@ -179,7 +179,7 @@ namespace nil { point = group_value_type(x_mod, -y_mod); } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/vesta.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/vesta.hpp index 0b3b865a3e..bc91078ee4 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/vesta.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/processing/vesta.hpp @@ -86,7 +86,7 @@ namespace nil { * */ template struct curve_element_writer< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::vesta::template g1_type> { using group_type = typename algebra::curves::vesta:: @@ -94,34 +94,34 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(const group_value_type &point, TIter &iter) { if (point.is_zero()) { *iter++ = 0x00; - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } typename group_type::curve_type::template g1_type::value_type point_affine = point.to_affine(); *iter++ = (point_affine.Y.data.base() & 1u) == 0u ? 0x02 : 0x03; - write_data( + multiprecision::processing::write_data( static_cast(point_affine.X.data), iter); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; template struct curve_element_reader< - nil::marshalling::endian::big_endian, + nil::crypto3::marshalling::endian::big_endian, typename algebra::curves::vesta::template g1_type> { using group_type = typename algebra::curves::vesta:: @@ -129,7 +129,7 @@ namespace nil { using group_value_type = typename group_type::value_type; using coordinates = typename group_value_type::coordinates; using form = typename group_value_type::form; - using endianness = nil::marshalling::endian::big_endian; + using endianness = nil::crypto3::marshalling::endian::big_endian; using params_type = curve_element_marshalling_params; using curve_params = typename group_type::params_type; using integral_type = typename group_value_type::field_type::integral_type; @@ -139,7 +139,7 @@ namespace nil { template static typename std::enable_if< std::is_same::value_type>::value, - nil::marshalling::status_type>::type + nil::crypto3::marshalling::status_type>::type process(group_value_type &point, TIter &iter) { using chunk_type = typename TIter::value_type; @@ -148,21 +148,21 @@ namespace nil { if (0x00 == prefix) { point = group_value_type::zero(); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } if (prefix != 0x02 && prefix != 0x03) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } constexpr static const std::size_t sizeof_field_element = params_type::bit_length() / (group_value_type::field_type::arity); - integral_type x = read_data(iter); + integral_type x = multiprecision::processing::read_data(iter); g1_field_value_type x_mod(x); g1_field_value_type y2_mod = x_mod * x_mod * x_mod + curve_params::a * x_mod + curve_params::b; if (!y2_mod.is_square()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } g1_field_value_type y_mod = y2_mod.sqrt(); @@ -175,7 +175,7 @@ namespace nil { point = group_value_type(x_mod, -y_mod); } - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } }; diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/type_traits.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/type_traits.hpp index 3c1418bef8..b40f2f3c74 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/type_traits.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/type_traits.hpp @@ -53,7 +53,7 @@ namespace nil { } // namespace types } // namespace marshalling } // namespace crypto3 - namespace marshalling { + namespace crypto3::marshalling { /// @brief Compile time check function of whether a provided type is any /// variant of nil::crypto3::marshalling::types::curve_element. @@ -109,4 +109,4 @@ namespace nil { } // namespace marshalling } // namespace nil -#endif // CRYPTO3_MARSHALLING_ALGEBRA_TYPE_TRAITS_HPP \ No newline at end of file +#endif // CRYPTO3_MARSHALLING_ALGEBRA_TYPE_TRAITS_HPP diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/curve_element.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/curve_element.hpp index 03ff1e6958..ccc80b439f 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/curve_element.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/curve_element.hpp @@ -49,13 +49,13 @@ namespace nil { namespace types { template class curve_element - : private ::nil::marshalling::types::detail::adapt_basic_field_type< + : private ::nil::crypto3::marshalling::types::detail::adapt_basic_field_type< crypto3::marshalling::types::detail::basic_curve_element, TOptions...> { using curve_group_type = CurveGroupType; - using base_impl_type = ::nil::marshalling::types::detail::adapt_basic_field_type< + using base_impl_type = ::nil::crypto3::marshalling::types::detail::adapt_basic_field_type< crypto3::marshalling::types::detail::basic_curve_element, TOptions...>; @@ -67,7 +67,7 @@ namespace nil { using version_type = typename base_impl_type::version_type; /// @brief All the options provided to this class bundled into struct. - using parsed_options_type = ::nil::marshalling::types::detail::options_parser; + using parsed_options_type = ::nil::crypto3::marshalling::types::detail::options_parser; /// @brief Type of underlying curve_element value. /// @details Same as template parameter T to this class. @@ -141,7 +141,7 @@ namespace nil { /// @return Status of read operation. /// @post Iterator is advanced. template - nil::marshalling::status_type read(TIter &iter, std::size_t size) { + nil::crypto3::marshalling::status_type read(TIter &iter, std::size_t size) { return base_impl_type::read(iter, size); } @@ -161,7 +161,7 @@ namespace nil { /// @return Status of write operation. /// @post Iterator is advanced. template - nil::marshalling::status_type write(TIter &iter, std::size_t size) const { + nil::crypto3::marshalling::status_type write(TIter &iter, std::size_t size) const { return base_impl_type::write(iter, size); } @@ -181,7 +181,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -200,71 +200,71 @@ namespace nil { // because such an adapter uses pure byte reading, // incompatible with crypto3::curve_element static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_length option is not applicable to " "crypto3::curve_element type"); // because such an adapter uses pure byte reading, // incompatible with crypto3::curve_element static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio option is not applicable to " + "nil::crypto3::marshalling::option::scaling_ratio option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to " + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to " + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to " + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to " "crypto3::curve_element type"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to " + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to " "crypto3::curve_element type"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "crypto3::curve_element type"); }; @@ -338,18 +338,18 @@ namespace nil { return false; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::curve_element type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::curve_element type /// in order to have access to its internal types. - /// @related nil::marshalling::types::curve_element + /// @related nil::crypto3::marshalling::types::curve_element template inline curve_element & to_field_base(curve_element &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::curve_element type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::curve_element type /// in order to have access to its internal types. - /// @related nil::marshalling::types::curve_element + /// @related nil::crypto3::marshalling::types::curve_element template inline const curve_element & to_field_base(const curve_element &field) { @@ -357,16 +357,16 @@ namespace nil { } template - using curve_element_vector = nil::marshalling::types::standard_array_list< + using curve_element_vector = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, curve_element>; template - curve_element_vector> + curve_element_vector> fill_curve_element_vector( const std::vector &curve_elem_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_element_type = curve_element; @@ -380,11 +380,11 @@ namespace nil { template std::vector make_curve_element_vector( - const curve_element_vector> + const curve_element_vector> &curve_elem_vector) { std::vector result; - const std::vector, CurveGroupType>> &values = + const std::vector, CurveGroupType>> &values = curve_elem_vector.value(); std::size_t size = values.size(); diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/detail/curve_element/basic_type.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/detail/curve_element/basic_type.hpp index b7cfecf74d..d34447964d 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/detail/curve_element/basic_type.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/detail/curve_element/basic_type.hpp @@ -107,8 +107,8 @@ namespace nil { } template - nil::marshalling::status_type read(TIter &iter, std::size_t size) { - nil::marshalling::status_type status = reader_type::process(value(), iter); + nil::crypto3::marshalling::status_type read(TIter &iter, std::size_t size) { + nil::crypto3::marshalling::status_type status = reader_type::process(value(), iter); iter += max_length(); return status; } @@ -119,8 +119,8 @@ namespace nil { } template - nil::marshalling::status_type write(TIter &iter, std::size_t size) const { - nil::marshalling::status_type status = writer_type::process(value(), iter); + nil::crypto3::marshalling::status_type write(TIter &iter, std::size_t size) const { + nil::crypto3::marshalling::status_type status = writer_type::process(value(), iter); iter += max_length(); return status; } diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/fast_curve_element.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/fast_curve_element.hpp index f9afce2509..d1380864ad 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/fast_curve_element.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/fast_curve_element.hpp @@ -49,7 +49,7 @@ namespace nil { namespace types { template - using fast_curve_element = nil::marshalling::types::bundle< + using fast_curve_element = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // X @@ -57,31 +57,31 @@ namespace nil { // Y field_element, // is_infinity - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral >>; template - fast_curve_element, CurveGroupType> + fast_curve_element, CurveGroupType> fill_fast_curve_element(const typename CurveGroupType::value_type &point) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using field_element_type = field_element; std::uint8_t is_infinity = point.is_zero(); auto affine_point = point.to_affine(); - return fast_curve_element, CurveGroupType>( + return fast_curve_element, CurveGroupType>( std::make_tuple( field_element_type(affine_point.X), field_element_type(affine_point.Y), - nil::marshalling::types::integral(is_infinity) + nil::crypto3::marshalling::types::integral(is_infinity) )); } template typename CurveGroupType::value_type make_fast_curve_element( - const fast_curve_element, CurveGroupType> + const fast_curve_element, CurveGroupType> &filled_curve_element) { std::uint8_t is_infinity = std::get<2>(filled_curve_element.value()).value(); if(is_infinity) { @@ -93,23 +93,23 @@ namespace nil { } template - nil::marshalling::types::array_list< - nil::marshalling::field_type, - fast_curve_element, CurveGroupType>, - nil::marshalling::option::sequence_size_field_prefix< - nil::marshalling::types::integral, std::size_t>>> + nil::crypto3::marshalling::types::array_list< + nil::crypto3::marshalling::field_type, + fast_curve_element, CurveGroupType>, + nil::crypto3::marshalling::option::sequence_size_field_prefix< + nil::crypto3::marshalling::types::integral, std::size_t>>> fill_fast_curve_element_vector( const std::vector &curve_elem_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using fast_curve_element_type = fast_curve_element; - using fast_curve_element_vector_type = nil::marshalling::types::array_list< + using fast_curve_element_vector_type = nil::crypto3::marshalling::types::array_list< TTypeBase, fast_curve_element_type, - nil::marshalling::option::sequence_size_field_prefix< - nil::marshalling::types::integral, std::size_t>>>; + nil::crypto3::marshalling::option::sequence_size_field_prefix< + nil::crypto3::marshalling::types::integral, std::size_t>>>; fast_curve_element_vector_type result; @@ -122,15 +122,15 @@ namespace nil { template std::vector make_fast_curve_element_vector( - const nil::marshalling::types::array_list< - nil::marshalling::field_type, - fast_curve_element, CurveGroupType>, - nil::marshalling::option::sequence_size_field_prefix< - nil::marshalling::types::integral, std::size_t>>> + const nil::crypto3::marshalling::types::array_list< + nil::crypto3::marshalling::field_type, + fast_curve_element, CurveGroupType>, + nil::crypto3::marshalling::option::sequence_size_field_prefix< + nil::crypto3::marshalling::types::integral, std::size_t>>> &curve_elem_vector) { std::vector result; - const std::vector, CurveGroupType>> &values = + const std::vector, CurveGroupType>> &values = curve_elem_vector.value(); std::size_t size = values.size(); diff --git a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/field_element.hpp b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/field_element.hpp index e253e1d8d0..9979a6bb4e 100644 --- a/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/field_element.hpp +++ b/crypto3/libs/marshalling/algebra/include/nil/crypto3/marshalling/algebra/types/field_element.hpp @@ -118,14 +118,14 @@ namespace nil { typename FieldValueType, typename... TOptions> class pure_field_element - : private ::nil::marshalling::types::detail::adapt_basic_field_type< + : private ::nil::crypto3::marshalling::types::detail::adapt_basic_field_type< integral, TOptions...> { static_assert(algebra::is_field_element::value); static_assert(!algebra::is_extended_field_element::value); - using base_impl_type = ::nil::marshalling::types::detail::adapt_basic_field_type< + using base_impl_type = ::nil::crypto3::marshalling::types::detail::adapt_basic_field_type< integral, TOptions...>; @@ -137,7 +137,7 @@ namespace nil { using version_type = typename base_impl_type::version_type; /// @brief All the options provided to this class bundled into struct. - using parsed_options_type = ::nil::marshalling::types::detail::options_parser; + using parsed_options_type = ::nil::crypto3::marshalling::types::detail::options_parser; /// @brief Type of underlying field_element value. /// @details Same as template parameter T to this class. @@ -212,7 +212,7 @@ namespace nil { /// @return Status of read operation. /// @post Iterator is advanced. template - nil::marshalling::status_type read(TIter &iter, std::size_t size) { + nil::crypto3::marshalling::status_type read(TIter &iter, std::size_t size) { return base_impl_type::read(iter, size); } @@ -232,7 +232,7 @@ namespace nil { /// @return Status of write operation. /// @post Iterator is advanced. template - nil::marshalling::status_type write(TIter &iter, std::size_t size) const { + nil::crypto3::marshalling::status_type write(TIter &iter, std::size_t size) const { return base_impl_type::write(iter, size); } @@ -252,7 +252,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -271,71 +271,71 @@ namespace nil { // because such an adapter uses pure byte reading, // incompatible with crypto3::field_element static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_length option is not applicable to " "crypto3::field_element type"); // because such an adapter uses pure byte reading, // incompatible with crypto3::field_element static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio option is not applicable to " + "nil::crypto3::marshalling::option::scaling_ratio option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to " + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to " + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to " + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to " + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "crypto3::field_element type"); }; @@ -343,22 +343,22 @@ namespace nil { typename FieldValueType, typename... TOptions> class extended_field_element - : private ::nil::marshalling::types::detail::adapt_basic_field_type< - nil::marshalling::types::array_list< - nil::marshalling::field_type, + : private ::nil::crypto3::marshalling::types::detail::adapt_basic_field_type< + nil::crypto3::marshalling::types::array_list< + nil::crypto3::marshalling::field_type, integral, - nil::marshalling::option::fixed_size_storage< + nil::crypto3::marshalling::option::fixed_size_storage< FieldValueType::field_type::arity>>, TOptions...> { static_assert(algebra::is_field_element::value); static_assert(algebra::is_extended_field_element::value); - using base_impl_type = ::nil::marshalling::types::detail::adapt_basic_field_type< - typename nil::marshalling::types::array_list< - nil::marshalling::field_type, + using base_impl_type = ::nil::crypto3::marshalling::types::detail::adapt_basic_field_type< + typename nil::crypto3::marshalling::types::array_list< + nil::crypto3::marshalling::field_type, integral, - nil::marshalling::option::fixed_size_storage< + nil::crypto3::marshalling::option::fixed_size_storage< FieldValueType::field_type::arity>>, TOptions...>; @@ -370,7 +370,7 @@ namespace nil { using version_type = typename base_impl_type::version_type; /// @brief All the options provided to this class bundled into struct. - using parsed_options_type = ::nil::marshalling::types::detail::options_parser; + using parsed_options_type = ::nil::crypto3::marshalling::types::detail::options_parser; /// @brief Type of underlying field_element value. /// @details Same as template parameter T to this class. @@ -464,7 +464,7 @@ namespace nil { /// @return Status of read operation. /// @post Iterator is advanced. template - nil::marshalling::status_type read(TIter &iter, std::size_t size) { + nil::crypto3::marshalling::status_type read(TIter &iter, std::size_t size) { return base_impl_type::read(iter, size); } @@ -484,7 +484,7 @@ namespace nil { /// @return Status of write operation. /// @post Iterator is advanced. template - nil::marshalling::status_type write(TIter &iter, std::size_t size) const { + nil::crypto3::marshalling::status_type write(TIter &iter, std::size_t size) const { return base_impl_type::write(iter, size); } @@ -504,7 +504,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -523,71 +523,71 @@ namespace nil { // because such an adapter uses pure byte reading, // incompatible with crypto3::field_element static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_length option is not applicable to " "crypto3::field_element type"); // because such an adapter uses pure byte reading, // incompatible with crypto3::field_element static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio option is not applicable to " + "nil::crypto3::marshalling::option::scaling_ratio option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to " + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to " + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to " + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to " "crypto3::field_element type"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to " + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to " "crypto3::field_element type"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "crypto3::field_element type"); }; @@ -669,18 +669,18 @@ namespace nil { // return false; // } - // /// @brief Upcast type of the field definition to its parent nil::marshalling::types::field_element type + // /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::field_element type // /// in order to have access to its internal types. - // /// @related nil::marshalling::types::field_element + // /// @related nil::crypto3::marshalling::types::field_element // template // inline field_element & // to_field_base(field_element &field) { // return field; // } - // /// @brief Upcast type of the field definition to its parent nil::marshalling::types::field_element type + // /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::field_element type // /// in order to have access to its internal types. - // /// @related nil::marshalling::types::field_element + // /// @related nil::crypto3::marshalling::types::field_element // template // inline const field_element & // to_field_base(const field_element &field) { @@ -689,15 +689,15 @@ namespace nil { template - using field_element_vector = nil::marshalling::types::standard_array_list< + using field_element_vector = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element>; template - field_element_vector> + field_element_vector> fill_field_element_vector(const std::vector &field_elem_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using field_element_type = field_element; field_element_vector result; @@ -709,7 +709,7 @@ namespace nil { template std::vector make_field_element_vector( - const field_element_vector>& field_elem_vector) { + const field_element_vector>& field_elem_vector) { std::vector result; result.reserve(field_elem_vector.value().size()); diff --git a/crypto3/libs/marshalling/algebra/include/nil/detail/type_traits.hpp b/crypto3/libs/marshalling/algebra/include/nil/detail/type_traits.hpp deleted file mode 100644 index ee7bbf5f27..0000000000 --- a/crypto3/libs/marshalling/algebra/include/nil/detail/type_traits.hpp +++ /dev/null @@ -1,309 +0,0 @@ -//---------------------------------------------------------------------------// -// Copyright (c) 2018-2021 Mikhail Komarov -// Copyright (c) 2020-2021 Nikita Kaskov -// -// MIT License -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -//---------------------------------------------------------------------------// - -#ifndef NIL_DETAIL_TYPE_TRAITS_HPP -#define NIL_DETAIL_TYPE_TRAITS_HPP - -#include - -#include -#include - -#include -#include - -#ifndef GENERATE_HAS_MEMBER_TYPE -#define GENERATE_HAS_MEMBER_TYPE(Type) \ - template \ - class HasMemberType_##Type { \ - public: \ - static constexpr bool RESULT = false; \ - }; \ - \ - template \ - class HasMemberType_##Type::value || std::is_union::value>::type> { \ - private: \ - using Yes = char[2]; \ - using No = char[1]; \ - \ - struct Fallback { \ - struct Type { }; \ - }; \ - struct Derived : T, Fallback { }; \ - \ - template \ - static No &test(typename U::Type *); \ - template \ - static Yes &test(U *); \ - \ - public: \ - static constexpr bool RESULT = sizeof(test(nullptr)) == sizeof(Yes); \ - }; \ - \ - template \ - struct has_##Type : public std::integral_constant::RESULT> { }; -#endif //GENERATE_HAS_MEMBER_TYPE - -#ifndef GENERATE_HAS_MEMBER -#define GENERATE_HAS_MEMBER(member) \ - template \ - class HasMember_##member { \ - public: \ - static constexpr bool RESULT = false; \ - }; \ - \ - template \ - class HasMember_##member::value || std::is_union::value>::type> { \ - private: \ - using Yes = char[2]; \ - using No = char[1]; \ - \ - struct Fallback { \ - int member; \ - }; \ - struct Derived : T, Fallback { }; \ - \ - template \ - static No &test(decltype(U::member) *); \ - template \ - static Yes &test(U *); \ - \ - public: \ - static constexpr bool RESULT = sizeof(test(nullptr)) == sizeof(Yes); \ - }; \ - \ - template \ - struct has_##member : public std::integral_constant::RESULT> { }; -#endif //GENERATE_HAS_MEMBER - -#ifndef GENERATE_HAS_MEMBER_FUNCTION -#define GENERATE_HAS_MEMBER_FUNCTION(Function, ...) \ - \ - template \ - struct has_##Function { \ - struct Fallback { \ - void Function(##__VA_ARGS__); \ - }; \ - \ - struct Derived : Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; -#endif //GENERATE_HAS_MEMBER_FUNCTION - -#ifndef GENERATE_HAS_MEMBER_CONST_FUNCTION -#define GENERATE_HAS_MEMBER_CONST_FUNCTION(Function, ...) \ - \ - template \ - struct has_##Function { \ - struct Fallback { \ - void Function(##__VA_ARGS__) const; \ - }; \ - \ - struct Derived : Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; -#endif //GENERATE_HAS_MEMBER_CONST_FUNCTION - -#ifndef GENERATE_HAS_MEMBER_RETURN_FUNCTION -#define GENERATE_HAS_MEMBER_RETURN_FUNCTION(Function, ReturnType, ...) \ - \ - template \ - struct has_##Function { \ - struct Dummy { \ - typedef void ReturnType; \ - }; \ - typedef typename std::conditional::value, T, Dummy>::type TType; \ - typedef typename TType::ReturnType type; \ - \ - struct Fallback { \ - type Function(##__VA_ARGS__); \ - }; \ - \ - struct Derived : TType, Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; -#endif //GENERATE_HAS_MEMBER_RETURN_FUNCTION - -#ifndef GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION -#define GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(Function, ReturnType, ...) \ - \ - template \ - struct has_##Function { \ - struct Dummy { \ - typedef void ReturnType; \ - }; \ - typedef typename std::conditional::value, T, Dummy>::type TType; \ - typedef typename TType::ReturnType type; \ - \ - struct Fallback { \ - type Function(##__VA_ARGS__) const; \ - }; \ - \ - struct Derived : TType, Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; -#endif //GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION - -namespace nil { - namespace detail { - - GENERATE_HAS_MEMBER_TYPE(iterator) - GENERATE_HAS_MEMBER_TYPE(const_iterator) - - GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(begin, const_iterator) - GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(end, const_iterator) - - template - struct is_iterator { - static char test(...); - - template::difference_type, - typename = typename std::iterator_traits::pointer, - typename = typename std::iterator_traits::reference, - typename = typename std::iterator_traits::value_type, - typename = typename std::iterator_traits::iterator_category> - static long test(U &&); - - constexpr static bool value = std::is_same())), long>::value; - }; - - template - struct is_range { - static const bool value = has_begin::value && has_end::value; - }; - - template - struct is_container { - static const bool value - = has_const_iterator::value && has_begin::value && has_end::value; - }; - - /// @brief Check whether provided type is a variant of - /// std::tuple. - /// @tparam TType Type to check. - template - struct is_tuple { - /// @brief By default Value has value false. Will be true for any - /// variant of std::tuple. - static const bool value = false; - }; - - /// @cond SKIP_DOC - template - struct is_tuple> { - static const bool value = true; - }; - /// @endcond - - //---------------------------------------- - - /// @brief Check whether TType type is included in the tuple TTuple - /// @tparam TType Type to check - /// @tparam TTuple Tuple - /// @pre @code IsTuple::value == true @endcode - template - class is_in_tuple { - static_assert(is_tuple::value, "TTuple must be std::tuple"); - - public: - /// @brief By default the value is false, will be set to true if TType - /// is found in TTuple. - static const bool value = false; - }; - - /// @cond SKIP_DOC - template - class is_in_tuple> { - public: - static const bool value - = std::is_same::value || is_in_tuple>::value; - }; - - template - class is_in_tuple> { - public: - static const bool value = false; - }; - - template - struct is_array { - static const bool value = false; - }; - - template - struct is_array> { - static const bool value = true; - }; - - template - struct is_array> { - static const bool value = true; - }; - - /// @endcond - } // namespace detail -} // namespace nil - -#endif // NIL_DETAIL_TYPE_TRAITS_HPP \ No newline at end of file diff --git a/crypto3/libs/marshalling/algebra/test/curve_element.cpp b/crypto3/libs/marshalling/algebra/test/curve_element.cpp index 8c099ecf0f..db5df14b18 100644 --- a/crypto3/libs/marshalling/algebra/test/curve_element.cpp +++ b/crypto3/libs/marshalling/algebra/test/curve_element.cpp @@ -89,14 +89,14 @@ void test_group_element(T val) { using unit_type = unsigned char; - static_assert(nil::marshalling::is_compatible::value); - nil::marshalling::status_type status; + static_assert(nil::crypto3::marshalling::is_compatible::value); + nil::crypto3::marshalling::status_type status; - std::vector cv = nil::marshalling::pack(val, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + std::vector cv = nil::crypto3::marshalling::pack(val, status); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - T test_val = nil::marshalling::pack(cv, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + T test_val = nil::crypto3::marshalling::pack(cv, status); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); BOOST_CHECK_EQUAL(val.to_affine(), test_val.to_affine()); } @@ -136,8 +136,8 @@ void test_pairing_curve(std::string curve_name) BOOST_AUTO_TEST_SUITE(curve_element_test_suite) -using big_endian = nil::marshalling::option::big_endian; -using little_endian = nil::marshalling::option::little_endian; +using big_endian = nil::crypto3::marshalling::option::big_endian; +using little_endian = nil::crypto3::marshalling::option::little_endian; BOOST_AUTO_TEST_CASE(curve_element_mnt4) { test_pairing_curve("mnt4_298"); diff --git a/crypto3/libs/marshalling/algebra/test/curve_element_fixed_size_container.cpp b/crypto3/libs/marshalling/algebra/test/curve_element_fixed_size_container.cpp index ba4a332a8e..3036a8db59 100644 --- a/crypto3/libs/marshalling/algebra/test/curve_element_fixed_size_container.cpp +++ b/crypto3/libs/marshalling/algebra/test/curve_element_fixed_size_container.cpp @@ -66,22 +66,22 @@ template void test_curve_element_fixed_size_container_big_endian(std::array val_container) { using namespace nil::crypto3::marshalling; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; using unit_type = unsigned char; - static_assert(nil::marshalling::is_compatible::value); + static_assert(nil::crypto3::marshalling::is_compatible::value); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector cv = - nil::marshalling::pack(val_container, status); + nil::crypto3::marshalling::pack(val_container, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::array test_val = nil::marshalling::pack(cv, status); + std::array test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(std::equal(val_container.begin(), val_container.end(), test_val.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template diff --git a/crypto3/libs/marshalling/algebra/test/curve_element_non_fixed_size_container.cpp b/crypto3/libs/marshalling/algebra/test/curve_element_non_fixed_size_container.cpp index 083e6b1fe2..91d6e8a522 100644 --- a/crypto3/libs/marshalling/algebra/test/curve_element_non_fixed_size_container.cpp +++ b/crypto3/libs/marshalling/algebra/test/curve_element_non_fixed_size_container.cpp @@ -61,16 +61,16 @@ void test_curve_element_non_fixed_size_container(std::vector val_container) { using unit_type = unsigned char; - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector cv = - nil::marshalling::pack(val_container, status); + nil::crypto3::marshalling::pack(val_container, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::vector test_val = nil::marshalling::pack(cv, status); + std::vector test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(std::equal(val_container.begin(), val_container.end(), test_val.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template @@ -93,7 +93,7 @@ BOOST_AUTO_TEST_SUITE(curve_element_non_fixed_size_container_test_suite) BOOST_AUTO_TEST_CASE(curve_element_non_fixed_size_container_bls12_381_g1) { std::cout << "BLS12-381 g1 group non fixed size container test started" << std::endl; - test_curve_element_non_fixed_size_container::g1_type<>, 25>(); std::cout << "BLS12-381 g1 group non fixed size container test finished" << std::endl; @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(curve_element_non_fixed_size_container_bls12_381_g1) { BOOST_AUTO_TEST_CASE(curve_element_non_fixed_size_container_bls12_381_g2) { std::cout << "BLS12-381 g2 group non fixed size container test started" << std::endl; - test_curve_element_non_fixed_size_container::g2_type<>, 5>(); std::cout << "BLS12-381 g2 group non fixed size container test finished" << std::endl; diff --git a/crypto3/libs/marshalling/algebra/test/field_element.cpp b/crypto3/libs/marshalling/algebra/test/field_element.cpp index f435cdec08..bc77873bf4 100644 --- a/crypto3/libs/marshalling/algebra/test/field_element.cpp +++ b/crypto3/libs/marshalling/algebra/test/field_element.cpp @@ -48,26 +48,26 @@ void test_field_element(T val) { using namespace nil::crypto3::marshalling; using unit_type = unsigned char; - using field_element_type = types::field_element, + using field_element_type = types::field_element, T>; static_assert(nil::crypto3::algebra::is_field_element::value); - static_assert(nil::marshalling::is_field_element::value); - static_assert(nil::marshalling::is_compatible::value); + static_assert(nil::crypto3::marshalling::is_field_element::value); + static_assert(nil::crypto3::marshalling::is_compatible::value); - using inferenced_type = typename nil::marshalling::is_compatible::template type; + using inferenced_type = typename nil::crypto3::marshalling::is_compatible::template type; static_assert(std::is_same::value); - nil::marshalling::status_type status; - std::vector cv = nil::marshalling::pack(val, status); + nil::crypto3::marshalling::status_type status; + std::vector cv = nil::crypto3::marshalling::pack(val, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - T test_val = nil::marshalling::pack(cv, status); + T test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(val == test_val); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template @@ -76,7 +76,7 @@ void test_field_element_vector() { using namespace nil::crypto3::marshalling; using unit_type = unsigned char; - using field_element_type = types::field_element, + using field_element_type = types::field_element, T>; std::vector vec(16); @@ -85,15 +85,15 @@ void test_field_element_vector() { v = nil::crypto3::algebra::random_element(); } - nil::marshalling::status_type status; - std::vector cv = nil::marshalling::pack(vec, status); + nil::crypto3::marshalling::status_type status; + std::vector cv = nil::crypto3::marshalling::pack(vec, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::vector test_val = nil::marshalling::pack(cv, status); + std::vector test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(vec == test_val); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } @@ -111,22 +111,22 @@ BOOST_AUTO_TEST_SUITE(field_element_test_suite) BOOST_AUTO_TEST_CASE(field_element_bls12_381_g1_field_be) { test_field_element::g1_type<>::field_type, - nil::marshalling::option::big_endian>(); + nil::crypto3::marshalling::option::big_endian>(); } BOOST_AUTO_TEST_CASE(field_element_bls12_381_g1_field_le) { test_field_element::g1_type<>::field_type, - nil::marshalling::option::little_endian>(); + nil::crypto3::marshalling::option::little_endian>(); } BOOST_AUTO_TEST_CASE(field_element_bls12_381_g2_field_be) { test_field_element::g2_type<>::field_type, - nil::marshalling::option::big_endian>(); + nil::crypto3::marshalling::option::big_endian>(); } BOOST_AUTO_TEST_CASE(field_element_bls12_381_g2_field_le) { test_field_element::g2_type<>::field_type, - nil::marshalling::option::little_endian>(); + nil::crypto3::marshalling::option::little_endian>(); } BOOST_AUTO_TEST_SUITE_END() diff --git a/crypto3/libs/marshalling/algebra/test/field_element_non_fixed_size_container.cpp b/crypto3/libs/marshalling/algebra/test/field_element_non_fixed_size_container.cpp index a9c2d69fc2..7df6ab4ef2 100644 --- a/crypto3/libs/marshalling/algebra/test/field_element_non_fixed_size_container.cpp +++ b/crypto3/libs/marshalling/algebra/test/field_element_non_fixed_size_container.cpp @@ -58,16 +58,16 @@ void test_field_element_non_fixed_size_container(std::vector val_container) { std::size_t units_bits = 8; using unit_type = unsigned char; - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector cv = - nil::marshalling::pack(val_container, status); + nil::crypto3::marshalling::pack(val_container, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::vector test_val = nil::marshalling::pack(cv, status); + std::vector test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(std::equal(val_container.begin(), val_container.end(), test_val.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template @@ -92,7 +92,7 @@ BOOST_AUTO_TEST_SUITE(field_element_non_fixed_size_container_test_suite) BOOST_AUTO_TEST_CASE(field_element_non_fixed_size_container_bls12_381_g1_field_be) { std::cout << "BLS12-381 g1 group field non fixed size container big-endian test started" << std::endl; test_field_element_non_fixed_size_container::g1_type<>::field_type, - nil::marshalling::option::big_endian, + nil::crypto3::marshalling::option::big_endian, 5>(); std::cout << "BLS12-381 g1 group field non fixed size container big-endian test finished" << std::endl; } @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(field_element_non_fixed_size_container_bls12_381_g1_field_b BOOST_AUTO_TEST_CASE(field_element_non_fixed_size_container_bls12_381_g1_field_le) { std::cout << "BLS12-381 g1 group field non fixed size container little-endian test started" << std::endl; test_field_element_non_fixed_size_container::g1_type<>::field_type, - nil::marshalling::option::little_endian, + nil::crypto3::marshalling::option::little_endian, 5>(); std::cout << "BLS12-381 g1 group field non fixed size container little-endian test finished" << std::endl; } @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(field_element_non_fixed_size_container_bls12_381_g1_field_l BOOST_AUTO_TEST_CASE(field_element_non_fixed_size_container_bls12_381_g2_field_be) { std::cout << "BLS12-381 g2 group field non fixed size container big-endian test started" << std::endl; test_field_element_non_fixed_size_container::g2_type<>::field_type, - nil::marshalling::option::big_endian, + nil::crypto3::marshalling::option::big_endian, 7>(); std::cout << "BLS12-381 g2 group field non fixed size container big-endian test finished" << std::endl; } @@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE(field_element_non_fixed_size_container_bls12_381_g2_field_b BOOST_AUTO_TEST_CASE(field_element_non_fixed_size_container_bls12_381_g2_field_le) { std::cout << "BLS12-381 g2 group field non fixed size container little-endian test started" << std::endl; test_field_element_non_fixed_size_container::g2_type<>::field_type, - nil::marshalling::option::little_endian, + nil::crypto3::marshalling::option::little_endian, 7>(); std::cout << "BLS12-381 g2 group field non fixed size container little-endian test finished" << std::endl; } diff --git a/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_node.hpp b/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_node.hpp index c273ec063a..19f9963978 100644 --- a/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_node.hpp +++ b/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_node.hpp @@ -59,8 +59,8 @@ namespace nil { typename std::enable_if::value_type>::value>::type> { - using type = nil::marshalling::types::standard_array_list< - TTypeBase, nil::marshalling::types::integral>; + using type = nil::crypto3::marshalling::types::standard_array_list< + TTypeBase, nil::crypto3::marshalling::types::integral>; }; // For Poseidon, Merkle node will contain a Group Element, not a vector of bytes. @@ -103,13 +103,13 @@ namespace nil { std::is_same::value_type>::value, bool>::type = true> - typename merkle_node_value, ValueType>::type + typename merkle_node_value, ValueType>::type fill_merkle_node_value(const ValueType &node_value) { - using TTypeBase = nil::marshalling::field_type; - using octet_marshalling_type = nil::marshalling::types::integral; + using TTypeBase = nil::crypto3::marshalling::field_type; + using octet_marshalling_type = nil::crypto3::marshalling::types::integral; - typename merkle_node_value, ValueType>::type + typename merkle_node_value, ValueType>::type filled_node_value; for (const auto c : node_value) { filled_node_value.value().push_back(octet_marshalling_type(c)); @@ -124,14 +124,14 @@ namespace nil { GroupElementType >::value, bool>::type = true> typename merkle_node_value< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, GroupElementType >::type fill_merkle_node_value(const GroupElementType &node_value) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - typename merkle_node_value, GroupElementType>::type filled_node_value = + typename merkle_node_value, GroupElementType>::type filled_node_value = field_element(node_value); return filled_node_value; } @@ -144,7 +144,7 @@ namespace nil { nil::crypto3::containers::merkle_proof>::value, bool>::type = true> - typename merkle_node_value, MerkleProof>::type + typename merkle_node_value, MerkleProof>::type fill_merkle_node_value(const typename MerkleProof::value_type &node_value) { return fill_merkle_node_value(node_value); } @@ -157,7 +157,7 @@ namespace nil { nil::crypto3::containers::merkle_tree>::value, bool>::type = true> - typename merkle_node_value, MerkleTree>::type + typename merkle_node_value, MerkleTree>::type fill_merkle_node_value(const typename MerkleTree::value_type &node_value) { return fill_merkle_node_value(node_value); } @@ -170,7 +170,7 @@ namespace nil { typename std::iterator_traits::value_type>::value, bool>::type = true> ValueType make_merkle_node_value( - const typename merkle_node_value, ValueType>::type &filled_node_value) + const typename merkle_node_value, ValueType>::type &filled_node_value) { ValueType node_value; if (node_value.size() != filled_node_value.value().size()) { @@ -192,7 +192,7 @@ namespace nil { GroupElementType >::value, bool>::type = true> GroupElementType make_merkle_node_value(const typename merkle_node_value< - nil::marshalling::field_type, GroupElementType>::type &filled_node_value) + nil::crypto3::marshalling::field_type, GroupElementType>::type &filled_node_value) { return filled_node_value.value(); } @@ -205,7 +205,7 @@ namespace nil { MerkleProof::arity>>::value, bool>::type = true> typename MerkleProof::value_type make_merkle_node_value( - const typename merkle_node_value, MerkleProof>::type &filled_node_value) + const typename merkle_node_value, MerkleProof>::type &filled_node_value) { return make_merkle_node_value(filled_node_value); } @@ -219,7 +219,7 @@ namespace nil { MerkleTree::arity>>::value, bool>::type = true> typename MerkleTree::value_type make_merkle_node_value( - const typename merkle_node_value, MerkleTree>::type &filled_node_value) + const typename merkle_node_value, MerkleTree>::type &filled_node_value) { return make_merkle_node_value(filled_node_value); } diff --git a/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_proof.hpp b/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_proof.hpp index 7eb61246b3..26b519a282 100644 --- a/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_proof.hpp +++ b/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_proof.hpp @@ -53,17 +53,17 @@ namespace nil { namespace types { template struct merkle_proof_path_element { - using type = nil::marshalling::types::bundle, + nil::crypto3::marshalling::types::integral, // value_type _hash typename merkle_node_value::type>>; }; template struct merkle_proof_layer { - using type = nil::marshalling::types::standard_array_list< + using type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, // path_element_t typename merkle_proof_path_element::type>; @@ -71,7 +71,7 @@ namespace nil { template struct merkle_proof_path { - using type = nil::marshalling::types::standard_array_list< + using type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, // layer path typename merkle_proof_layer::type>; @@ -85,22 +85,22 @@ namespace nil { MerkleProof::arity>>::value, bool>::type, typename... TOptions> - using merkle_proof = nil::marshalling::types::bundle< + using merkle_proof = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::size_t _li - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // value_type _root typename merkle_node_value::type, // path_type _path typename merkle_proof_path::type>>; template - typename merkle_proof_path_element, MerkleProof>::type + typename merkle_proof_path_element, MerkleProof>::type fill_merkle_proof_path_element(const typename MerkleProof::path_element_type &proof_path_element) { - using TTypeBase = nil::marshalling::field_type; - using uint64_t_marshalling_type = nil::marshalling::types::integral; + using TTypeBase = nil::crypto3::marshalling::field_type; + using uint64_t_marshalling_type = nil::crypto3::marshalling::types::integral; return typename merkle_proof_path_element::type( std::make_tuple(uint64_t_marshalling_type(proof_path_element._position), @@ -109,7 +109,7 @@ namespace nil { template typename MerkleProof::path_element_type make_merkle_proof_path_element( - const typename merkle_proof_path_element, MerkleProof>::type &filled_proof_path_element) + const typename merkle_proof_path_element, MerkleProof>::type &filled_proof_path_element) { typename MerkleProof::path_element_type proof_path_element; proof_path_element._position = std::get<0>(filled_proof_path_element.value()).value(); @@ -119,10 +119,10 @@ namespace nil { } template - typename merkle_proof_layer, MerkleProof>::type + typename merkle_proof_layer, MerkleProof>::type fill_merkle_proof_layer(const typename MerkleProof::layer_type &proof_layer) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; typename merkle_proof_layer::type filled_proof_layer; for (const auto &p : proof_layer) { @@ -134,7 +134,7 @@ namespace nil { template typename MerkleProof::layer_type make_merkle_proof_layer( - const typename merkle_proof_layer, MerkleProof>::type &filled_proof_layer) + const typename merkle_proof_layer, MerkleProof>::type &filled_proof_layer) { typename MerkleProof::layer_type proof_layer; for (std::size_t i = 0; i < filled_proof_layer.value().size(); ++i) { @@ -145,10 +145,10 @@ namespace nil { } template - typename merkle_proof_path, MerkleProof>::type + typename merkle_proof_path, MerkleProof>::type fill_merkle_proof_path(const typename MerkleProof::path_type &proof_path) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; typename merkle_proof_path::type filled_proof_path; for (const auto &l : proof_path) { @@ -159,7 +159,7 @@ namespace nil { template typename MerkleProof::path_type make_merkle_proof_path( - const typename merkle_proof_path, MerkleProof>::type &filled_proof_path) + const typename merkle_proof_path, MerkleProof>::type &filled_proof_path) { typename MerkleProof::path_type proof_path; proof_path.reserve(filled_proof_path.value().size()); @@ -171,11 +171,11 @@ namespace nil { } template - merkle_proof, MerkleProof> + merkle_proof, MerkleProof> fill_merkle_proof(const MerkleProof &mp) { - using TTypeBase = nil::marshalling::field_type; - using uint64_t_marshalling_type = nil::marshalling::types::integral; + using TTypeBase = nil::crypto3::marshalling::field_type; + using uint64_t_marshalling_type = nil::crypto3::marshalling::types::integral; using node_value_marshalling_type = typename merkle_node_value::type; using proof_path_marshalling_type = typename merkle_proof_path::type; @@ -189,7 +189,7 @@ namespace nil { template MerkleProof make_merkle_proof( - const merkle_proof, MerkleProof> &filled_merkle_proof) + const merkle_proof, MerkleProof> &filled_merkle_proof) { MerkleProof mp( std::get<0>(filled_merkle_proof.value()).value(), // mp._li diff --git a/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_tree.hpp b/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_tree.hpp index 5b63c9cc28..836bb7d62b 100644 --- a/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_tree.hpp +++ b/crypto3/libs/marshalling/containers/include/nil/crypto3/marshalling/containers/types/merkle_tree.hpp @@ -49,15 +49,15 @@ namespace nil { namespace marshalling { namespace types { template - using merkle_tree = nil::marshalling::types::standard_array_list< + using merkle_tree = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename merkle_node_value::type>; template - merkle_tree, MerkleTree> + merkle_tree, MerkleTree> fill_merkle_tree(const MerkleTree& tree) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; merkle_tree filled_tree; for (const auto &hash_value : tree) { @@ -69,7 +69,7 @@ namespace nil { template MerkleTree make_merkle_tree( - const merkle_tree, MerkleTree> &filled_merkle_tree) + const merkle_tree, MerkleTree> &filled_merkle_tree) { typename MerkleTree::container_type hashes; for (std::size_t i = 0; i < filled_merkle_tree.value().size(); ++i) { diff --git a/crypto3/libs/marshalling/core/docs/as_pack.md b/crypto3/libs/marshalling/core/docs/as_pack.md index 7f7071dc0c..bc4949ea6b 100644 --- a/crypto3/libs/marshalling/core/docs/as_pack.md +++ b/crypto3/libs/marshalling/core/docs/as_pack.md @@ -8,8 +8,8 @@ To read from one type and write to another type variable we will use such funtio ```cpp template static TField read_from_field(const char *buf, std::size_t size, - nil::marshalling::status_type expectedStatus - = nil::marshalling::status_type::success){ + nil::crypto3::marshalling::status_type expectedStatus + = nil::crypto3::marshalling::status_type::success){ typedef TField field_type; field_type field; @@ -18,7 +18,7 @@ static TField read_from_field(const char *buf, std::size_t size, auto status = field.read(iter, size); BOOST_CHECK(status == expectedStatus); - if (status != nil::marshalling::status_type::success) { + if (status != nil::crypto3::marshalling::status_type::success) { return field; } @@ -29,7 +29,7 @@ static TField read_from_field(const char *buf, std::size_t size, auto writeIter = &outDataBuf[0]; status = field.write(writeIter, diff); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); BOOST_CHECK(std::equal(buf, buf + diff, static_cast(&outDataBuf[0]))); auto writeDiff = static_cast(std::distance(&outDataBuf[0], writeIter)); @@ -43,8 +43,8 @@ Using this function we can easily pack data from one type to another: ```cpp using big_endian_array_type = - nil::marshalling::types::array_list< - nil::marshalling::field_type, + nil::crypto3::marshalling::types::array_list< + nil::crypto3::marshalling::field_type, std::uint32_t >; diff --git a/crypto3/libs/marshalling/core/docs/examples.md b/crypto3/libs/marshalling/core/docs/examples.md index f9f653299f..2ba42a4da0 100644 --- a/crypto3/libs/marshalling/core/docs/examples.md +++ b/crypto3/libs/marshalling/core/docs/examples.md @@ -4,24 +4,24 @@ Marshalling library. For proper and full tutorial please refer to proper documen ## Defining fields_type Almost every field definition type receives its base class as a template -parameter. This base class is expected to be a variant of **nil::marshalling::field_type** with +parameter. This base class is expected to be a variant of **nil::crypto3::marshalling::field_type** with endian information. ```cpp -using MyFieldBase = nil::marshalling::field_type; +using MyFieldBase = nil::crypto3::marshalling::field_type; ``` Now the definition of simple 2 byte unsigned integer value field looks like this: ```cpp -using MyIntField = nil::marshalling::types::int_value; +using MyIntField = nil::crypto3::marshalling::types::int_value; ``` The definition of unsigned integer with 3 bytes serialization length: ```cpp using My3ByteIntField = - nil::marshalling::types::int_value< + nil::crypto3::marshalling::types::int_value< MyFieldBase, // big endian serialization std::uint32_t, // store as 4 byte unsigned integer - nil::marshalling::option::fixed_length<3> // serialise using only 3 bytes + nil::crypto3::marshalling::option::fixed_length<3> // serialise using only 3 bytes >; ``` @@ -29,23 +29,23 @@ Definition of the year value, serialized using only 1 byte as an offset from year 2000, and default constructed as year 2017: ```cpp using MyYearField = - nil::marshalling::types::int_value< + nil::crypto3::marshalling::types::int_value< MyFieldBase, // big endian serialization std::int16_t, // store as 2 byte value - nil::marshalling::option::fixed_length<1>, // serialise using only 1 byte - nil::marshalling::option::num_value_ser_offset<-2000> // add (-2000) before serialization and + nil::crypto3::marshalling::option::fixed_length<1>, // serialise using only 1 byte + nil::crypto3::marshalling::option::num_value_ser_offset<-2000> // add (-2000) before serialization and // subtruct (-2000) after deserialization - nil::marshalling::option::default_num_value<2017> // construct with default value 2017 + nil::crypto3::marshalling::option::default_num_value<2017> // construct with default value 2017 >; ``` Variant length (Base-128) integer value: ```cpp using MyVarLengthField = - nil::marshalling::types::int_value< + nil::crypto3::marshalling::types::int_value< MyFieldBase, // big endian serialization std::uint32_t, // store as 4 bytes value - nil::marshalling::option::var_length<1, 4> // 1 to 4 bytes serialization length. + nil::crypto3::marshalling::option::var_length<1, 4> // 1 to 4 bytes serialization length. >; ``` @@ -60,19 +60,19 @@ enum class MyEnum : std::uint8_t // Serialise using 1 byte }; using MyEnumField = - nil::marshalling::types::enum_value< + nil::crypto3::marshalling::types::enum_value< MyFieldBase, // big endian serialization MyEnum, // use MyEnum as storage type - nil::marshalling::option::valid_num_value_range<0, (int)MyEnum::NumOfValues - 1> // provide range of valid values + nil::crypto3::marshalling::option::valid_num_value_range<0, (int)MyEnum::NumOfValues - 1> // provide range of valid values >; ``` 2 bytes bitmask value: ```cpp struct MyBitmaskField : public - nil::marshalling::types::bitmask_value< + nil::crypto3::marshalling::types::bitmask_value< MyFieldBase, // big endian serialization - nil::marshalling::types::fixed_length<2> // serialise using 2 bytes + nil::crypto3::marshalling::types::fixed_length<2> // serialise using 2 bytes bitmask_reserved_bits<0xfff0> // Specify reserved bits > { @@ -83,12 +83,12 @@ struct MyBitmaskField : public Bitfields: ```cpp struct MyBitfield : public - nil::marshalling::types::bitfield< + nil::crypto3::marshalling::types::bitfield< MyFieldBase, std::tuple< - nil::marshalling::types::int_value >, // 2 bits value - nil::marshalling::types::bitmask_value >, // 3 bits value - nil::marshalling::types::enum_value > // 3 bits value + nil::crypto3::marshalling::types::int_value >, // 2 bits value + nil::crypto3::marshalling::types::bitmask_value >, // 3 bits value + nil::crypto3::marshalling::types::enum_value > // 3 bits value > > { @@ -99,7 +99,7 @@ struct MyBitfield : public Simple raw data list: ```cpp using MyRawDataList = - nil::marshalling::types::array_list< + nil::crypto3::marshalling::types::array_list< MyFieldBase, std::uint8_t >; @@ -108,11 +108,11 @@ using MyRawDataList = Raw data list with 2 byte size prefix: ```cpp using MyRawDataList2 = - nil::marshalling::types::array_list< + nil::crypto3::marshalling::types::array_list< MyFieldBase, std::uint8_t, - nil::marshalling::option::sequence_size_field_prefix< - nil::marshalling::types::int_value + nil::crypto3::marshalling::option::sequence_size_field_prefix< + nil::crypto3::marshalling::types::int_value > >; ``` @@ -120,17 +120,17 @@ using MyRawDataList2 = Size prefixed list of complex (bundle) elements: ```cpp using MyComplexList = - nil::marshalling::types::array_list< + nil::crypto3::marshalling::types::array_list< MyFieldBase, - nil::marshalling::types::bundle< + nil::crypto3::marshalling::types::bundle< MyFieldBase, std::tuple< - nil::marshalling::types::int_value, // 2 bytes int - nil::marshalling::types::enum_value // 1 byte enum + nil::crypto3::marshalling::types::int_value, // 2 bytes int + nil::crypto3::marshalling::types::enum_value // 1 byte enum > >, - nil::marshalling::option::sequence_size_field_prefix< - nil::marshalling::types::int_value + nil::crypto3::marshalling::option::sequence_size_field_prefix< + nil::crypto3::marshalling::types::int_value > >; ``` @@ -138,10 +138,10 @@ using MyComplexList = String with 1 byte size prefix: ```cpp using MyString = - nil::marshalling::types::string< + nil::crypto3::marshalling::types::string< MyFieldBase, - nil::marshalling::option::sequence_size_field_prefix< - nil::marshalling::types::int_value + nil::crypto3::marshalling::option::sequence_size_field_prefix< + nil::crypto3::marshalling::types::int_value > > ``` @@ -149,9 +149,9 @@ using MyString = Optional 2 byte integer, default constructed as "missing".: ```cpp using MyOptInt = - nil::marshalling::types::optional< - nil::marshalling::types::int_value, - nil::marshalling::option::default_optional_mode + nil::crypto3::marshalling::types::optional< + nil::crypto3::marshalling::types::int_value, + nil::crypto3::marshalling::option::default_optional_mode > ``` @@ -181,11 +181,11 @@ using Message1Fields = // The definition of Message1 message template // Interface class passed as a template parameter class Message1 : public - nil::marshalling::message_base< + nil::crypto3::marshalling::message_base< TMsgBase, - nil::marshalling::option::static_num_id_impl, // numeric message ID - nil::marshalling::option::fields_impl, // provide message fields - nil::marshalling::option::msg_type > // specify exact type of the message + nil::crypto3::marshalling::option::static_num_id_impl, // numeric message ID + nil::crypto3::marshalling::option::fields_impl, // provide message fields + nil::crypto3::marshalling::option::msg_type > // specify exact type of the message > { // Provide names of the fields for convenient access @@ -201,30 +201,30 @@ The interface definition is application specific. Every application defines what polymorphic interface every message needs to define and implement: ```cpp using App1Interface = - nil::marshalling::message< - nil::marshalling::option::big_endian, // Use big endian for serialization - nil::marshalling::option::msg_type, // Provide type used for message ID - nil::marshalling::option::id_info_interface, // Support polymorphic retreival of message ID - nil::marshalling::option::read_iterator, // Support polymorphic read using "const std::uint8_t*" as iterator - nil::marshalling::option::write_iterator, // Support polymorphic write using "std::uint8_t*" as iterator - nil::marshalling::option::length_info_interface, // Support polymorphic retrieval of serialization length - nil::marshalling::option::valid_check_interface, // Support polymorphic contents validity check - nil::marshalling::option::handler // Support dispatch to handling object of "MyHandler" type + nil::crypto3::marshalling::message< + nil::crypto3::marshalling::option::big_endian, // Use big endian for serialization + nil::crypto3::marshalling::option::msg_type, // Provide type used for message ID + nil::crypto3::marshalling::option::id_info_interface, // Support polymorphic retreival of message ID + nil::crypto3::marshalling::option::read_iterator, // Support polymorphic read using "const std::uint8_t*" as iterator + nil::crypto3::marshalling::option::write_iterator, // Support polymorphic write using "std::uint8_t*" as iterator + nil::crypto3::marshalling::option::length_info_interface, // Support polymorphic retrieval of serialization length + nil::crypto3::marshalling::option::valid_check_interface, // Support polymorphic contents validity check + nil::crypto3::marshalling::option::handler // Support dispatch to handling object of "MyHandler" type >; ``` Some other application may define different interface: ```cpp using App2Interface = - nil::marshalling::message< - nil::marshalling::option::big_endian, // Use big endian for serialization - nil::marshalling::option::msg_type, // Provide type used for message ID - nil::marshalling::option::id_info_interface, // Support polymorphic retreival of message ID - nil::marshalling::option::read_iterator, // Support polymorphic read using "const std::uint8_t*" as iterator - nil::marshalling::option::write_iterator > >, + nil::crypto3::marshalling::message< + nil::crypto3::marshalling::option::big_endian, // Use big endian for serialization + nil::crypto3::marshalling::option::msg_type, // Provide type used for message ID + nil::crypto3::marshalling::option::id_info_interface, // Support polymorphic retreival of message ID + nil::crypto3::marshalling::option::read_iterator, // Support polymorphic read using "const std::uint8_t*" as iterator + nil::crypto3::marshalling::option::write_iterator > >, // Support polymorphic write using // "std::back_insert_itetrator > >" as iterator - nil::marshalling::option::handler // Support dispatch to handling object of "MyOtherHandler" type + nil::crypto3::marshalling::option::handler // Support dispatch to handling object of "MyOtherHandler" type >; ``` @@ -247,18 +247,18 @@ For example, simple frame of just 2 bytes size followed by 2 byte message ID will look like this: ```cpp // Define field used to (de)serialise message id (see definition of msg_id enum earlier) -using MsgIdField = nil::marshalling::types::enum_value +using MsgIdField = nil::crypto3::marshalling::types::enum_value // Define field used to (de)serialise remaining length of the message: -using MsgSizeField = nil::marshalling::types::int_value +using MsgSizeField = nil::crypto3::marshalling::types::int_value // Define transport stack by wrapping "layers" using Stack = - nil::marshalling::protocol::MsgSizeLayer< // The SIZE + nil::crypto3::marshalling::protocol::MsgSizeLayer< // The SIZE MsgSizeField, - nil::marshalling::option::MsgIdLayer< // The ID + nil::crypto3::marshalling::option::MsgIdLayer< // The ID MsgIdField, - nil::marshalling::protocol::MsgDataLayer<> // The PAYLOAD + nil::crypto3::marshalling::protocol::MsgDataLayer<> // The PAYLOAD > >; ``` @@ -268,39 +268,39 @@ may look like this: ```cpp // Define field used to (de)serialise message id (see definition of msg_id enum earlier) -using MsgIdField = nil::marshalling::types::enum_value +using MsgIdField = nil::crypto3::marshalling::types::enum_value // Define field used to (de)serialise remaining length of the message: -using MsgSizeField = nil::marshalling::types::int_value +using MsgSizeField = nil::crypto3::marshalling::types::int_value // Define checksum value field using ChecksumField = - nil::marshalling::types::int_value< + nil::crypto3::marshalling::types::int_value< MyFieldBase, std::uint16_t >; // Define field used as synchronisation prefix using SyncField = - nil::marshalling::types::int_value< + nil::crypto3::marshalling::types::int_value< MyFieldBase, std::uint16_t, - nil::marshalling::option::default_num_value<0xabcd>, - nil::marshalling::option::valid_num_value_range<0xabcd, 0xabcd> + nil::crypto3::marshalling::option::default_num_value<0xabcd>, + nil::crypto3::marshalling::option::valid_num_value_range<0xabcd, 0xabcd> >; // Define transport stack by wrapping "layers" using Stack = - nil::marshalling::protocol::SyncPrefixLayer< // The SYNC + nil::crypto3::marshalling::protocol::SyncPrefixLayer< // The SYNC SyncField, - nil::marshalling::protocol::ChecksumLayer // The CHECKSUM + nil::crypto3::marshalling::protocol::ChecksumLayer // The CHECKSUM ChecksumField, - nil::marshalling::protocol::checksum::crc_ccitt, // Use CRC-CCITT calculation - nil::marshalling::protocol::MsgSizeLayer< // The SIZE + nil::crypto3::marshalling::protocol::checksum::crc_ccitt, // Use CRC-CCITT calculation + nil::crypto3::marshalling::protocol::MsgSizeLayer< // The SIZE MsgSizeField, - nil::marshalling::option::MsgIdLayer< // The ID + nil::crypto3::marshalling::option::MsgIdLayer< // The ID MsgIdField, - nil::marshalling::protocol::MsgDataLayer<> // The PAYLOAD + nil::crypto3::marshalling::protocol::MsgDataLayer<> // The PAYLOAD > > > diff --git a/crypto3/libs/marshalling/core/docs/marshalling.dox b/crypto3/libs/marshalling/core/docs/marshalling.dox index 8405b42aa3..96af41fa75 100644 --- a/crypto3/libs/marshalling/core/docs/marshalling.dox +++ b/crypto3/libs/marshalling/core/docs/marshalling.dox @@ -1,34 +1,34 @@ /// @namespace marshalling /// @brief Main namespace for all classes / functions of Marshalling library. -/// @namespace nil::marshalling::processing +/// @namespace nil::crypto3::marshalling::processing /// @brief Namespace for various utility classes and/or functions used by Marshalling library. -/// @namespace nil::marshalling::option +/// @namespace nil::crypto3::marshalling::option /// @brief Namespace that contains all the options used to define message /// as well as message fields. -/// @namespace nil::marshalling::protocol +/// @namespace nil::crypto3::marshalling::protocol /// @brief Namespace that contains definition of layers that can be used to /// wrap message data with transport data. -/// @namespace nil::marshalling::protocol::checksum +/// @namespace nil::crypto3::marshalling::protocol::checksum /// @brief Namespace that contains definition of checksum calculator classes which -/// can be used with nil::marshalling::protocol::ChecksumLayer transport layer class. +/// can be used with nil::crypto3::marshalling::protocol::ChecksumLayer transport layer class. -/// @namespace nil::marshalling::field +/// @namespace nil::crypto3::marshalling::field /// @brief Namespace that contains definitions of all message fields. -/// @namespace nil::marshalling::traits +/// @namespace nil::crypto3::marshalling::traits /// @brief Namespace for various traits tag classes. -/// @namespace nil::marshalling::traits::endian +/// @namespace nil::crypto3::marshalling::traits::endian /// @brief Namespace for traits tag classes used to specify serialization endian. -/// @namespace nil::marshalling::traits::units +/// @namespace nil::crypto3::marshalling::traits::units /// @brief Namespace for various traits tag classes used in units conversion operations. -/// @namespace nil::marshalling::units +/// @namespace nil::crypto3::marshalling::units /// @brief Namespace containing units conversion operations diff --git a/crypto3/libs/marshalling/core/docs/page_assert.dox b/crypto3/libs/marshalling/core/docs/page_assert.dox index b586b292f5..fe129f4461 100644 --- a/crypto3/libs/marshalling/core/docs/page_assert.dox +++ b/crypto3/libs/marshalling/core/docs/page_assert.dox @@ -1,10 +1,10 @@ /// @page page_assert Custom Assertion Failure Behaviour /// First of all, there is a need to define a custom assertion failure report -/// class which inherits from nil::marshalling::assert_type and overrides pure virtual member +/// class which inherits from nil::crypto3::marshalling::assert_type and overrides pure virtual member /// function fail(): /// @code /// #include -/// class MyAssert : public nil::marshalling::assert_type +/// class MyAssert : public nil::crypto3::marshalling::assert_type /// { /// public: /// MyAssert(...) {...} // The constructor may receive any parameters needed @@ -25,7 +25,7 @@ /// @code /// int main(int argc, const char* argv[]) /// { -/// nil::marshalling::enable_assert enabledAssert; +/// nil::crypto3::marshalling::enable_assert enabledAssert; /// // From this point custom assertion failure bahaviour takes place. /// ... /// } @@ -34,11 +34,11 @@ /// @code /// int main(int argc, const char* argv[]) /// { -/// nil::marshalling::enable_assert assert1; +/// nil::crypto3::marshalling::enable_assert assert1; /// // From this point custom assertion failure bahaviour takes place. /// ... /// { -/// nil::marshalling::enable_assert assert2; +/// nil::crypto3::marshalling::enable_assert assert2; /// // From this point different custom assertion failure bahaviour /// // defined in SomeOtherMyAssert class takes place. /// ... diff --git a/crypto3/libs/marshalling/core/docs/page_define_prot.dox b/crypto3/libs/marshalling/core/docs/page_define_prot.dox index 4a33731d1e..ca65965aae 100644 --- a/crypto3/libs/marshalling/core/docs/page_define_prot.dox +++ b/crypto3/libs/marshalling/core/docs/page_define_prot.dox @@ -15,13 +15,13 @@ /// If the protocol grows and the compilation takes a significant amount of time, /// more fine-grained include statements may be used: /// @code -/// #include // Provides all definitions from nil::marshalling::field namespace -/// #include // Provides all definitions from nil::marshalling::protocol namespace -/// #include // Provides all definitions from nil::marshalling::units namespace -/// #include // Definition of nil::marshalling::Message class to define interface -/// #include // Definition of nil::marshalling::MessageBase class to define message impl -/// #include // Definition of nil::marshalling::generic_handler class -/// #include // Definition of nil::marshalling::MessageFactory class +/// #include // Provides all definitions from nil::crypto3::marshalling::field namespace +/// #include // Provides all definitions from nil::crypto3::marshalling::protocol namespace +/// #include // Provides all definitions from nil::crypto3::marshalling::units namespace +/// #include // Definition of nil::crypto3::marshalling::Message class to define interface +/// #include // Definition of nil::crypto3::marshalling::MessageBase class to define message impl +/// #include // Definition of nil::crypto3::marshalling::generic_handler class +/// #include // Definition of nil::crypto3::marshalling::MessageFactory class /// @endcode /// /// @section page_define_prot_conditions Checking pre- and post- Conditions @@ -57,11 +57,11 @@ /// see @ref sec_field_tutorial_enum_value for more detail). /// /// After the numeric IDs are specified, there is a need to define common -/// message interface class by extending @ref nil::marshalling::Message. +/// message interface class by extending @ref nil::crypto3::marshalling::Message. /// The defined class / type needs to pin the type used for message IDs -/// with @ref nil::marshalling::option::msg_id_type and defined +/// with @ref nil::crypto3::marshalling::option::msg_id_type and defined /// earlier enum. It also should specify the serialization endian with either -/// @ref nil::marshalling::option::big_endian or @ref nil::marshalling::option::little_endian options. +/// @ref nil::crypto3::marshalling::option::big_endian or @ref nil::crypto3::marshalling::option::little_endian options. /// However it must also /// allow extension with other options by the application. /// @code @@ -72,9 +72,9 @@ /// /// template /// using Message = -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, /// TOptions... /// >; /// @@ -101,9 +101,9 @@ /// /// template /// class MyMessage : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, /// TOptions... /// > /// { @@ -125,7 +125,7 @@ /// Marshalling library has a built-in way to automate such assignments (see /// @ref page_prot_stack_tutorial_transport_value section in @ref page_prot_stack_tutorial). /// In order to support usage -/// of @ref nil::marshalling::protocol::TransportValueLayer the message interface class must +/// of @ref nil::crypto3::marshalling::protocol::TransportValueLayer the message interface class must /// define "extra transport fields". /// /// First, such extra transport field(s) must be defined using a field abstraction @@ -135,13 +135,13 @@ /// { /// /// // Base class of all the fields -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// /// // field_type describing protocol version. -/// using MyVersionField = nil::marshalling::types::IntValue; +/// using MyVersionField = nil::crypto3::marshalling::types::IntValue; /// /// // field_type describing protocol version. -/// using MyFlagsField = nil::marshalling::types::BitmaskValue >; +/// using MyFlagsField = nil::crypto3::marshalling::types::BitmaskValue >; /// /// // Relevant extra transport fields, bundled in std::tuple /// using MyExtraTransportFields = @@ -153,17 +153,17 @@ /// } // namespace my_protocol /// @endcode /// Second, provide the defined tuple to message interface class using -/// @ref nil::marshalling::option::extra_transport_fields option. +/// @ref nil::crypto3::marshalling::option::extra_transport_fields option. /// @code /// namespace my_protocol /// { /// /// template /// class Message : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, -/// nil::marshalling::option::extra_transport_fields, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::option::extra_transport_fields, /// TOptions... /// > /// { @@ -178,9 +178,9 @@ /// /// template /// class MyMessage : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, /// TOptions... /// > /// { @@ -228,10 +228,10 @@ /// @code /// template /// class Message : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, -/// nil::marshalling::option::extra_transport_fields, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::option::extra_transport_fields, /// TOptions... /// > /// { @@ -244,10 +244,10 @@ /// @code /// template /// class Message : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, -/// nil::marshalling::option::extra_transport_fields, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::option::extra_transport_fields, /// TOptions... /// > /// { @@ -290,16 +290,16 @@ /// protocol version information. The Marshalling library contains extra functionality /// to help with protocol versioning. If extra transport values contain version, /// then it is recommended to let the library know which field in the provided -/// ones is the version. To do so @ref nil::marshalling::option::version_in_extra_transport_fields, +/// ones is the version. To do so @ref nil::crypto3::marshalling::option::version_in_extra_transport_fields, /// with index of the field as a template argument needs to be used. /// @code /// template /// class Message : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, -/// nil::marshalling::option::extra_transport_fields, -/// nil::marshalling::option::version_in_extra_transport_fields<0>, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::option::extra_transport_fields, +/// nil::crypto3::marshalling::option::version_in_extra_transport_fields<0>, /// TOptions... /// > /// { @@ -311,7 +311,7 @@ /// @code /// template /// class Message : public -/// nil::marshalling::Message<...> +/// nil::crypto3::marshalling::Message<...> /// { /// public: /// ... @@ -356,7 +356,7 @@ /// /// struct Message1Fields /// { -/// using field1 = nil::marshalling::types::IntValue; +/// using field1 = nil::crypto3::marshalling::types::IntValue; /// using field2 = ... /// using field3 = ... /// @@ -371,7 +371,7 @@ /// /// // Definition of the message itself, described and explained later /// template -/// class Message1 : public nil::marshalling::MessageBase +/// class Message1 : public nil::crypto3::marshalling::MessageBase /// { /// ... /// }; @@ -381,11 +381,11 @@ /// } // namespace my_protocol /// @endcode /// -/// The message definition class has to extend @ref nil::marshalling::MessageBase and receive -/// at least one template parameter, that is passed as first one to @ref nil::marshalling::MessageBase. +/// The message definition class has to extend @ref nil::crypto3::marshalling::MessageBase and receive +/// at least one template parameter, that is passed as first one to @ref nil::crypto3::marshalling::MessageBase. /// @code /// template -/// class Message1 : nil::marshalling::MessageBase +/// class Message1 : nil::crypto3::marshalling::MessageBase /// { /// ... /// }; @@ -393,18 +393,18 @@ /// The @b TBase template parameter is chosen by the application being developed. /// It is expected to be a variant of @ref page_define_prot_interface (@b my_protocol::Message), /// which specifies polymorphic interface that needs to be implemented. -/// The @ref nil::marshalling::MessageBase class in turn will publicly inherit +/// The @ref nil::crypto3::marshalling::MessageBase class in turn will publicly inherit /// from the provided common interface class. As the result the full class inheritance graph may look /// like this: /// @diafile message_class_hierarchy.dia /// @n /// /// There are at least 3 additional options that should be passed to -/// @ref nil::marshalling::MessageBase. -/// @li @ref nil::marshalling::option::static_num_id_impl with numeric ID of the message. -/// @li @ref nil::marshalling::option::fields_impl with @b std::tuple of message fields ( +/// @ref nil::crypto3::marshalling::MessageBase. +/// @li @ref nil::crypto3::marshalling::option::static_num_id_impl with numeric ID of the message. +/// @li @ref nil::crypto3::marshalling::option::fields_impl with @b std::tuple of message fields ( /// defined earlier @b my_protocol::Message1Fields::All) -/// @li @ref nil::marshalling::option::msg_type with actual message type (@b Message1). +/// @li @ref nil::crypto3::marshalling::option::msg_type with actual message type (@b Message1). /// /// For example /// @code @@ -412,11 +412,11 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::fields_impl, -/// nil::marshalling::option::msg_type > // type of the message being defined +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::fields_impl, +/// nil::crypto3::marshalling::option::msg_type > // type of the message being defined /// { /// ... /// }; @@ -449,7 +449,7 @@ /// /// // Default implementation of read functionality /// template -/// nil::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) +/// nil::crypto3::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) /// { /// // Read all the fields one by one by invoking /// // read() member function of all the fields. @@ -457,7 +457,7 @@ /// /// // Default implementation of write functionality /// template -/// nil::marshalling::ErrorStatus do_write(TIter& iter, std::size_t len) const +/// nil::crypto3::marshalling::ErrorStatus do_write(TIter& iter, std::size_t len) const /// { /// // Write all the fields one by one by invoking /// // write() member function of all the fields. @@ -489,16 +489,16 @@ /// }; /// @endcode /// See also relevant API documentation: -/// @li @ref nil::marshalling::MessageBase::fields() -/// @li @ref nil::marshalling::MessageBase::do_read() -/// @li @ref nil::marshalling::MessageBase::do_write() -/// @li @ref nil::marshalling::MessageBase::do_length() -/// @li @ref nil::marshalling::MessageBase::do_valid() -/// @li @ref nil::marshalling::MessageBase::do_refresh() +/// @li @ref nil::crypto3::marshalling::MessageBase::fields() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_read() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_write() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_length() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_valid() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_refresh() /// /// In case the passed message interface class as template parameter (@b TBase) /// defines some polymorphic interface functions, their implementation is automatically -/// generated by the @ref nil::marshalling::MessageBase. For example if passed interface +/// generated by the @ref nil::crypto3::marshalling::MessageBase. For example if passed interface /// class required polymorphic read operation, the following member function will /// also be automatically implemented: /// @code @@ -507,7 +507,7 @@ /// { /// ... /// protected: -/// virtual nil::marshalling::ErrorStatus readImpl(read_iterator& iter, std::size_t len) +/// virtual nil::crypto3::marshalling::ErrorStatus readImpl(read_iterator& iter, std::size_t len) /// { /// return do_read(iter, len); /// } @@ -518,7 +518,7 @@ /// When preparing message object to send or when handling received message, the /// fields it contains need to be accessed to set or get their values. The default /// (build-in) way of achieving that is to get access to the fields tuple -/// using inherited nil::marshalling::MessageBase::fields() member function and then using +/// using inherited nil::crypto3::marshalling::MessageBase::fields() member function and then using /// @b std::get() function to access the fields inside the tuple. /// @code /// Message1 msg; @@ -536,7 +536,7 @@ /// @code /// template /// class Message1 : public -/// nil::marshalling::MessageBase<...> +/// nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// // Provide names for the fields @@ -548,7 +548,7 @@ /// @code /// template /// class Message1 : public -/// nil::marshalling::MessageBase<...> +/// nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// enum FieldIdx @@ -613,10 +613,10 @@ /// @code /// template /// class Message1 : public -/// nil::marshalling::MessageBase<...> +/// nil::crypto3::marshalling::MessageBase<...> /// { /// // Duplicate the base class definition -/// using Base = nil::marshalling::MessageBase<...>; +/// using Base = nil::crypto3::marshalling::MessageBase<...>; /// public: /// // Provide names for the fields /// MARSHALLING_MSG_FIELDS_ACCESS(value1, value2, value3); @@ -629,10 +629,10 @@ /// the defined symbol to add / remove the definition of the @b Base member type. /// @code /// template -/// class Message1 : public nil::marshalling::MessageBase<...> +/// class Message1 : public nil::crypto3::marshalling::MessageBase<...> /// { /// #ifdef MARSHALLING_MUST_DEFINE_BASE -/// using Base = nil::marshalling::MessageBase<...>; +/// using Base = nil::crypto3::marshalling::MessageBase<...>; /// #endif /// public: /// // Provide names for the fields @@ -641,14 +641,14 @@ /// @endcode /// /// @subsection page_define_prot_message_base_custom_read Custom Read Functionality -/// The default read functionality implemented by @ref nil::marshalling::MessageBase::do_read() +/// The default read functionality implemented by @ref nil::crypto3::marshalling::MessageBase::do_read() /// is to invoke @b read() member function of every field and return @b success /// if all the invocations returned @b success. /// Sometimes such default implementation may be incomplete or incorrect and may require /// additional or different implementation. It is very easy to fix by defining /// new @b do_read() public member function with updated functionality. The -/// @ref nil::marshalling::MessageBase class contains inner "magic" to call the provided @b do_read() -/// instead of default one when implementing virtual @ref nil::marshalling::MessageBase::readImpl(). +/// @ref nil::crypto3::marshalling::MessageBase class contains inner "magic" to call the provided @b do_read() +/// instead of default one when implementing virtual @ref nil::crypto3::marshalling::MessageBase::readImpl(). /// As an example let's define new message /// type (@b Message2), which has two fields. The first one is a 1 byte bitmask, /// the least significant bit of which defines whether the second field exists. @@ -669,16 +669,16 @@ /// class Message2Fields /// { /// using field1 = -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0xfe, 0> +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0xfe, 0> /// >; /// /// using field2 = -/// nil::marshalling::types::Optional< -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::missing_by_default +/// nil::crypto3::marshalling::types::Optional< +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::missing_by_default /// >; /// /// // bundle all the fields @@ -690,25 +690,25 @@ /// /// template /// class Message2 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::fields_impl, -/// nil::marshalling::option::msg_type > +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::fields_impl, +/// nil::crypto3::marshalling::option::msg_type > /// > /// { /// public: /// MARSHALLING_MSG_FIELDS_ACCESS(flags, data); /// /// template -/// nil::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) +/// nil::crypto3::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) /// { /// // Get type of the base class -/// using Base = typename std::decay::type; +/// using Base = typename std::decay::type; /// /// // Read only the flags value /// auto es = Base::template do_read_fields_until(iter, len); -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// return es; /// } /// @@ -725,23 +725,23 @@ /// }; /// @endcode /// Please @b note, that due to the fact that defined message class is a template one, the member -/// functions defined in @ref nil::marshalling::MessageBase are not accessible directly, there +/// functions defined in @ref nil::crypto3::marshalling::MessageBase are not accessible directly, there /// is a need to specify the base class scope. If there is no inner @b Base /// type defined in the class scope (required to support clang and earlier versions of gcc), -/// it is possible to use @ref nil::marshalling::to_message_base() +/// it is possible to use @ref nil::crypto3::marshalling::to_message_base() /// function to detect it. /// -/// Also @b note, that nil::marshalling::MessageBase provides the following member functions +/// Also @b note, that nil::crypto3::marshalling::MessageBase provides the following member functions /// in order to allow read / write of the selected fields. -/// @li @ref nil::marshalling::MessageBase::do_read_fields_from() -/// @li @ref nil::marshalling::MessageBase::do_read_fields_until() -/// @li @ref nil::marshalling::MessageBase::do_read_fields_from_until() -/// @li @ref nil::marshalling::MessageBase::do_write_fields_from() -/// @li @ref nil::marshalling::MessageBase::do_write_fields_until() -/// @li @ref nil::marshalling::MessageBase::do_write_fields_from_until() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_read_fields_from() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_read_fields_until() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_read_fields_from_until() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_write_fields_from() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_write_fields_until() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_write_fields_from_until() /// /// @subsection page_define_prot_message_base_custom_refresh Custom Refresh Functionality -/// The default refresh functionality implemented by @ref nil::marshalling::MessageBase::do_refresh() +/// The default refresh functionality implemented by @ref nil::crypto3::marshalling::MessageBase::do_refresh() /// is to invoke @b refresh() member function of every field. The function will /// return @b true (indicating that at message contents have been updated) if /// at least one of the fields returns @b true. @@ -768,16 +768,16 @@ /// intact. /// @code /// template -/// class Message2 : public nil::marshalling::MessageBase<...> +/// class Message2 : public nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// MARSHALLING_MSG_FIELDS_ACCESS(flags, data); /// /// bool do_refresh() /// { -/// auto expectedDataMode = nil::marshalling::types::OptionalMode::missing; +/// auto expectedDataMode = nil::crypto3::marshalling::types::OptionalMode::missing; /// if ((field_flags().value() & 0x1) != 0U) { -/// expectedDataMode = nil::marshalling::types::OptionalMode::exists; +/// expectedDataMode = nil::crypto3::marshalling::types::OptionalMode::exists; /// } /// /// if (field_data().get_mode() == expectedDataMode) { @@ -800,29 +800,29 @@ /// @endcode /// In order to support polymorphic refresh functionality when required (see /// @ref page_use_prot_interface_refresh), the actual message class -/// implementation must also pass @ref nil::marshalling::option::has_custom_refresh option to -/// @ref nil::marshalling::MessageBase class. Failure to do so @b may result in missing -/// implementation of @ref nil::marshalling::MessageBase::refresh_impl(). In this case, -/// the default implementation of @ref nil::marshalling::Message::refresh_impl() will be +/// implementation must also pass @ref nil::crypto3::marshalling::option::has_custom_refresh option to +/// @ref nil::crypto3::marshalling::MessageBase class. Failure to do so @b may result in missing +/// implementation of @ref nil::crypto3::marshalling::MessageBase::refresh_impl(). In this case, +/// the default implementation of @ref nil::crypto3::marshalling::Message::refresh_impl() will be /// used instead, always /// returning @b false (reporting that message fields weren't updated) without proper execution /// of refresh functionality. /// @code /// template /// class Message2 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::msg_type >, -/// nil::marshalling::option::fields_impl , -/// nil::marshalling::option::has_custom_refresh // Support polymorphic refresh when needed +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::msg_type >, +/// nil::crypto3::marshalling::option::fields_impl , +/// nil::crypto3::marshalling::option::has_custom_refresh // Support polymorphic refresh when needed /// > /// { /// public: /// MARSHALLING_MSG_FIELDS_ACCESS(flags, data); /// /// template -/// nil::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) +/// nil::crypto3::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) /// { /// ... // see implementation above /// } @@ -837,19 +837,19 @@ /// @subsection page_define_prot_message_base_custom_write Custom Write Functionality /// Usually there is no need to provide custom write functionality for the messages /// in consistent state (see @ref page_define_prot_message_base_custom_refresh). -/// The default one implemented by @ref nil::marshalling::MessageBase::do_write(), which invokes +/// The default one implemented by @ref nil::crypto3::marshalling::MessageBase::do_write(), which invokes /// @b write() member function of every field, is correct. However, if /// the need arises it is enough just to provide custom @b do_write() member /// function. /// @code /// template -/// class SomeMessage : public nil::marshalling::MessageBase<...> +/// class SomeMessage : public nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// MARSHALLING_MSG_FIELDS_ACCESS(...); /// /// template -/// nil::marshalling::ErrorStatus do_write(TIter& iter, std::size_t len) const +/// nil::crypto3::marshalling::ErrorStatus do_write(TIter& iter, std::size_t len) const /// { /// ... /// } @@ -862,7 +862,7 @@ /// provide your own variant of @b do_length() member function. /// @code /// template -/// class SomeMessage : public nil::marshalling::MessageBase<...> +/// class SomeMessage : public nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// std::size_t do_length() const @@ -873,7 +873,7 @@ /// @endcode /// /// @subsection page_define_prot_message_base_custom_valid Custom Validity Check -/// The default implementation of @ref nil::marshalling::MessageBase::do_valid() calls +/// The default implementation of @ref nil::crypto3::marshalling::MessageBase::do_valid() calls /// @b valid() member function of every message field and returns @b true if /// all the calls returned @b true. However, there may be a need to provide extra /// checks in case specific value of one field may require tighter constrains on @@ -881,13 +881,13 @@ /// custom @b do_valid() member function. /// @code /// template -/// class SomeMessage : public nil::marshalling::MessageBase<...> +/// class SomeMessage : public nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// bool do_valid() const /// { /// // Get type of the base class -/// using Base = typename std::decay::type; +/// using Base = typename std::decay::type; /// /// // Check that all fields are valid by themselves /// if (!Base::do_valid()) { @@ -902,12 +902,12 @@ /// /// @subsection page_define_prot_message_base_name Reporting Message Name /// Some application may require printing (or reporting by other means) human -/// readable name of the message. The @ref nil::marshalling::MessageBase cannot automatically +/// readable name of the message. The @ref nil::crypto3::marshalling::MessageBase cannot automatically /// generate appropriate function. As the result, the message definition class is /// expected to define @b do_name() member function with the following signature. /// @code /// template -/// class SomeMessage : public nil::marshalling::MessageBase<...> +/// class SomeMessage : public nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// static const char* do_name() @@ -917,14 +917,14 @@ /// }; /// @endcode /// In order to support @ref page_use_prot_interface_name there is a need -/// to pass @ref nil::marshalling::option::has_name option to @ref nil::marshalling::MessageBase to notify +/// to pass @ref nil::crypto3::marshalling::option::has_name option to @ref nil::crypto3::marshalling::MessageBase to notify /// the latter about existence of @b do_name() member function. /// @code /// template /// class SomeMessage : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// ..., -/// nil::marshalling::option::has_name +/// nil::crypto3::marshalling::option::has_name /// > /// { /// public: @@ -934,8 +934,8 @@ /// } /// }; /// @endcode -/// When @ref nil::marshalling::option::has_name is used, the @b nil::marshalling::MessageBase -/// creates overriding @b name_impl() (see @ref nil::marshalling::MessageBase::name_impl()), which +/// When @ref nil::crypto3::marshalling::option::has_name is used, the @b nil::crypto3::marshalling::MessageBase +/// creates overriding @b name_impl() (see @ref nil::crypto3::marshalling::MessageBase::name_impl()), which /// invokes provided @b do_name() member function. /// /// @subsection page_define_prot_message_version Protocol Version Support @@ -943,27 +943,27 @@ /// protocols may include version information in either message transport framing /// or in one of the messages used to establish a connection. Every field /// defines @b set_version() member function in its public interface. The -/// nil::marshalling::MessageBase class will automatically call this function for every -/// field before performing its @b read operation (inside @ref nil::marshalling::MessageBase::do_read()). +/// nil::crypto3::marshalling::MessageBase class will automatically call this function for every +/// field before performing its @b read operation (inside @ref nil::crypto3::marshalling::MessageBase::do_read()). /// However, if @ref page_define_prot_message_base_custom_read is implemented, -/// the latter is expected to call provided @ref nil::marshalling::MessageBase::do_fields_version_update() +/// the latter is expected to call provided @ref nil::crypto3::marshalling::MessageBase::do_fields_version_update() /// member function explicitly before attempting actual read operations. -/// @b NOTE, that the @ref nil::marshalling::MessageBase::do_fields_version_update() function -/// exists only if @ref nil::marshalling::option::version_in_extra_transport_fields has been +/// @b NOTE, that the @ref nil::crypto3::marshalling::MessageBase::do_fields_version_update() function +/// exists only if @ref nil::crypto3::marshalling::option::version_in_extra_transport_fields has been /// provided to message interface. /// @code /// template /// class Message2 : public -/// nil::marshalling::MessageBase<...> +/// nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// ... /// /// template -/// nil::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) +/// nil::crypto3::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) /// { /// // Get type of the base class -/// using Base = typename std::decay::type; +/// using Base = typename std::decay::type; /// /// // Update version of the fields /// Base::do_fields_version_update(); @@ -978,7 +978,7 @@ /// @code /// template /// class Message2 : public -/// nil::marshalling::MessageBase<...> +/// nil::crypto3::marshalling::MessageBase<...> /// { /// public: /// ... @@ -986,7 +986,7 @@ /// bool do_refresh() /// { /// // Get type of the base class -/// using Base = typename std::decay::type; +/// using Base = typename std::decay::type; /// /// // Update version of the fields /// bool updated = Base::do_fields_version_update(); @@ -1004,12 +1004,12 @@ /// variable length fields, such as @b string or @b list, then maximum serialization /// length is also known. It would be wise to slip in compile time checks in /// message definition as well. There are several static constexpr member functions -/// inherited from @b nil::marshalling::MessageBase that can be used: +/// inherited from @b nil::crypto3::marshalling::MessageBase that can be used: /// -/// @li @ref nil::marshalling::MessageBase::do_min_length() -/// @li @ref nil::marshalling::MessageBase::do_max_length() -/// @li @ref nil::marshalling::MessageBase::do_min_length_from_until() -/// @li @ref nil::marshalling::MessageBase::do_max_length_from_until() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_min_length() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_max_length() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_min_length_from_until() +/// @li @ref nil::crypto3::marshalling::MessageBase::do_max_length_from_until() /// /// For example, the implementation of @b Message2 may be updated as below: /// @code @@ -1026,10 +1026,10 @@ /// { /// /// template -/// class Message2 : public nil::marshalling::MessageBase<...> +/// class Message2 : public nil::crypto3::marshalling::MessageBase<...> /// > /// { -/// using Base = nil::marshalling::MessageBase<...> +/// using Base = nil::crypto3::marshalling::MessageBase<...> /// public: /// static_assert(Base::do_min_length() == 1U, "Unexpected min length"); /// static_assert(Base::do_max_length() == 3U, "Unexpected max length"); @@ -1040,7 +1040,7 @@ /// @section page_define_prot_customisation Application Specific Customisation /// As was mentioned in @ref page_field_tutorial, there may be a need to provide a way for /// extra application specific customisation for used fields, especially for fields like lists -/// (@ref nil::marshalling::types::array_list) or strings (@ref nil::marshalling::types::String). By +/// (@ref nil::crypto3::marshalling::types::array_list) or strings (@ref nil::crypto3::marshalling::types::String). By /// default they use @b std::vector and @b std::string respectively as /// their inner value storage types. They may be un-applicable to some aplications, /// especially bare-metal ones. In order to solve such problem the message classes @@ -1050,7 +1050,7 @@ /// Recommended Practice /// /// It is recommended to have a separate class / struct called @b DefaultOptions -/// wich defines relevant inner types to be @ref nil::marshalling::option::empty_option (option that +/// wich defines relevant inner types to be @ref nil::crypto3::marshalling::option::empty_option (option that /// does nothing). For example, let's assume that third field in @b Message1 /// message is a string. Then the @b DefaultOptions struct may be defined as /// @code @@ -1060,7 +1060,7 @@ /// { /// struct Message1Fields /// { -/// using field3 = nil::marshalling::option::empty_option; // no extra functionality by default +/// using field3 = nil::crypto3::marshalling::option::empty_option; // no extra functionality by default /// }; /// }; /// }; @@ -1088,7 +1088,7 @@ /// using field1 = ...; /// using field2 = ... /// using field3 = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, /// typename TOpt::message::Message1Fields::field3 // Extra option(s) /// > @@ -1105,11 +1105,11 @@ /// // Definition of the message itself, described and explained later /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::fields_impl::All>, -/// nil::marshalling::option::msg_type > +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::fields_impl::All>, +/// nil::crypto3::marshalling::option::msg_type > /// > /// { /// ... @@ -1124,11 +1124,11 @@ /// and overriding selected number inner types with its own extension options. /// /// @b NOTE, that allowing additional customisation for fields like @b list -/// (@ref nil::marshalling::types::array_list) and @b string (@ref nil::marshalling::types::String) is +/// (@ref nil::crypto3::marshalling::types::array_list) and @b string (@ref nil::crypto3::marshalling::types::String) is /// a must have feature to allow usage of the same protocol definition in /// bare-metal applications. However, it would be wise to allow extra customisation -/// for @b all the used fields, even for ones like integral values (@ref nil::marshalling::types::IntValue) -/// or @b enum (@ref nil::marshalling::types::IntValue). The client application developer +/// for @b all the used fields, even for ones like integral values (@ref nil::crypto3::marshalling::types::IntValue) +/// or @b enum (@ref nil::crypto3::marshalling::types::IntValue). The client application developer /// may want to change the default value of some field, maybe even add or /// change (override) provided ranges of valid values, force failing of read /// operation on invalid values, etc... @b NOTE, that when allowing such @@ -1137,12 +1137,12 @@ /// @code /// template /// using MyField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, /// TExtraOpts..., // extra options -/// nil::marshalling::option::default_num_value<10>, // default value -/// nil::marshalling::option::valid_num_value_range<10, 20> // default range of valid values +/// nil::crypto3::marshalling::option::default_num_value<10>, // default value +/// nil::crypto3::marshalling::option::valid_num_value_range<10, 20> // default range of valid values /// >; /// @endcode /// This is because earlier used options take priority over ones used later. @@ -1152,17 +1152,17 @@ /// (which will require both read and write operation for every message) except /// a only a few, that go only one direction (from client to server or the opposite). /// In this case the generated code will contain implementation for -/// both polymorphic read (@ref nil::marshalling::MessageBase::readImpl()) and write -/// (@ref nil::marshalling::MessageBase::write_impl()). For uni-directional messages some +/// both polymorphic read (@ref nil::crypto3::marshalling::MessageBase::readImpl()) and write +/// (@ref nil::crypto3::marshalling::MessageBase::write_impl()). For uni-directional messages some /// of these function may be redundant, which unnecessary increases the binary /// size. It may become a problem for bare-metal platforms with limited amount /// of ROM space. The @b Marshalling library provides options that may suppress automatic -/// generation of some virtual functions by the @b nil::marshalling::MessageBase. The available +/// generation of some virtual functions by the @b nil::crypto3::marshalling::MessageBase. The available /// options are: -/// @li @ref nil::marshalling::option::no_read_impl -/// @li @ref nil::marshalling::option::no_write_impl -/// @li @ref nil::marshalling::option::no_valid_impl -/// @li @ref nil::marshalling::option::no_length_impl +/// @li @ref nil::crypto3::marshalling::option::no_read_impl +/// @li @ref nil::crypto3::marshalling::option::no_write_impl +/// @li @ref nil::crypto3::marshalling::option::no_valid_impl +/// @li @ref nil::crypto3::marshalling::option::no_length_impl /// /// These options should not be used in the definition of protocol messages, but /// it would be wise to allow the client application use them when necessary. It @@ -1172,8 +1172,8 @@ /// { /// struct message /// { -/// using Message1 = nil::marshalling::option::empty_option; -/// using Message2 = nil::marshalling::option::empty_option; +/// using Message1 = nil::crypto3::marshalling::option::empty_option; +/// using Message2 = nil::crypto3::marshalling::option::empty_option; /// ... /// }; /// }; @@ -1188,11 +1188,11 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::fields_impl::All>, -/// nil::marshalling::option::msg_type >, +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::fields_impl::All>, +/// nil::crypto3::marshalling::option::msg_type >, /// typename TOpt::message::Message1 // Extra options /// > /// { diff --git a/crypto3/libs/marshalling/core/docs/page_field.dox b/crypto3/libs/marshalling/core/docs/page_field.dox index 3760259099..34dee4a68b 100644 --- a/crypto3/libs/marshalling/core/docs/page_field.dox +++ b/crypto3/libs/marshalling/core/docs/page_field.dox @@ -2,14 +2,14 @@ /// @tableofcontents /// fields_type are abstractions around value storage primitives and/or objects, /// such as integral values, floating point values, strings, arrays, etc.. -/// Every @b field class is defined in @ref nil::marshalling::field namespace and +/// Every @b field class is defined in @ref nil::crypto3::marshalling::field namespace and /// exposes predefined interface in order to /// make template meta-programming as easy as possible. As an example let's -/// take a look at @ref nil::marshalling::types::IntValue class which is used to +/// take a look at @ref nil::crypto3::marshalling::types::IntValue class which is used to /// define integral value field. /// @code /// template -/// class nil::marshalling::types::IntValue : public TBase +/// class nil::crypto3::marshalling::types::IntValue : public TBase /// { /// public: /// // Define inner storage type @@ -24,11 +24,11 @@ /// /// // Read /// template -/// nil::marshalling::ErrorStatus read(TIter& iter, std::size_t len) {...} +/// nil::crypto3::marshalling::ErrorStatus read(TIter& iter, std::size_t len) {...} /// /// // Write /// template -/// nil::marshalling::ErrorStatus write(TIter& iter, std::size_t len) const {...} +/// nil::crypto3::marshalling::ErrorStatus write(TIter& iter, std::size_t len) const {...} /// /// // Serialisation length /// std::size_t length() const {...} @@ -53,10 +53,10 @@ /// The main things to note are that every field definition class: /// @li receives its base class as the first /// template parameter. It is expected to be a variant of @ref -/// nil::marshalling::field_type with @ref nil::marshalling::option::big_endian or @ref -/// nil::marshalling::option::little_endian option to specify the serialization endian. +/// nil::crypto3::marshalling::field_type with @ref nil::crypto3::marshalling::option::big_endian or @ref +/// nil::crypto3::marshalling::option::little_endian option to specify the serialization endian. /// @li exhibits some default behaviour which can be modified by -/// passing various options from @ref nil::marshalling::option namespace as additional template +/// passing various options from @ref nil::crypto3::marshalling::option namespace as additional template /// parameters. All the available options are described below in this tutorial. /// @li defines @b value_type inner value storage /// type and provides @b value() member functions to access the stored value. @@ -76,28 +76,28 @@ /// abstractions do not have polymorphic behaviour. /// /// The available fields abstractions are: -/// @li @ref nil::marshalling::types::IntValue - used to define @ref sec_field_tutorial_int_value -/// @li @ref nil::marshalling::types::EnumValue - used to define @ref sec_field_tutorial_enum_value -/// @li @ref nil::marshalling::types::BitmaskValue - used to define @ref sec_field_tutorial_bitmask_value -/// @li @ref nil::marshalling::types::Bitfield - used to define @ref sec_field_tutorial_bitfield -/// @li @ref nil::marshalling::types::Bundle - used to define @ref sec_field_tutorial_bundle -/// @li @ref nil::marshalling::types::array_list - used to define @ref sec_field_tutorial_array_list -/// @li @ref nil::marshalling::types::String - used to define @ref sec_field_tutorial_string -/// @li @ref nil::marshalling::types::FloatValue - used to define @ref sec_field_tutorial_fp_value -/// @li @ref nil::marshalling::types::Optional - used to define @ref sec_field_tutorial_optional -/// @li @ref nil::marshalling::types::Variant - used to define @ref sec_field_tutorial_variant +/// @li @ref nil::crypto3::marshalling::types::IntValue - used to define @ref sec_field_tutorial_int_value +/// @li @ref nil::crypto3::marshalling::types::EnumValue - used to define @ref sec_field_tutorial_enum_value +/// @li @ref nil::crypto3::marshalling::types::BitmaskValue - used to define @ref sec_field_tutorial_bitmask_value +/// @li @ref nil::crypto3::marshalling::types::Bitfield - used to define @ref sec_field_tutorial_bitfield +/// @li @ref nil::crypto3::marshalling::types::Bundle - used to define @ref sec_field_tutorial_bundle +/// @li @ref nil::crypto3::marshalling::types::array_list - used to define @ref sec_field_tutorial_array_list +/// @li @ref nil::crypto3::marshalling::types::String - used to define @ref sec_field_tutorial_string +/// @li @ref nil::crypto3::marshalling::types::FloatValue - used to define @ref sec_field_tutorial_fp_value +/// @li @ref nil::crypto3::marshalling::types::Optional - used to define @ref sec_field_tutorial_optional +/// @li @ref nil::crypto3::marshalling::types::Variant - used to define @ref sec_field_tutorial_variant /// /// @section sec_field_tutorial_int_value Integral value fields_type -/// Integral values are abstracted by nil::marshalling::types::IntValue class, which +/// Integral values are abstracted by nil::crypto3::marshalling::types::IntValue class, which /// receives at least two template parameters. The first one is a base -/// class, from which the nil::marshalling::types::IntValue will inherit. It must be -/// a variant of nil::marshalling::field_type, with the option specifying endian used for +/// class, from which the nil::crypto3::marshalling::types::IntValue will inherit. It must be +/// a variant of nil::crypto3::marshalling::field_type, with the option specifying endian used for /// data serialization. The second template parameter is a basic integral type /// that is used to store the field's value.@n /// For example: /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using MyIntField = nil::marshalling::types::IntValue; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using MyIntField = nil::crypto3::marshalling::types::IntValue; /// @endcode /// The example above defines a field that uses @b std::int16_t type to store /// its value. The value can be accessed using @b value() member function: @@ -109,7 +109,7 @@ /// @endcode /// When such field is serialized, 2 bytes (sizeof(std::int16_t)) are written /// to the output buffer, most significant first and less significant second -/// (because @b MyFieldBase base class was defined using nil::marshalling::option::big_endian +/// (because @b MyFieldBase base class was defined using nil::crypto3::marshalling::option::big_endian /// option). /// /// @subsection sec_field_tutorial_int_value_fixed_length Modifying Serialisation length @@ -121,9 +121,9 @@ /// may be encoded using only 3 bytes, and that's what the protocol specifies. /// The storage type for such value is going to be @b std::uint32_t, but there is /// a need to limit serialization length for it. The Marshalling library provides -/// nil::marshalling::option::fixed_length option, that can be used for this purpose. +/// nil::crypto3::marshalling::option::fixed_length option, that can be used for this purpose. /// @code -/// using MyIntField = nil::marshalling::types::IntValue >; +/// using MyIntField = nil::crypto3::marshalling::types::IntValue >; /// @endcode /// /// @subsection sec_field_tutorial_int_value_var_length Variable Serialisation length @@ -132,13 +132,13 @@ /// Base-128 /// encoding, where the most significant bit in the byte indicates whether /// it is the last byte in the numeric encoding or the next one also needs to -/// be taken into account. The Marshalling library provides nil::marshalling::option::var_length -/// option that can be used with nil::marshalling::types::IntValue and modifies the +/// be taken into account. The Marshalling library provides nil::crypto3::marshalling::option::var_length +/// option that can be used with nil::crypto3::marshalling::types::IntValue and modifies the /// behaviour of the latter to expose the required read()/write()/length() /// behaviour: /// @code /// // Variable length encoding, encoding takes at least 1 byte and at most 4 bytes. -/// using MyIntField = nil::marshalling::types::IntValue >; +/// using MyIntField = nil::crypto3::marshalling::types::IntValue >; /// @endcode /// The field's base class (@b MyFieldBase) contains endian information which is /// used to determine which part of the value is serialized first. @@ -151,14 +151,14 @@ /// serialized as a single byte, i.e. to specify year 2015 is to write value 15. /// However it may be inconvenient to manually adjust serialized/deserialized /// value by predefined offset 2000. To help with such case option -/// nil::marshalling::option::num_value_ser_offset can be used. For example: +/// nil::crypto3::marshalling::option::num_value_ser_offset can be used. For example: /// @code /// using YearField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::int16_t, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::num_value_ser_offset<-2000> +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::num_value_ser_offset<-2000> /// >; /// /// static const std::uint8_t SerData[] = { 15 }; // Pretend serialization data @@ -167,7 +167,7 @@ /// YearField year; /// auto* readIter = &SerData[0]; /// auto es = year.read(readIter, SerDataLen); // Read year information -/// assert(es == nil::marshalling::ErrorStatus::success); // No failure is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No failure is expected /// /// std::cout << year.value() << std::endl; // Prints 2015; /// @@ -177,10 +177,10 @@ /// std::vector outData; // Pretend output buffer /// auto writeIter = std::back_inserter(outData); /// es = year.write(writeIter, outData.max_size()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No failure is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No failure is expected /// /// assert(outData.size() == 1U); // Only 1 byte is expected to be pushed to outData, -/// // due to using nil::marshalling::option::fixed_length<1> option. +/// // due to using nil::crypto3::marshalling::option::fixed_length<1> option. /// assert(outData[0] == 16); // The value equal to "year.value() - 2000" is expected to be written. /// @endcode /// @@ -193,13 +193,13 @@ /// The definition of such field may look like: /// @code /// using DistanceField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, -/// nil::marshalling::option::scaling_ratio<1, 1000> +/// nil::crypto3::marshalling::option::scaling_ratio<1, 1000> /// >; /// @endcode -/// The nil::marshalling::option::scaling_ratio option allows scaling of serialized value +/// The nil::crypto3::marshalling::option::scaling_ratio option allows scaling of serialized value /// (distance in mm) to handling value (distance in m) and vice versa: /// @code /// static const std::uint8_t InData[] = {0x3, 0xe8}; // Pretend input buffer, encoded 1000 @@ -208,7 +208,7 @@ /// DistanceField dist; /// const auto* readIter = &InData[0];; /// auto es = dist.read(readIter, InDataSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// /// std::cout << "distance in mm: " << dist.value() << '\n'; // Prints 1000 /// std::cout << "distance in m: " << dist.get_scaled() << std::endl; // Prints 1.0 @@ -223,13 +223,13 @@ /// As the result the field can be defined as: /// @code /// using OtherDistanceField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, -/// nil::marshalling::option::scaling_ratio<10, 1> +/// nil::crypto3::marshalling::option::scaling_ratio<10, 1> /// >; /// @endcode -/// The nil::marshalling::option::scaling_ratio option allows scaling of serialized value +/// The nil::crypto3::marshalling::option::scaling_ratio option allows scaling of serialized value /// (distance in tens of mm) to handling value (distance in mm) and vice verse: /// @code /// static const std::uint8_t InData[] = {0x0, 0xf}; // Pretend input buffer, encoded 15 @@ -238,7 +238,7 @@ /// OtherDistanceField dist; /// const auto* readIter = &InData[0];; /// auto es = dist.read(readIter, InDataSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// /// std::cout << "distance in tens of mm: " << dist.value() << '\n'; // Prints 15 /// std::cout << "distance in mm: " << dist.get_scaled() << std::endl; // Prints 150 @@ -247,10 +247,10 @@ /// std::cout << "New distance in tens of mm: " << dist.value() << std::endl; // Prints 50 /// @endcode /// -/// Methods nil::marshalling::types::IntValue::get_scaled and nil::marshalling::types::IntValue::set_scaled -/// take into account scaling ratio provided (with nil::marshalling::option::scaling_ratio option) -/// to the nil::marshalling::types::IntValue field. If such option wasn't used -/// @b nil::marshalling::option::scaling_ratio<1, 1> is assumed. +/// Methods nil::crypto3::marshalling::types::IntValue::get_scaled and nil::crypto3::marshalling::types::IntValue::set_scaled +/// take into account scaling ratio provided (with nil::crypto3::marshalling::option::scaling_ratio option) +/// to the nil::crypto3::marshalling::types::IntValue field. If such option wasn't used +/// @b nil::crypto3::marshalling::option::scaling_ratio<1, 1> is assumed. /// /// @subsection sec_field_tutorial_int_value_units value units /// In addition to @ref sec_field_tutorial_int_value_scaling, the @b Marshalling library @@ -260,13 +260,13 @@ /// the type of the units is specified. /// @code /// using DistanceField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, -/// nil::marshalling::option::units_millimeters +/// nil::crypto3::marshalling::option::units_millimeters /// >; /// @endcode -/// The nil::marshalling::option::units_millimeters option specifies that field contains +/// The nil::crypto3::marshalling::option::units_millimeters option specifies that field contains /// distance in millimeters, which allows @b Marshalling library provide proper /// conversion to other distance units when necessary: /// @code @@ -276,18 +276,18 @@ /// DistanceField dist; /// const auto* readIter = &InData[0];; /// auto es = dist.read(readIter, InDataSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// /// std::cout << "Original value: " << dist.value() << '\n'; // Prints 1000 -/// std::cout << "distance in mm: " << nil::marshalling::units::get_millimeters(dist) << std::endl; // Prints 1000 -/// std::cout << "distance in cm: " << nil::marshalling::units::get_centimeters(dist) << std::endl; // Prints 100.0 -/// std::cout << "distance in m: " << nil::marshalling::units::getMeters(dist) << std::endl; // Prints 1.0 +/// std::cout << "distance in mm: " << nil::crypto3::marshalling::units::get_millimeters(dist) << std::endl; // Prints 1000 +/// std::cout << "distance in cm: " << nil::crypto3::marshalling::units::get_centimeters(dist) << std::endl; // Prints 100.0 +/// std::cout << "distance in m: " << nil::crypto3::marshalling::units::getMeters(dist) << std::endl; // Prints 1.0 /// -/// nil::marshalling::units::setCentimeters(dist, 5.5f); +/// nil::crypto3::marshalling::units::setCentimeters(dist, 5.5f); /// std::cout << "New value: " << dist.value() << '\n'; // Prints 55 -/// std::cout << "New distance in mm: " << nil::marshalling::units::get_millimeters(dist) << std::endl; // Prints 55 -/// std::cout << "New distance in cm: " << nil::marshalling::units::get_centimeters(dist) << std::endl; // Prints 5.5 -/// std::cout << "New distance in m: " << nil::marshalling::units::getMeters(dist) << std::endl; // Prints 0.055 +/// std::cout << "New distance in mm: " << nil::crypto3::marshalling::units::get_millimeters(dist) << std::endl; // Prints 55 +/// std::cout << "New distance in cm: " << nil::crypto3::marshalling::units::get_centimeters(dist) << std::endl; // Prints 5.5 +/// std::cout << "New distance in m: " << nil::crypto3::marshalling::units::getMeters(dist) << std::endl; // Prints 0.055 /// @endcode /// /// In the examples above the "units" specification may replace the "scaling" @@ -296,11 +296,11 @@ /// multiplied by 10'000'000 to make integral value out of floating point. /// @code /// using LatField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::int32_t, -/// nil::marshalling::option::scaling_ratio<1, 10000000>, -/// nil::marshalling::option::units_degrees +/// nil::crypto3::marshalling::option::scaling_ratio<1, 10000000>, +/// nil::crypto3::marshalling::option::units_degrees /// >; /// @endcode /// The @b Marshalling library uses the scaling ratio as well as units information to @@ -308,66 +308,66 @@ /// @code /// LatField lat(123456789); // Encoded latitude of 12.3456789 /// std::cout << "Raw value: " << lat.value() << std::endl; // Prints 123456789 -/// std::cout << "Lat in degrees: " << nil::marshalling::units::getDegrees(lat) << std::endl; // Prints 12.3456789 -/// std::cout << "Lat in radians: " << nil::marshalling::units::getRadians(lat) << std::endl; // 0.21547274519 +/// std::cout << "Lat in degrees: " << nil::crypto3::marshalling::units::getDegrees(lat) << std::endl; // Prints 12.3456789 +/// std::cout << "Lat in radians: " << nil::crypto3::marshalling::units::getRadians(lat) << std::endl; // 0.21547274519 /// -/// nil::marshalling::units::setDegrees(lat, 22.33); +/// nil::crypto3::marshalling::units::setDegrees(lat, 22.33); /// std::cout << "New raw value: " << lat.value() << std::endl; // Prints 223300000 -/// std::cout << "New degrees value: " << nil::marshalling::units::getDegrees(lat) << std::endl; // Prints 22.33 -/// std::cout << "New radians value: " << nil::marshalling::units::getRadians(lat) << std::endl; // Prints 0.38973202 +/// std::cout << "New degrees value: " << nil::crypto3::marshalling::units::getDegrees(lat) << std::endl; // Prints 22.33 +/// std::cout << "New radians value: " << nil::crypto3::marshalling::units::getRadians(lat) << std::endl; // Prints 0.38973202 /// -/// nil::marshalling::units::setRadians(lat, 1.04719); +/// nil::crypto3::marshalling::units::setRadians(lat, 1.04719); /// std::cout << "Updated raw value: " << lat.value() << std::endl; // Prints 600000000 -/// std::cout << "Updated degrees value: " << nil::marshalling::units::getDegrees(lat) << std::endl; // Prints 60 -/// std::cout << "Updated radians value: " << nil::marshalling::units::getRadians(lat) << std::endl; // Prints 1.04719 +/// std::cout << "Updated degrees value: " << nil::crypto3::marshalling::units::getDegrees(lat) << std::endl; // Prints 60 +/// std::cout << "Updated radians value: " << nil::crypto3::marshalling::units::getRadians(lat) << std::endl; // Prints 1.04719 /// @endcode /// The @b Marshalling library provides mulitple @b options to specify the units of /// the field's value: /// @li @b Time: -/// - nil::marshalling::option::units_nanoseconds -/// - nil::marshalling::option::units_microseconds -/// - nil::marshalling::option::units_milliseconds -/// - nil::marshalling::option::units_seconds -/// - nil::marshalling::option::units_minutes -/// - nil::marshalling::option::units_days -/// - nil::marshalling::option::units_weeks +/// - nil::crypto3::marshalling::option::units_nanoseconds +/// - nil::crypto3::marshalling::option::units_microseconds +/// - nil::crypto3::marshalling::option::units_milliseconds +/// - nil::crypto3::marshalling::option::units_seconds +/// - nil::crypto3::marshalling::option::units_minutes +/// - nil::crypto3::marshalling::option::units_days +/// - nil::crypto3::marshalling::option::units_weeks /// @li @b distance: -/// - nil::marshalling::option::units_nanometers -/// - nil::marshalling::option::units_micrometers -/// - nil::marshalling::option::units_millimeters -/// - nil::marshalling::option::units_centimeters -/// - nil::marshalling::option::units_meters -/// - nil::marshalling::option::units_kilometers +/// - nil::crypto3::marshalling::option::units_nanometers +/// - nil::crypto3::marshalling::option::units_micrometers +/// - nil::crypto3::marshalling::option::units_millimeters +/// - nil::crypto3::marshalling::option::units_centimeters +/// - nil::crypto3::marshalling::option::units_meters +/// - nil::crypto3::marshalling::option::units_kilometers /// @li @b speed: -/// - nil::marshalling::option::units_nanometers_per_second -/// - nil::marshalling::option::units_micrometers_per_second -/// - nil::marshalling::option::units_millimeters_per_second -/// - nil::marshalling::option::units_centimeters_per_second -/// - nil::marshalling::option::units_meters_per_second -/// - nil::marshalling::option::units_kilometers_per_second -/// - nil::marshalling::option::units_kilometers_per_hour +/// - nil::crypto3::marshalling::option::units_nanometers_per_second +/// - nil::crypto3::marshalling::option::units_micrometers_per_second +/// - nil::crypto3::marshalling::option::units_millimeters_per_second +/// - nil::crypto3::marshalling::option::units_centimeters_per_second +/// - nil::crypto3::marshalling::option::units_meters_per_second +/// - nil::crypto3::marshalling::option::units_kilometers_per_second +/// - nil::crypto3::marshalling::option::units_kilometers_per_hour /// @li @b frequency: -/// - nil::marshalling::option::units_hertz -/// - nil::marshalling::option::units_kilohertz -/// - nil::marshalling::option::units_megahertz -/// - nil::marshalling::option::units_gigahertz +/// - nil::crypto3::marshalling::option::units_hertz +/// - nil::crypto3::marshalling::option::units_kilohertz +/// - nil::crypto3::marshalling::option::units_megahertz +/// - nil::crypto3::marshalling::option::units_gigahertz /// @li @b angle: -/// - nil::marshalling::option::units_degrees -/// - nil::marshalling::option::units_radians +/// - nil::crypto3::marshalling::option::units_degrees +/// - nil::crypto3::marshalling::option::units_radians /// @li @b Electrical @b current: -/// - nil::marshalling::option::units_nanoamps -/// - nil::marshalling::option::units_microamps -/// - nil::marshalling::option::units_milliamps -/// - nil::marshalling::option::units_amps -/// - nil::marshalling::option::units_kiloamps +/// - nil::crypto3::marshalling::option::units_nanoamps +/// - nil::crypto3::marshalling::option::units_microamps +/// - nil::crypto3::marshalling::option::units_milliamps +/// - nil::crypto3::marshalling::option::units_amps +/// - nil::crypto3::marshalling::option::units_kiloamps /// @li @b Electrical @b voltage: -/// - nil::marshalling::option::units_nanovolts -/// - nil::marshalling::option::units_microvolts -/// - nil::marshalling::option::units_millivolts -/// - nil::marshalling::option::units_volts -/// - nil::marshalling::option::units_kilovolts +/// - nil::crypto3::marshalling::option::units_nanovolts +/// - nil::crypto3::marshalling::option::units_microvolts +/// - nil::crypto3::marshalling::option::units_millivolts +/// - nil::crypto3::marshalling::option::units_volts +/// - nil::crypto3::marshalling::option::units_kilovolts /// -/// All the units conversion functions reside in nil::marshalling::units namespace. @b NOTE, +/// All the units conversion functions reside in nil::crypto3::marshalling::units namespace. @b NOTE, /// that conversion can be applied only between the units of the same type. The /// units compitability check is performed at compile time and the compilation /// will fail on attempt to set/get incompatible value, such as @@ -381,7 +381,7 @@ /// /// @subsection sec_field_tutorial_int_value_other Other options_type /// There multiple common options that are applicable to all the fields, -/// nil::marshalling::types::IntValue included. Please refer to +/// nil::crypto3::marshalling::types::IntValue included. Please refer to /// @ref sec_field_tutorial_common_options for more detail. /// /// @section sec_field_tutorial_enum_value Enum value fields_type @@ -415,8 +415,8 @@ /// Baud_115200 /// }; /// -/// using MyFieldBase = nil::marshalling::field_type; -/// using BaudField = nil::marshalling::types::EnumValue; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using BaudField = nil::crypto3::marshalling::types::EnumValue; /// /// BaudField baud; /// ... @@ -425,34 +425,34 @@ /// std::vector outData; // Pretend output buffer /// auto writeIter = std::back_inserter(outData); /// auto es = baud.write(writeIter, outData.max_size()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// assert(outData.size() == 1); // Single byte output is expected /// assert(outData[0] == 6U); // value 6 is expected to be written /// @endcode -/// nil::marshalling::types::EnumValue is very similar to nil::marshalling::types::IntValue. The main +/// nil::crypto3::marshalling::types::EnumValue is very similar to nil::crypto3::marshalling::types::IntValue. The main /// difference is using enum instead of integral type as a second template /// parameter. The default serialization length is determined by the underlying /// type of the enum. That't why it is important to explicitly specify the /// underlying type of the enum when defining it, and not leave this to the /// compiler. /// -/// The nil::marshalling::types::EnumValue field supports almost all the options that -/// can be used with nil::marshalling::types::IntValue: @ref sec_field_tutorial_int_value_fixed_length, +/// The nil::crypto3::marshalling::types::EnumValue field supports almost all the options that +/// can be used with nil::crypto3::marshalling::types::IntValue: @ref sec_field_tutorial_int_value_fixed_length, /// @ref sec_field_tutorial_int_value_var_length, @ref sec_field_tutorial_int_value_ser_offset, /// as well as @ref sec_field_tutorial_common_options. /// /// @section sec_field_tutorial_bitmask_value Bitmask value fields_type /// Quite often messages in communication protocol use some kind of flags, where /// single bit has a independent meaning. It is more convenient to treat -/// such flags as bitmasks rather than integral values. nil::marshalling::types::BitmaskValue +/// such flags as bitmasks rather than integral values. nil::crypto3::marshalling::types::BitmaskValue /// provides a convenient interface to handle such bitmasks. /// @code -/// using BitmaskField = nil::marshalling::types::BitmaskValue; +/// using BitmaskField = nil::crypto3::marshalling::types::BitmaskValue; /// @endcode -/// By default the underlying storage type of the nil::marshalling::types::BitmaskValue is +/// By default the underlying storage type of the nil::crypto3::marshalling::types::BitmaskValue is /// @b unsigned, which makes the default serialization length to be /// @b sizeof(unsigned). The modification of the underlying storage type as -/// well as serialization length can be done using nil::marshalling::option::fixed_length +/// well as serialization length can be done using nil::crypto3::marshalling::option::fixed_length /// option (see @ref sec_field_tutorial_int_value_fixed_length). The underlying /// type will always be some unsigned integral type. If the serialization length /// is specified to be 1 byte, the underlying storage type is @b std::uint8_t, @@ -460,53 +460,53 @@ /// if the serialization length is 3 or 4 bytes, the underlying storage type is /// @b std::uin32_t, etc... /// @code -/// using BitmaskField_1byte = nil::marshalling::types::BitmaskValue >; +/// using BitmaskField_1byte = nil::crypto3::marshalling::types::BitmaskValue >; /// static_assert(std::is_same::value, "std::uint8_t type is expected"); /// assert(BitmaskField_1byte().length() == 1U); /// -/// using BitmaskField_2bytes = nil::marshalling::types::BitmaskValue >; +/// using BitmaskField_2bytes = nil::crypto3::marshalling::types::BitmaskValue >; /// static_assert(std::is_same::value, "std::uint16_t type is expected"); /// assert(BitmaskField_2bytes().length() == 2U); /// -/// using BitmaskField_3bytes = nil::marshalling::types::BitmaskValue >; +/// using BitmaskField_3bytes = nil::crypto3::marshalling::types::BitmaskValue >; /// static_assert(std::is_same::value, "std::uint32_t type is expected"); /// assert(BitmaskField_2bytes().length() == 3U); /// -/// using BitmaskField_4bytes = nil::marshalling::types::BitmaskValue >; +/// using BitmaskField_4bytes = nil::crypto3::marshalling::types::BitmaskValue >; /// static_assert(std::is_same::value, "std::uint32_t type is expected"); /// assert(BitmaskField_2bytes().length() == 4U); /// @endcode /// All the @ref sec_field_tutorial_common_options can also be used with -/// nil::marshalling::types::BitmaskValue. +/// nil::crypto3::marshalling::types::BitmaskValue. /// /// @subsection sec_field_tutorial_bitmask_value_reserved Reserved Bits /// Quite often the bitmask fields contain reserved bits, which must preserve -/// some values (usually 0). The nil::marshalling::types::BitmaskValue fields support -/// usage of nil::marshalling::option::bitmask_reserved_bits alias option. The template +/// some values (usually 0). The nil::crypto3::marshalling::types::BitmaskValue fields support +/// usage of nil::crypto3::marshalling::option::bitmask_reserved_bits alias option. The template /// parameters of the option specify mask for reserved bits as well as their /// expected values. The check for the reserved bits values is performed inside -/// @b nil::marshalling::types::BitmaskValue::valid() member function. +/// @b nil::crypto3::marshalling::types::BitmaskValue::valid() member function. /// @code /// using MyBitmask = -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 /// >; /// @endcode /// /// @subsection sec_field_tutorial_bitmask_value_names Bit Names /// Quite often there is a need to provide names for the bits in the -/// nil::marshalling::types::BitmaskValue field. It is possible to define it as external +/// nil::crypto3::marshalling::types::BitmaskValue field. It is possible to define it as external /// independent enum. However, it may be convenient to define it as internal -/// type. It is possible to do by inheriting from appropriate nil::marshalling::types::BitmaskValue +/// type. It is possible to do by inheriting from appropriate nil::crypto3::marshalling::types::BitmaskValue /// type and use MARSHALLING_BITMASK_BITS() macro to define names for bits. For example /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 /// > /// { /// MARSHALLING_BITMASK_BITS(first, third=2, fourth, fifth, sixth, seventh, eighth); @@ -515,10 +515,10 @@ /// is equivalent to defining: /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> /// > /// { /// enum BitIdx @@ -536,7 +536,7 @@ /// @endcode /// @b NOTE, that provided names have found their way to @b BitIdx enum type, and /// got prefixed with @b BitIdx_. This indices may be used with -/// nil::marshalling::types::BitmaskValue::get_bit_value() and nil::marshalling::types::BitmaskValue::set_bit_value() +/// nil::crypto3::marshalling::types::BitmaskValue::get_bit_value() and nil::crypto3::marshalling::types::BitmaskValue::set_bit_value() /// member functions. /// /// Also note, that there is automatically generated @b BitIdx_numOfValues @@ -549,10 +549,10 @@ /// generate the convenience functions. For example: /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 /// > /// { /// MARSHALLING_BITMASK_BITS(first, third=2, fourth, fifth, sixth, seventh, eighth); @@ -562,10 +562,10 @@ /// is equivalent to defining: /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> /// > /// { /// enum BitIdx {...} @@ -585,10 +585,10 @@ /// can be unified into one @ref MARSHALLING_BITMASK_BITS_SEQ(): /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0xf0, 0> // 4 MSBs are reserved +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0xf0, 0> // 4 MSBs are reserved /// > /// { /// MARSHALLING_BITMASK_BITS_SEQ(first, second, third, fourth); @@ -604,10 +604,10 @@ /// respectively. For example: /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0xf0, 0> // 4 MSBs are reserved +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0xf0, 0> // 4 MSBs are reserved /// > /// { /// MARSHALLING_BITMASK_BITS_SEQ_NOTEMPLATE(first, second, third, fourth); @@ -619,19 +619,19 @@ /// @code /// template /// class MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0xf0, 0>, // 4 MSBs are reserved +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0xf0, 0>, // 4 MSBs are reserved /// TExtraOptions... /// > /// { /// // Duplicate base class type /// using Base = -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0xf0, 0>, // 4 MSBs are reserved +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0xf0, 0>, // 4 MSBs are reserved /// TExtraOptions... /// >; /// public: @@ -647,7 +647,7 @@ /// the defined symbol to add / remove the definition of the @b Base member type. /// @code /// template -/// class MyBitmask : public nil::marshalling::types::BitmaskValue<...> +/// class MyBitmask : public nil::crypto3::marshalling::types::BitmaskValue<...> /// { /// #ifdef MARSHALLING_MUST_DEFINE_BASE /// using Base = ...; @@ -690,16 +690,16 @@ /// /// These value must be accessed and treated as independent values. However, they /// must be bundled into a single byte when serialization happens. The -/// Marshalling library provides nil::marshalling::types::Bitfield field for this purpose. +/// Marshalling library provides nil::crypto3::marshalling::types::Bitfield field for this purpose. /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using SerialConfigField = -/// nil::marshalling::types::Bitfield< +/// nil::crypto3::marshalling::types::Bitfield< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::BitmaskValue > +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::BitmaskValue > /// > /// >; /// @endcode @@ -708,17 +708,17 @@ /// std::tuple /// and passed as the second template parameter. /// @li The serialization length of every bitfield member is specified in bits using -/// nil::marshalling::option::fixed_bit_length (note difference to nil::marshalling::option::fixed_length +/// nil::crypto3::marshalling::option::fixed_bit_length (note difference to nil::crypto3::marshalling::option::fixed_length /// that specifies length in bytes). /// @li The summary of all the "bit" lengths of all the members must be divisible /// by 8, i.e. to be packed in any number of bytes without leaving a single /// bit undefined. -/// @li The member of the bitfield may be any numeric field (nil::marshalling::types::IntValue, -/// nil::marshalling::types::EnumValue, and nil::marshalling::types::BitmaskValue), that support -/// nil::marshalling::option::fixed_bit_length option. +/// @li The member of the bitfield may be any numeric field (nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::types::EnumValue, and nil::crypto3::marshalling::types::BitmaskValue), that support +/// nil::crypto3::marshalling::option::fixed_bit_length option. /// /// Every member of the bitfield may use all the supported options. The -/// nil::marshalling::types::Bitfield itself may receive only options listed in its class +/// nil::crypto3::marshalling::types::Bitfield itself may receive only options listed in its class /// description. /// /// To get an access to the member fields use @b value() member function: @@ -737,7 +737,7 @@ /// std::vector outData; // Pretend output buffer /// auto writeIter = std::back_inserter(outData); /// auto es = baud.write(writeIter, outData.max_size()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// assert(outData.size() == 1); // Single byte output is expected /// assert(outData[0] == 0x56); // Binary value split to 3-2-3 bits: 010|10|110 /// @endcode @@ -747,7 +747,7 @@ /// It can be achieved by using /// MARSHALLING_FIELD_MEMBERS_ACCESS() macro inside field definition class. /// @code -/// class SerialConfigField : public nil::marshalling::types::Bitfield<...> +/// class SerialConfigField : public nil::crypto3::marshalling::types::Bitfield<...> /// { /// public: /// MARSHALLING_FIELD_MEMBERS_ACCESS(baud, parity, flags); @@ -755,7 +755,7 @@ /// @endcode /// It is equivalent to having the following enum, types and functions defined: /// @code -/// class SerialConfigField : public nil::marshalling::types::Bitfield<...> +/// class SerialConfigField : public nil::crypto3::marshalling::types::Bitfield<...> /// { /// public: /// // Access indices for member fields @@ -837,7 +837,7 @@ /// in the example above), then try to substitute the used macro with /// @ref MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE(). For example: /// @code -/// class SerialConfigField : public nil::marshalling::types::Bitfield<...> +/// class SerialConfigField : public nil::crypto3::marshalling::types::Bitfield<...> /// { /// public: /// MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE(baud, parity, flags); @@ -849,7 +849,7 @@ /// @code /// template /// class MyBitfieldField : public -/// nil::marshalling::types::Bitfield< +/// nil::crypto3::marshalling::types::Bitfield< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -857,7 +857,7 @@ /// { /// // Duplicate the base class type /// using Base = -/// nil::marshalling::types::Bitfield< +/// nil::crypto3::marshalling::types::Bitfield< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -873,7 +873,7 @@ /// the defined symbol to add / remove the definition of the @b Base member type. /// @code /// template -/// class MyBitfieldField : public nil::marshalling::types::Bitfield<...> +/// class MyBitfieldField : public nil::crypto3::marshalling::types::Bitfield<...> /// { /// #ifdef MARSHALLING_MUST_DEFINE_BASE /// using Base = ...; @@ -889,12 +889,12 @@ /// calculating length, checking field's contents validity, and bringing field's /// value into a consistent state. It may be required /// when a message contains sequence (see @ref sec_field_tutorial_array_list) -/// of such bundles/structs. The Marshalling library provides nil::marshalling::types::Bundle -/// field for this purpose. It is quite similar to nil::marshalling::types::Bitfield described +/// of such bundles/structs. The Marshalling library provides nil::crypto3::marshalling::types::Bundle +/// field for this purpose. It is quite similar to nil::crypto3::marshalling::types::Bitfield described /// earlier. The difference is that every member field /// doesn't specify any length in bits, just bytes. For example: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// /// enum SomeEnum : std::uint8_t /// { @@ -905,12 +905,12 @@ /// } /// /// using MyBundle = -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::IntValue // 2 bytes int value -/// nil::marshalling::types::EnumValue, // 1 byte enum value -/// nil::marshalling::types::BitmaskValue > // 1 byte bitmask +/// nil::crypto3::marshalling::types::IntValue // 2 bytes int value +/// nil::crypto3::marshalling::types::EnumValue, // 1 byte enum value +/// nil::crypto3::marshalling::types::BitmaskValue > // 1 byte bitmask /// > /// >; /// @@ -928,16 +928,16 @@ /// std::vector outData; // Pretend output buffer /// auto writeIter = std::back_inserter(outData); /// auto es = baud.write(writeIter, outData.max_size()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// assert(outData.size() == 4); // Expected 2 bytes for IntValue, 1 byte for EnumValue and 1 byte for BitmaskValue /// @endcode -/// The default behaviour of nil::marshalling::types::Bundle may be extended with options. +/// The default behaviour of nil::crypto3::marshalling::types::Bundle may be extended with options. /// Please refer to the class documentation for the list of supported options. /// /// Just like with the @ref sec_field_tutorial_bitfield, the names to the /// member fields can be provided by using MARSHALLING_FIELD_MEMBERS_ACCESS() macro. /// @code -/// class MyBundle : public nil::marshalling::types::Bundle<...> +/// class MyBundle : public nil::crypto3::marshalling::types::Bundle<...> /// { /// public: /// MARSHALLING_FIELD_MEMBERS_ACCESS(member1, member2, member3); @@ -951,12 +951,12 @@ /// the @ref sec_field_tutorial_bitfield, the same warning applies. /// If compilation fails on the attempt to compile MARSHALLING_FIELD_MEMBERS_ACCESS(), /// use either MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE() alternative or define -/// inner @b Base type to specify actual type of @ref nil::marshalling::types::Bundle +/// inner @b Base type to specify actual type of @ref nil::crypto3::marshalling::types::Bundle /// type. For example: /// @code /// template /// class MyBundle : public -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -964,7 +964,7 @@ /// { /// // Duplicate base type definition /// using Base = -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -980,7 +980,7 @@ /// the defined symbol to add / remove the definition of the @b Base member type. /// @code /// template -/// class MyBundle : public nil::marshalling::types::Bundle<...> +/// class MyBundle : public nil::crypto3::marshalling::types::Bundle<...> /// { /// #ifdef MARSHALLING_MUST_DEFINE_BASE /// using Base = ...; @@ -993,27 +993,27 @@ /// @section sec_field_tutorial_array_list Array List fields_type /// Some communication protocols may define messages that transmit sequence /// of similar fields and/or raw data buffers. To make it easier to handle, the -/// Marshalling library provides nil::marshalling::types::array_list field which provide a required +/// Marshalling library provides nil::crypto3::marshalling::types::array_list field which provide a required /// interface to properly handle such sequences of data. It supports a /// sequence of raw bytes /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MySimpleList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// std::uint8_t /// >; /// @endcode -/// as well as using sequence of any fields defined in nil::marshalling::field namespace +/// as well as using sequence of any fields defined in nil::crypto3::marshalling::field namespace /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyComplexList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// MyBundle<> // Complex bundle field, defined in previous section /// >; /// @endcode -/// By default the read operation on nil::marshalling::types::array_list continues as +/// By default the read operation on nil::crypto3::marshalling::types::array_list continues as /// long as there is data left in input buffer, and write operation serialises /// all the data stored in internal vector. These default behaviours can be /// changed using options described below. @@ -1021,25 +1021,25 @@ /// @subsection sec_field_tutorial_array_list_size_prefix Prefixing with Size Information /// Very often variable size sequences of raw bytes or other fields get /// prefixed with size information. The default behaviour of the -/// nil::marshalling::types::array_list is to read until the end of the buffer. Having +/// nil::crypto3::marshalling::types::array_list is to read until the end of the buffer. Having /// sequence prefixed with number of elements to follow, allows earlier /// termination of the read operation, and allows having other independent -/// fields to be appended after the sequence. The nil::marshalling::types::array_list -/// class supports nil::marshalling::option::sequence_size_field_prefix option that allows -/// to specify type of the size field (usually a variant of nil::marshalling::types::IntValue) -/// to be serialized before the contents of nil::marshalling::types::array_list being +/// fields to be appended after the sequence. The nil::crypto3::marshalling::types::array_list +/// class supports nil::crypto3::marshalling::option::sequence_size_field_prefix option that allows +/// to specify type of the size field (usually a variant of nil::crypto3::marshalling::types::IntValue) +/// to be serialized before the contents of nil::crypto3::marshalling::types::array_list being /// serialized. For example, the serialized raw bytes sequence is prefixed with /// 2 bytes of size information: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// -/// using SizePrefixField = nil::marshalling::types::IntValue; +/// using SizePrefixField = nil::crypto3::marshalling::types::IntValue; /// /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// std::uint8_t, -/// nil::marshalling::option::sequence_size_field_prefix +/// nil::crypto3::marshalling::option::sequence_size_field_prefix /// >; /// /// static const std::uint8_t InputBuffer[] = { @@ -1050,7 +1050,7 @@ /// MyList myList; /// const auto* readIter = &InputBuffer[0]; /// auto es = myList.read(readIter, InputBufferSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(myList.value().size() == 3U); // Reading only 3 elements /// assert((myList.value())[0] == 0xa); // First element /// assert((myList.value())[1] == 0xb); // Second element @@ -1062,69 +1062,69 @@ /// std::vector outputBuffer; /// auto writeIter = std::back_inserter(outputBuffer); /// es = myList.write(writeIter, outputBuffer.max_size()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(outputBuffer.size() == 5U); // Expected to write 5 bytes, 2 bytes for size, and 3 for elements. /// assert(std::equal(outputBuffer.begin(), outputBuffer.end(), std::begin(InputBuffer)); // The output must be equal to /// @endcode /// /// Some protocols prefix the sequence with serialization length rather /// than number of elements to follow. In this case the -/// @ref nil::marshalling::option::sequence_ser_length_field_prefix option needs to be used -/// instead of @ref nil::marshalling::option::sequence_size_field_prefix. +/// @ref nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option needs to be used +/// instead of @ref nil::crypto3::marshalling::option::sequence_size_field_prefix. /// /// @subsection sec_field_tutorial_array_list_elem_length_prefix Element Serialisation length Prefix /// Also some protocols, for easier exchange of lists between nodes that use /// different versions of the same protocol, may require prefixing every /// element of the list with its serialization length. In this case -/// @ref nil::marshalling::option::sequence_elem_ser_length_field_prefix option may be used. +/// @ref nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option may be used. /// For example, the list of bundles prefixed with 2 bytes specifying number of /// elements to follow, and with every element prefixed with its serialization length using /// variable length base-128 encoding may look like this: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// -/// using SizePrefixField = nil::marshalling::types::IntValue; +/// using SizePrefixField = nil::crypto3::marshalling::types::IntValue; /// using ElemLengthPrefixField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint32_t, -/// nil::marshalling::option::var_length<1, 4> // variable length encoding up to 4 bytes +/// nil::crypto3::marshalling::option::var_length<1, 4> // variable length encoding up to 4 bytes /// >; /// /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// MyBundle, // some bundle of fields -/// nil::marshalling::option::sequence_size_field_prefix, -/// nil::marshalling::option::sequence_elem_ser_length_field_prefix +/// nil::crypto3::marshalling::option::sequence_size_field_prefix, +/// nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix /// >; /// @endcode /// When every element of the list is of fixed size, i.e. has the same serialization /// length, it becomes redundant to prefix @b every element with its length. /// Instead, only first element can be prefixed with one, and all others may /// reuse the same information. To achieve such behaviour -/// @ref nil::marshalling::option::sequence_elem_fixed_ser_length_field_prefix should be used instead. +/// @ref nil::crypto3::marshalling::option::sequence_elem_fixed_ser_length_field_prefix should be used instead. /// For example, the list of fixed length bundles prefixed with 1 byte specifying number of /// elements to follow, and with first element prefixed with 1 byte containing its serialization length /// may look like this: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// -/// using SizePrefixField = nil::marshalling::types::IntValue; -/// using ElemLengthPrefixField = nil::marshalling::types::IntValue; +/// using SizePrefixField = nil::crypto3::marshalling::types::IntValue; +/// using ElemLengthPrefixField = nil::crypto3::marshalling::types::IntValue; /// /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::IntValue, -/// nil::marshalling::types::IntValue +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::types::IntValue /// > /// >, -/// nil::marshalling::option::sequence_size_field_prefix, -/// nil::marshalling::option::sequence_elem_fixed_ser_length_field_prefix +/// nil::crypto3::marshalling::option::sequence_size_field_prefix, +/// nil::crypto3::marshalling::option::sequence_elem_fixed_ser_length_field_prefix /// >; /// @endcode /// @@ -1138,23 +1138,23 @@ /// | 1 | 1 | Some flags bitmask | /// | 2 | 2 * N | Sequence of 2 byte integral values | /// -/// In this case the option nil::marshalling::option::sequence_size_field_prefix can NOT +/// In this case the option nil::crypto3::marshalling::option::sequence_size_field_prefix can NOT /// be used. In fact the size information is not a part of the sequence any /// more, it must be a separate independent field. When this field /// is successfully read, its value must be forced upon the sequence somehow /// before the read operation of the sequence takes place. To help with such -/// forcing, nil::marshalling::option::sequence_size_forcing_enabled option was introduced. -/// When this option used, the nil::marshalling::types::array_list::force_read_elem_count member +/// forcing, nil::crypto3::marshalling::option::sequence_size_forcing_enabled option was introduced. +/// When this option used, the nil::crypto3::marshalling::types::array_list::force_read_elem_count member /// function of the field may be used to force number of elements that follow. /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using SeqSizeField = nil::marshalling::types::IntValue; -/// using BitmaskField = nil::marshalling::types::BitmaskValue >; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using SeqSizeField = nil::crypto3::marshalling::types::IntValue; +/// using BitmaskField = nil::crypto3::marshalling::types::BitmaskValue >; /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::sequence_size_forcing_enabled +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::sequence_size_forcing_enabled /// >; /// /// static const std::uint8_t InputBuffer[] = { @@ -1167,20 +1167,20 @@ /// /// SeqSizeField sizeField; /// auto es = sizeField.read(readIter, remSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(sizeField.value() == 3U); // First byte should be read; /// /// remSize -= sizeField.length(); /// BitmaskField bitmask; /// es = bitmask.read(readIter, remSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(bitmask.value() == 0xff); // Second byte should be read; /// /// remSize -= bitmask.length(); /// MyList myList; /// myList.force_read_elem_count(sizeField.value()); // Force number of elements to read /// es = myList.read(readIter, remSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(myList.value().size() == 3U); // Reading only 3 elements /// assert((myList.value())[0] == 0xa); // First element /// assert((myList.value())[1] == 0xb); // Second element @@ -1196,29 +1196,29 @@ /// library allows forcing the serialization length of a single element when /// such information becomes available. It is similar to /// @ref sec_field_tutorial_array_list_detached_size_prefix. The option -/// @ref nil::marshalling::option::sequence_elem_length_forcing_enabled needs to be used when -/// defining the field type, and @ref nil::marshalling::types::array_list::force_read_elem_length() -/// and @ref nil::marshalling::types::array_list::clear_read_elem_length_forcing() functions to +/// @ref nil::crypto3::marshalling::option::sequence_elem_length_forcing_enabled needs to be used when +/// defining the field type, and @ref nil::crypto3::marshalling::types::array_list::force_read_elem_length() +/// and @ref nil::crypto3::marshalling::types::array_list::clear_read_elem_length_forcing() functions to /// set/clear the forcing information. /// @code /// // Common base class for all the fields -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// /// // field_type used to serialise serialization length of a single element in the list -/// using ElemLengthPrefixField = nil::marshalling::types::IntValue; +/// using ElemLengthPrefixField = nil::crypto3::marshalling::types::IntValue; /// /// // field_type used to serialise number of elements in the list -/// using SizePrefixField = nil::marshalling::types::IntValue; +/// using SizePrefixField = nil::crypto3::marshalling::types::IntValue; /// /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, -/// nil::marshalling::types::IntValue< // 3 bytes integers +/// nil::crypto3::marshalling::types::IntValue< // 3 bytes integers /// MyFieldBas, /// std::uint32_t, -/// nil::marshalling::option::fixed_length<3> >, -/// nil::marshalling::option::sequence_size_field_prefix, // 1 byte prefix -/// nil::marshalling::option::sequence_elem_length_forcing_enabled // enable forcing of the element length +/// nil::crypto3::marshalling::option::fixed_length<3> >, +/// nil::crypto3::marshalling::option::sequence_size_field_prefix, // 1 byte prefix +/// nil::crypto3::marshalling::option::sequence_elem_length_forcing_enabled // enable forcing of the element length /// >; /// /// static const std::uint8_t InputBuffer[] = { @@ -1233,12 +1233,12 @@ /// MyList myList; /// const auto* readIter = &InputBuffer[0]; /// auto es = lengthPrefix(readIter, InputBufferSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(lengthPrefix.value() == 4U); /// /// myList.force_read_elem_length(lengthPrefix.value()); // force serialization length of the single element /// auto es = myList.read(readIter, InputBufferSize - lengthPrefix.length()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(myList.value().size() == 2U); // Reading only 2 elements /// assert((myList.value())[0] == 0x0a0a0a); // First element /// assert((myList.value())[1] == 0x0b0b0b); // Second element @@ -1249,15 +1249,15 @@ /// Sometimes there is no information about size of the sequence up front. It /// may be terminating using some kind of special value. For example, the /// sequence of raw bytes is terminated by the value of 0. Such termination -/// is achieved by using nil::marshalling::option::sequence_termination_field_suffix option. +/// is achieved by using nil::crypto3::marshalling::option::sequence_termination_field_suffix option. /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using TermField = nil::marshalling::types::IntValue; // Default value is 0. +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using TermField = nil::crypto3::marshalling::types::IntValue; // Default value is 0. /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::sequence_termination_field_suffix +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::sequence_termination_field_suffix /// >; /// /// static const std::uint8_t InputBuffer[] = { @@ -1269,7 +1269,7 @@ /// /// MyList myList; /// es = myList.read(readIter, InputBufferSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(myList.value().size() == 4U); // Reading only 4 elements, terminating 0 is not included /// assert((myList.value())[0] == 0x1); // First element /// assert((myList.value())[1] == 0x2); // Second element @@ -1281,16 +1281,16 @@ /// @subsection sec_field_tutorial_array_list_fixed_size Fixed Size Sequences /// In many cases the size of the sequence is defined in the protocol without /// any prefix or suffix to define the length of the sequence. To define -/// such sequence nil::marshalling::option::sequence_fixed_size option should be used. +/// such sequence nil::crypto3::marshalling::option::sequence_fixed_size option should be used. /// Below is example of how to define sequence of four unsigned 16 bit integer /// values. /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::sequence_fixed_size<4> +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::sequence_fixed_size<4> /// >; /// /// static const std::uint8_t InputBuffer[] = { @@ -1302,7 +1302,7 @@ /// /// MyList myList; /// es = myList.read(readIter, InputBufferSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// assert(myList.value().size() == 4U); // Reading only 4 elements /// assert((myList.value())[0] == 0x1); // First element /// assert((myList.value())[1] == 0x2); // Second element @@ -1310,7 +1310,7 @@ /// assert((myList.value())[4] == 0x4); // Fourth element /// assert(std::distance(&InputBuffer[0], readIter) == 8); // Consumed only 4 element (2 bytes each) /// @endcode -/// @b NOTE, that nil::marshalling::option::sequence_fixed_size option insures existence of +/// @b NOTE, that nil::crypto3::marshalling::option::sequence_fixed_size option insures existence of /// the right number of elements "on the wire", but doesn't influence number /// of elements in the newly created list field: /// @code @@ -1339,8 +1339,8 @@ /// auto& complexListStorage = complexList.value(); // reference to std::vector; /// @endcode /// This behaviour can be modified using extra options such as @ref -/// nil::marshalling::option::custom_storage_type, @ref nil::marshalling::option::fixed_size_storage, -/// @ref nil::marshalling::option::orig_data_view, or @ref nil::marshalling::option::sequence_fixed_size_use_fixed_size_storage. +/// nil::crypto3::marshalling::option::custom_storage_type, @ref nil::crypto3::marshalling::option::fixed_size_storage, +/// @ref nil::crypto3::marshalling::option::orig_data_view, or @ref nil::crypto3::marshalling::option::sequence_fixed_size_use_fixed_size_storage. /// @b HOWEVER, these options do not influence the way how list fields are being /// serialized, they influence the way how list value has been stored. As the result, /// they should @b NOT be used in protocol definition. Instead, provide a way to @@ -1348,20 +1348,20 @@ /// options. For example: /// @code /// template -/// using MyList = nil::marshalling::types::array_list<..., TExtraOptions...>; +/// using MyList = nil::crypto3::marshalling::types::array_list<..., TExtraOptions...>; /// @endcode /// /// All the @ref sec_field_tutorial_common_options are also applicable to -/// nil::marshalling::types::array_list field. +/// nil::crypto3::marshalling::types::array_list field. /// /// @section sec_field_tutorial_string String fields_type /// Many protocols have to transfer strings. They are defined using -/// @ref nil::marshalling::types::String field. +/// @ref nil::crypto3::marshalling::types::String field. /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using MyString = nil::marshalling::types::String; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using MyString = nil::crypto3::marshalling::types::String; /// @endcode -/// It is very similar to nil::marshalling::types::array_list +/// It is very similar to nil::crypto3::marshalling::types::array_list /// it terms of value storage, read/write operations, and supported options. /// By default the value is stored as /// std::string. @@ -1371,21 +1371,21 @@ /// @endcode /// Just like described in @ref sec_field_tutorial_array_list_storage section /// above the same options can be used to modify the storage type of the -/// nil::marshalling::types::String field, but should @b NOT be used in protocol definition, but +/// nil::crypto3::marshalling::types::String field, but should @b NOT be used in protocol definition, but /// instead there should be an ability to provide extra options. /// @code /// template -/// using MyString = nil::marshalling::types::String; +/// using MyString = nil::crypto3::marshalling::types::String; /// @endcode /// /// Prefixing string with single byte of the size information will look like this: /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using SizePrefixField = nil::marshalling::types::IntValue; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using SizePrefixField = nil::crypto3::marshalling::types::IntValue; /// using MyString = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, -/// nil::marshalling::option::sequence_size_field_prefix +/// nil::crypto3::marshalling::option::sequence_size_field_prefix /// >; /// /// MyString myStr; @@ -1394,7 +1394,7 @@ /// std::vector outputBuf; /// auto writeIter = std::back_inserter(outputBuf); /// auto es = myStr.write(writeIter, outputBuf.max_size()); -/// assert(es = nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es = nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// assert(outputBuf.size() == 6U); // 1 byte of size, followed by 5 characters of "hello" string /// assert(outputBuf[0] == 5U); // size info /// assert(outputBuf[1] == 'h'); @@ -1408,12 +1408,12 @@ /// Encoding of zero termination strings without size prefix can be defined like /// this: /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using ZeroTermField = nil::marshalling::types::IntValue; // default value is 0 +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using ZeroTermField = nil::crypto3::marshalling::types::IntValue; // default value is 0 /// using MyString = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, -/// nil::marshalling::option::sequence_termination_field_suffix +/// nil::crypto3::marshalling::option::sequence_termination_field_suffix /// >; /// /// MyString myStr; @@ -1422,7 +1422,7 @@ /// std::vector outputBuf; /// auto writeIter = std::back_inserter(outputBuf); /// auto es = myStr.write(writeIter, outputBuf.max_size()); -/// assert(es = nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es = nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// assert(outputBuf.size() == 6U); // 5 characters of "hello" string followed by zero termination suffix /// assert(outputBuf[0] == 'h'); /// assert(outputBuf[1] == 'e'); @@ -1438,13 +1438,13 @@ /// characters. If string is too short, the serialization data is padded by /// zeros until full length of 32 characters is produced. /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using ZeroTermField = nil::marshalling::types::IntValue; // default value is 0 +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using ZeroTermField = nil::crypto3::marshalling::types::IntValue; // default value is 0 /// using MyString = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, -/// nil::marshalling::option::sequence_fixed_size<31>, -/// nil::marshalling::option::sequence_trailing_field_suffix +/// nil::crypto3::marshalling::option::sequence_fixed_size<31>, +/// nil::crypto3::marshalling::option::sequence_trailing_field_suffix /// >; /// /// MyString myStr; @@ -1453,7 +1453,7 @@ /// std::vector outputBuf; /// auto writeIter = std::back_inserter(outputBuf); /// auto es = myStr.write(writeIter, outputBuf.max_size()); -/// assert(es = nil::marshalling::ErrorStatus::success); // No error is expected +/// assert(es = nil::crypto3::marshalling::ErrorStatus::success); // No error is expected /// assert(outputBuf.size() == 32); // 5 characters of "hello" string followed by zero padding /// assert(outputBuf[0] == 'h'); /// assert(outputBuf[1] == 'e'); @@ -1464,42 +1464,42 @@ /// ... /// assert(outputBuf[31] == 0U); /// @endcode -/// @b NOTE, that the example above uses nil::marshalling::option::sequence_trailing_field_suffix -/// option, rather than nil::marshalling::option::sequence_termination_field_suffix. +/// @b NOTE, that the example above uses nil::crypto3::marshalling::option::sequence_trailing_field_suffix +/// option, rather than nil::crypto3::marshalling::option::sequence_termination_field_suffix. /// The options slightly differ. The "termination" one -/// (nil::marshalling::option::sequence_termination_field_suffix) forces the field to +/// (nil::crypto3::marshalling::option::sequence_termination_field_suffix) forces the field to /// stop reading when termination value is encountered, while "trailing" one -/// (nil::marshalling::option::sequence_trailing_field_suffix) doesn't check what it reads, -/// the reading size must be limited by other means (nil::marshalling::option::sequence_fixed_size +/// (nil::crypto3::marshalling::option::sequence_trailing_field_suffix) doesn't check what it reads, +/// the reading size must be limited by other means (nil::crypto3::marshalling::option::sequence_fixed_size /// in the example above). When the read is complete, it just consumes the /// termination character. Both options, however, force the termination /// character to be appended at the end during write operation. @n -/// Also note, that size limit is specified (using nil::marshalling::option::sequence_fixed_size) +/// Also note, that size limit is specified (using nil::crypto3::marshalling::option::sequence_fixed_size) /// to be 31. One more byte is added by the "trailing" suffix to complete to 32 /// bytes. /// -/// Just like with @ref nil::marshalling::types::array_list, it is possible to use static +/// Just like with @ref nil::crypto3::marshalling::types::array_list, it is possible to use static /// storage for fixed size strings: /// @code /// using MyString = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// ..., -/// nil::marshalling::option::sequence_fixed_size<16>, -/// nil::marshalling::option::sequence_fixed_size_use_fixed_size_storage +/// nil::crypto3::marshalling::option::sequence_fixed_size<16>, +/// nil::crypto3::marshalling::option::sequence_fixed_size_use_fixed_size_storage /// >; /// @endcode /// or /// @code /// using MyString = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// ..., -/// nil::marshalling::option::sequence_fixed_size<16>, -/// nil::marshalling::option::fixed_size_storage<16> +/// nil::crypto3::marshalling::option::sequence_fixed_size<16>, +/// nil::crypto3::marshalling::option::fixed_size_storage<16> /// >; /// @endcode /// /// @section sec_field_tutorial_fp_value Floating Point value fields_type -/// Floating point value fields (nil::marshalling::types::FloatValue) are very similar to +/// Floating point value fields (nil::crypto3::marshalling::types::FloatValue) are very similar to /// @ref sec_field_tutorial_int_value, but use @b float or @b double as its /// internal storage type. They abstract the IEEE 754 floating point /// values, which are serialized "as is" with either big or little endian @@ -1512,15 +1512,15 @@ /// "flags" bitmask field which specifies whether the following field exists or /// missing. The optional field may also be tentative, i.e. if there is enough /// data in the input buffer it exists, and missing otherwise. The Marshalling -/// library provides nil::marshalling::types::Optional which is a mere wrapper around +/// library provides nil::crypto3::marshalling::types::Optional which is a mere wrapper around /// other fields and provides an ability to set the optional state of the field. /// Let's do the example of the int32 field existence based on bit 0 in processing bitmask: /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using FlagsField = nil::marshalling::types::BitmaskValue >; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using FlagsField = nil::crypto3::marshalling::types::BitmaskValue >; /// using OptField = -/// nil::marshalling::types::Optional< -/// nil::marshalling::types::IntValue +/// nil::crypto3::marshalling::types::Optional< +/// nil::crypto3::marshalling::types::IntValue /// >; /// /// FlagsField flags; @@ -1531,7 +1531,7 @@ /// [&flags, &optField](const std::uint8_t*& iter, std::size_t len) /// { /// auto es = flags.read(iter, len); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// /// optField.set_missing(); /// if ((flags.value() & 0x1) != 0) { @@ -1539,7 +1539,7 @@ /// } /// /// es = optField.read(iter, len - flags.length()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No error is expected; +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No error is expected; /// }; /// /// @@ -1574,7 +1574,7 @@ /// updated after read operation: /// @code /// OptField optField1; -/// assert(optField1.get_mode() == nil::marshalling::types::OptionalMode::tentative); // Default mode is tentative +/// assert(optField1.get_mode() == nil::crypto3::marshalling::types::OptionalMode::tentative); // Default mode is tentative /// /// static const std::uint8_t InputBuffer[] = { /// 0x11, 0x22, 0x33, 0x44 @@ -1583,46 +1583,46 @@ /// /// auto* readIter = &InputBuffer[0]; /// auto es = optField1.read(readIter, InputBufferSize); -/// assert(es = nil::marshalling::ErrorStatus::success); +/// assert(es = nil::crypto3::marshalling::ErrorStatus::success); /// assert(std::distance(&InputBuffer[0], readIter) == 4); // Expected to read 4 bytes of int32_t int value -/// assert(optField1.get_mode() == nil::marshalling::types::OptionalMode::exists); // mode_type is changed +/// assert(optField1.get_mode() == nil::crypto3::marshalling::types::OptionalMode::exists); // mode_type is changed /// /// OptField optField2; -/// assert(optField2.get_mode() == nil::marshalling::types::OptionalMode::tentative); // Default mode is tentative +/// assert(optField2.get_mode() == nil::crypto3::marshalling::types::OptionalMode::tentative); // Default mode is tentative /// readIter = &InputBuffer[0]; /// es = optField2.read(readIter, 0); // Note 0 as a buffer size -/// assert(es = nil::marshalling::ErrorStatus::success); +/// assert(es = nil::crypto3::marshalling::ErrorStatus::success); /// assert(std::distance(&InputBuffer[0], readIter) == 0); // Expected not to read anything -/// assert(optField2.get_mode() == nil::marshalling::types::OptionalMode::missing); // mode_type is changed +/// assert(optField2.get_mode() == nil::crypto3::marshalling::types::OptionalMode::missing); // mode_type is changed /// @endcode -/// It is easy to change the default mode of the nil::marshalling::types::Optional field by -/// providing nil::marshalling::option::default_optional_mode option with selected default mode -/// or @ref nil::marshalling::option::missing_by_default / @ref nil::marshalling::option::exists_by_default aliases. +/// It is easy to change the default mode of the nil::crypto3::marshalling::types::Optional field by +/// providing nil::crypto3::marshalling::option::default_optional_mode option with selected default mode +/// or @ref nil::crypto3::marshalling::option::missing_by_default / @ref nil::crypto3::marshalling::option::exists_by_default aliases. /// @code /// using OptField = -/// nil::marshalling::types::Optional< -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::missing_by_default // Set default mode to be "missing" +/// nil::crypto3::marshalling::types::Optional< +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::missing_by_default // Set default mode to be "missing" /// >; /// @endcode /// Some protocols may include version information either in transport framing or /// in one of the messages. Such info may specify whether a specific field exists -/// or not. Such fields need to be wrapped in @ref nil::marshalling::types::Optional field, which -/// receives @ref nil::marshalling::option::exists_between_versions option to specify the +/// or not. Such fields need to be wrapped in @ref nil::crypto3::marshalling::types::Optional field, which +/// receives @ref nil::crypto3::marshalling::option::exists_between_versions option to specify the /// numeric versions of the protocol between which the field exists. /// @code /// using OptField = -/// nil::marshalling::types::Optional< -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::missing_by_default, // Set default mode to be "missing" -/// nil::marshalling::option::exists_between_versions<1, 5> +/// nil::crypto3::marshalling::types::Optional< +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::missing_by_default, // Set default mode to be "missing" +/// nil::crypto3::marshalling::option::exists_between_versions<1, 5> /// >; /// @endcode /// If the field has been introduced in one of the version, but hasn't been -/// removed yet, it is possible to use @ref nil::marshalling::option::exists_since_version alias -/// to @ref nil::marshalling::option::exists_between_versions. Or the opposite, if the field +/// removed yet, it is possible to use @ref nil::crypto3::marshalling::option::exists_since_version alias +/// to @ref nil::crypto3::marshalling::option::exists_between_versions. Or the opposite, if the field /// has been introduced in the first version, but deprecated and removed in the -/// later one, use @ref nil::marshalling::option::exists_until_version alias. +/// later one, use @ref nil::crypto3::marshalling::option::exists_until_version alias. /// /// Usage of such version control option will automatically mark the optional /// field as @b existing or @b missing based on the provided version info in @@ -1638,18 +1638,18 @@ /// @li Unsigned integer with length of 4 bytes (@b Value2) /// @li String field with 1 byte size prefix (@b Value3) /// -/// The @b Marshalling library provides nil::marshalling::types::Variant field to allow such +/// The @b Marshalling library provides nil::crypto3::marshalling::types::Variant field to allow such /// heterogeneous fields. Let's implement the described example. /// /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using Value1 = nil::marshalling::types::IntValue; -/// using Value2 = nil::marshalling::types::IntValue; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using Value1 = nil::crypto3::marshalling::types::IntValue; +/// using Value2 = nil::crypto3::marshalling::types::IntValue; /// using Value3 = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, -/// nil::marshalling::option::sequence_size_field_prefix< -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::option::sequence_size_field_prefix< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint8_t /// > @@ -1666,17 +1666,17 @@ /// NumOfValues /// }; /// @endcode -/// And the relevant key fields as a variant of nil::marshalling::types::EnumValue with +/// And the relevant key fields as a variant of nil::crypto3::marshalling::types::EnumValue with /// only single acceptable value. /// @code /// template /// using KeyField = -/// nil::marshalling::types::EnumValue< +/// nil::crypto3::marshalling::types::EnumValue< /// MyFieldBase, /// KeyId, -/// nil::marshalling::option::default_num_value<(int)TId>, -/// nil::marshalling::option::valid_num_value_range<(int)TId, (int)TId>, -/// nil::marshalling::option::fail_on_invalid<> +/// nil::crypto3::marshalling::option::default_num_value<(int)TId>, +/// nil::crypto3::marshalling::option::valid_num_value_range<(int)TId, (int)TId>, +/// nil::crypto3::marshalling::option::fail_on_invalid<> /// >; /// /// using Key1 = KeyField; @@ -1686,30 +1686,30 @@ /// Then the @b KeyX and its corresponding @b ValueX need to be bundled together /// as a single @b PropertyX field. /// @code -/// using Property1 = nil::marshalling::types::Bundle >; -/// using Property2 = nil::marshalling::types::Bundle >; -/// using Property3 = nil::marshalling::types::Bundle >; +/// using Property1 = nil::crypto3::marshalling::types::Bundle >; +/// using Property2 = nil::crypto3::marshalling::types::Bundle >; +/// using Property3 = nil::crypto3::marshalling::types::Bundle >; /// @endcode /// Now we need a single @b field abstraction, which can be any of the specified -/// above forms. The nil::marshalling::types::Variant field class provides such an ability. +/// above forms. The nil::crypto3::marshalling::types::Variant field class provides such an ability. /// As its second parameter it receives a tuple of supported types. /// @code /// using MyVariant = -/// nil::marshalling::types::Variant< +/// nil::crypto3::marshalling::types::Variant< /// MyFieldBase, /// std::tuple /// >; /// @endcode /// Now it is easy to put such field type into the list: /// @code -/// using PropertiesList = nil::marshalling::types::array_list; +/// using PropertiesList = nil::crypto3::marshalling::types::array_list; /// @endcode /// In this scenario, read operation on the list will invoke read operation of /// every @b MyVariant field, which in turn will try to perform read operation /// on @b Property1, @b Property2, and @b Property3 in the order of their /// definition inside the provided tuple. The read operation of the -/// nil::marshalling::types::Variant field type will stop when read operation of any -/// of the contained types reports nil::marshalling::ErrorStatus::success as its status. +/// nil::crypto3::marshalling::types::Variant field type will stop when read operation of any +/// of the contained types reports nil::crypto3::marshalling::ErrorStatus::success as its status. /// /// Accessing the currently held field can be tricky though. There is a need /// to differentiate between @b compile-time and @b run-time knowledge of the @@ -1717,7 +1717,7 @@ /// /// When preparing a variant field to be sent out, usually the inner /// field type and its value are known at compile time. The initialisation of the -/// field can be performed using nil::marshalling::types::Variant::init_field() member +/// field can be performed using nil::crypto3::marshalling::types::Variant::init_field() member /// function: /// @code /// MyVariant var; // Created in "invalid" state @@ -1727,7 +1727,7 @@ /// @endcode /// If the variant field has been initialised before, but there is a need to /// to access the real type (also known at compile time), use -/// nil::marshalling::types::Variant::access_field() member function +/// nil::crypto3::marshalling::types::Variant::access_field() member function /// @code /// void updateProp1(MyVariant& var) /// { @@ -1739,17 +1739,17 @@ /// Just like with @ref sec_field_tutorial_bitfield and @ref sec_field_tutorial_bundle /// it would be convenient to operate with internal type names, rather than hard coded /// indices. In order to provide names for the available inner types, please -/// inherit from proper nil::marshalling::types::Variant field definition and +/// inherit from proper nil::crypto3::marshalling::types::Variant field definition and /// use MARSHALLING_VARIANT_MEMBERS_ACCESS() macro inside. /// @code -/// struct MyVariant : public nil::marshalling::types::Variant<...> +/// struct MyVariant : public nil::crypto3::marshalling::types::Variant<...> /// { /// MARSHALLING_VARIANT_MEMBERS_ACCESS(prop1, prop2, prop3); /// }; /// @endcode /// It would be equivalent to having the following types and functions defined /// @code -/// struct MyVariant : public nil::marshalling::types::Variant<...> +/// struct MyVariant : public nil::crypto3::marshalling::types::Variant<...> /// { /// enum FieldIdx { /// FieldIdx_prop1, @@ -1812,11 +1812,11 @@ /// /// There are cases (such as after "read" operation), when actual type of the /// @b Variant field is known at run-time. The most straightforward way of -/// inquiring the actual type index using nil::marshalling::types::Variant::current_field() +/// inquiring the actual type index using nil::crypto3::marshalling::types::Variant::current_field() /// function and then using a `switch` statement and handle every case accordingly /// may work but is not very efficient. There is a way to perform more efficient /// way of dispatching the actual field to its appropriate handling function by -/// using nil::marshalling::types::Variant::current_field_exec() member function. It expects +/// using nil::crypto3::marshalling::types::Variant::current_field_exec() member function. It expects /// to receive a handling object which can handle all of the available inner types: /// @code /// struct MyVariantHandler @@ -1850,16 +1850,16 @@ /// void operator()(TField& prop) {...} /// } /// @endcode -/// The default constructed nil::marshalling::types::Variant object from the examples above +/// The default constructed nil::crypto3::marshalling::types::Variant object from the examples above /// has an "invalid" state, i.e. hasn't been initialised and doesn't contain any -/// valid field. It can be changed by providing nil::marshalling::option::default_variant_index +/// valid field. It can be changed by providing nil::crypto3::marshalling::option::default_variant_index /// option. /// @code /// struct MyVariant : public -/// nil::marshalling::types::Variant< +/// nil::crypto3::marshalling::types::Variant< /// MyFieldBase, /// std::tuple, -/// nil::marshalling::option::default_variant_index<0> // Initialise as Prop1 +/// nil::crypto3::marshalling::option::default_variant_index<0> // Initialise as Prop1 /// > /// { /// MARSHALLING_VARIANT_MEMBERS_ACCESS(prop1, prop2, prop3); @@ -1884,10 +1884,10 @@ /// @ref MARSHALLING_VARIANT_MEMBERS_ACCESS_NOTEMPLATE(). For example: /// @code /// struct MyVariant : public -/// nil::marshalling::types::Variant< +/// nil::crypto3::marshalling::types::Variant< /// MyFieldBase, /// std::tuple, -/// nil::marshalling::option::default_variant_index<0> // Initialise as Prop1 +/// nil::crypto3::marshalling::option::default_variant_index<0> // Initialise as Prop1 /// > /// { /// MARSHALLING_VARIANT_MEMBERS_ACCESS_NOTEMPLATE(prop1, prop2, prop3); @@ -1899,19 +1899,19 @@ /// @code /// template /// class MyVariant : public -/// nil::marshalling::types::Variant< +/// nil::crypto3::marshalling::types::Variant< /// MyFieldBase, /// std::tuple, -/// nil::marshalling::option::default_variant_index<0>, // Initialise as Prop1 +/// nil::crypto3::marshalling::option::default_variant_index<0>, // Initialise as Prop1 /// TExtraOptions... /// > /// { /// // Duplicate base class definition /// using Base = -/// nil::marshalling::types::Variant< +/// nil::crypto3::marshalling::types::Variant< /// MyFieldBase, /// std::tuple, -/// nil::marshalling::option::default_variant_index<0>, // Initialise as Prop1 +/// nil::crypto3::marshalling::option::default_variant_index<0>, // Initialise as Prop1 /// TExtraOptions... /// >; /// public: @@ -1925,7 +1925,7 @@ /// the defined symbol to add / remove the definition of the @b Base member type. /// @code /// template -/// class MyVariant : public nil::marshalling::types::Variant<...> +/// class MyVariant : public nil::crypto3::marshalling::types::Variant<...> /// { /// #ifdef MARSHALLING_MUST_DEFINE_BASE /// using Base = ...; @@ -1937,9 +1937,9 @@ /// /// @section sec_field_tutorial_common_options Common options_type or Modifications for the fields_type /// There are options that suitable only to numeric fields, such as -/// nil::marshalling::types::IntValue, nil::marshalling::types::EnumValue, nil::marshalling::types::BitmaskValue. @n +/// nil::crypto3::marshalling::types::IntValue, nil::crypto3::marshalling::types::EnumValue, nil::crypto3::marshalling::types::BitmaskValue. @n /// There are options that suitable only for collection fields, such as -/// nil::marshalling::types::array_list, and nil::marshalling::types::String.@n +/// nil::crypto3::marshalling::types::array_list, and nil::crypto3::marshalling::types::String.@n /// There are also @b common options that can be used with all the fields that support /// options. /// @@ -1951,8 +1951,8 @@ /// One of the possible ways is to extend the defined field class and /// set the required value in the constructor. /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// struct MyString : public nil::marshalling::types::String +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// struct MyString : public nil::crypto3::marshalling::types::String /// { /// MyString() /// { @@ -1960,7 +1960,7 @@ /// } /// }; /// @endcode -/// Another way is to use nil::marshalling::option::default_value_initialiser option. +/// Another way is to use nil::crypto3::marshalling::option::default_value_initialiser option. /// It receives a template parameter, which has to be a type of initialisation /// class. It must provide @b operator() which is responsible to assign a custom /// value to the field. It is going to be invoked from the default constructor @@ -1986,11 +1986,11 @@ /// } /// }; /// -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyString = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, -/// nil::marshalling::option::default_value_initialiser +/// nil::crypto3::marshalling::option::default_value_initialiser /// >; /// /// MyString myStr; // Default construction @@ -2001,15 +2001,15 @@ /// defined field's base classes, which is implementation dependent. Just use /// the provided @b value() member function to access the value. /// -/// The Marshalling library also provides a simpler alias for nil::marshalling::option::default_value_initialiser -/// to set default value for numeric fields. It is nil::marshalling::option::default_num_value. +/// The Marshalling library also provides a simpler alias for nil::crypto3::marshalling::option::default_value_initialiser +/// to set default value for numeric fields. It is nil::crypto3::marshalling::option::default_num_value. /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyInt = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, -/// nil::marshalling::option::default_num_value<10> +/// nil::crypto3::marshalling::option::default_num_value<10> /// >; /// /// MyInt myInt; @@ -2030,26 +2030,26 @@ /// One way to implement custom read functionality is to extend the field /// definition and override the @b read() member function: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// struct MyBundle : public -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::BitmaskValue >, -/// nil::marshalling::types::Optional +/// nil::crypto3::marshalling::types::BitmaskValue >, +/// nil::crypto3::marshalling::types::Optional /// >, -/// nil::marshalling::option::has_custom_read +/// nil::crypto3::marshalling::option::has_custom_read /// > /// { /// template -/// nil::marshalling::ErrorStatus read(TIter& iter, std::size_t len) +/// nil::crypto3::marshalling::ErrorStatus read(TIter& iter, std::size_t len) /// { /// auto& members = value(); /// auto& bitmask = std::get<0>(members); /// auto& optInt = std::get<1>(members); /// /// auto es = bitmask.read(iter, len); -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// return es; /// } /// @@ -2064,13 +2064,13 @@ /// } /// }; /// @endcode -/// @b NOTE the usage of @ref nil::marshalling::option::has_custom_read option. It notifies +/// @b NOTE the usage of @ref nil::crypto3::marshalling::option::has_custom_read option. It notifies /// other classes about existence of custom @b read functionality /// (instead of default one). Other classes may contain some inner logic to /// perform various optimisations if there is no custom @b read. /// Failure to specify this option may result in incorrect behaviour. /// -/// Another way is to use nil::marshalling::option::custom_value_reader option. It +/// Another way is to use nil::crypto3::marshalling::option::custom_value_reader option. It /// receives one template parameter, which has to be a type of a custom /// reader class. Such class must implement @b operator() with the following /// signature: @@ -2078,7 +2078,7 @@ /// struct MyReader /// { /// template -/// nil::marshalling::ErrorStatus operator()(TField& field, TIter& iter, std::size_t len) const +/// nil::crypto3::marshalling::ErrorStatus operator()(TField& field, TIter& iter, std::size_t len) const /// { /// ... // Do proper read of the field's value. /// } @@ -2097,8 +2097,8 @@ /// One of the ways to provide custom validation logic is to extend the field /// definition and implement @b valid() member function: /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// struct MyString : public nil::marshalling::types::String +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// struct MyString : public nil::crypto3::marshalling::types::String /// { /// bool valid() const /// { @@ -2108,7 +2108,7 @@ /// }; /// @endcode /// -/// Another way is to use nil::marshalling::option::contents_validator option. It +/// Another way is to use nil::crypto3::marshalling::option::contents_validator option. It /// receives one template parameter, which has to be a type of a custom /// validator class. Such class must implement @b operator() with the following /// signature: @@ -2136,10 +2136,10 @@ /// } /// }; /// -/// using MyFieldBase = nil::marshalling::field_type; -/// using MyString = nil::marshalling::types::String< +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using MyString = nil::crypto3::marshalling::types::String< /// MyFieldBase, -/// nil::marshalling::option::contents_validator +/// nil::crypto3::marshalling::option::contents_validator /// >; /// /// MyString myStr; @@ -2155,11 +2155,11 @@ /// /// Quite often the valid values of the numeric fields can be expressed in limited /// number of ranges: [minValid - maxValid]. The Marshalling library provides -/// @ref nil::marshalling::option::valid_num_value_range option (and @ref nil::marshalling::option::ValidNumValue alias), +/// @ref nil::crypto3::marshalling::option::valid_num_value_range option (and @ref nil::crypto3::marshalling::option::ValidNumValue alias), /// which can be used multiple times. The field's value is considered to be valid if /// at least one of the provided ranges contains it. The range validation option -/// can be used only with numeric value fields, such as nil::marshalling::types::IntValue, -/// or nil::marshalling::types::EnumValue. For example: +/// can be used only with numeric value fields, such as nil::crypto3::marshalling::types::IntValue, +/// or nil::crypto3::marshalling::types::EnumValue. For example: /// @code /// enum SomeEnum : std::uint8_t /// { @@ -2168,13 +2168,13 @@ /// SomeEnum_Value3 /// }; /// -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyEnum = -/// nil::marshalling::types::EnumValue< +/// nil::crypto3::marshalling::types::EnumValue< /// MyFieldBase, /// SomeEnum, -/// nil::marshalling::option::default_num_value, // Construct with valid value -/// nil::marshalling::option::valid_num_value_range +/// nil::crypto3::marshalling::option::default_num_value, // Construct with valid value +/// nil::crypto3::marshalling::option::valid_num_value_range /// >; /// /// MyEnum myEnum; @@ -2189,32 +2189,32 @@ /// range of [0x20 - 0x7e], as well as value 0. Such field can be defined as: /// @code /// using MyChar = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// char, -/// nil::marshalling::option::valid_num_value_range<0x20, 0x7e>, -/// nil::marshalling::option::ValidNumValue<0> +/// nil::crypto3::marshalling::option::valid_num_value_range<0x20, 0x7e>, +/// nil::crypto3::marshalling::option::ValidNumValue<0> /// >; /// @endcode /// @b WARNING: Some older compilers (@b gcc-4.7) fail to compile valid C++11 code -/// that allows usage of multiple @ref nil::marshalling::option::valid_num_value_range options. If this is -/// the case, please don't pass more than one @ref nil::marshalling::option::valid_num_value_range option. +/// that allows usage of multiple @ref nil::crypto3::marshalling::option::valid_num_value_range options. If this is +/// the case, please don't pass more than one @ref nil::crypto3::marshalling::option::valid_num_value_range option. /// -/// There is a also a convenience alias to nil::marshalling::option::contents_validator intended -/// for use with bitmasks (nil::marshalling::types::BitmaskValue). Many bitmask fields +/// There is a also a convenience alias to nil::crypto3::marshalling::option::contents_validator intended +/// for use with bitmasks (nil::crypto3::marshalling::types::BitmaskValue). Many bitmask fields /// may have one or several reserved bits with predefined values they must contain. -/// The alias option is nil::marshalling::option::bitmask_reserved_bits. It receives two +/// The alias option is nil::crypto3::marshalling::option::bitmask_reserved_bits. It receives two /// template parameters: one for the mask indicating the reserved bits and another /// for the expected values of these bits.@n /// For example, below is a definition of the 1 byte bitmask field that has /// two reserved bits, most and least significant. Both of them must be 0. /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyFlags = -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x81, 0> +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x81, 0> /// >; /// /// MyFlags flags; @@ -2227,7 +2227,7 @@ /// Every field provides @b refresh() member function used to bring the field's /// value into a consistent state. By default this function does nothing and /// returns @b false, meaning the field has @b NOT been updated. For complex fields, such -/// as nil::marshalling::types::Bitfield or nil::marshalling::types::Bundle, the default behaviour is +/// as nil::crypto3::marshalling::types::Bitfield or nil::crypto3::marshalling::types::Bundle, the default behaviour is /// to invoke @b refresh() member function of each member field and return @b true /// if @b any of the calls returned true. /// @@ -2242,16 +2242,16 @@ /// There is a need to provide the custom "refresh" logic that brings the field's /// contents into a consistent state. /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// struct MyBundle : public -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::BitmaskValue >, -/// nil::marshalling::types::Optional +/// nil::crypto3::marshalling::types::BitmaskValue >, +/// nil::crypto3::marshalling::types::Optional /// >, -/// nil::marshalling::option::has_custom_read, -/// nil::marshalling::option::has_custom_refresh +/// nil::crypto3::marshalling::option::has_custom_read, +/// nil::crypto3::marshalling::option::has_custom_refresh /// > /// { /// ... @@ -2261,9 +2261,9 @@ /// auto& members = value(); /// auto& bitmask = std::get<0>(members); /// auto& optInt = std::get<1>(members); -/// auto expectedMode = nil::marshalling::types::OptionalMode::missing; +/// auto expectedMode = nil::crypto3::marshalling::types::OptionalMode::missing; /// if (bitmask.get_bit_value(0)) { -/// expectedMode = nil::marshalling::types::OptionalMode::exists; +/// expectedMode = nil::crypto3::marshalling::types::OptionalMode::exists; /// } /// /// if (optInt.get_mode() == expectedMode) { @@ -2275,13 +2275,13 @@ /// } /// }; /// @endcode -/// @b NOTE the usage of @ref nil::marshalling::option::has_custom_refresh option. It notifies +/// @b NOTE the usage of @ref nil::crypto3::marshalling::option::has_custom_refresh option. It notifies /// other classes about existence of custom @b refresh functionality /// (instead of default one). Other classes may contain some inner logic to /// perform various optimisations if there is no custom @b refresh. /// Failure to specify this option may result in incorrect behaviour. /// -/// Another way is to use nil::marshalling::option::contents_refresher option. It +/// Another way is to use nil::crypto3::marshalling::option::contents_refresher option. It /// receives one template parameter, which has to be a type of a custom /// refresher class. Such class must implement @b operator() with the following /// signature: @@ -2312,9 +2312,9 @@ /// For most fields @b set_version() function does nothing and /// returns @b false, meaning the field has @b NOT been updated (similar to /// @ref sec_field_tutorial_common_options_refresh). For complex fields, such -/// as nil::marshalling::types::Bitfield or nil::marshalling::types::Bundle, the default behaviour is +/// as nil::crypto3::marshalling::types::Bitfield or nil::crypto3::marshalling::types::Bundle, the default behaviour is /// to invoke @b set_version() member function of each member field and return @b true -/// if @b any of the calls returned @b true. For @ref nil::marshalling::types::array_list +/// if @b any of the calls returned @b true. For @ref nil::crypto3::marshalling::types::array_list /// fields, the version information may be stored inside (only if the element's /// @b is_version_dependent() member function returns @b true) and used to notify /// every new field that is being read during @b read operation. @@ -2327,13 +2327,13 @@ /// version @b 6 the range is extended to [0, 10]. It can be defined as following: /// @code /// class MyInt : public -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint8_t, -/// nil::marshalling::option::valid_num_value_range<0, 5>, -/// nil::marshalling::option::has_custom_version_update +/// nil::crypto3::marshalling::option::valid_num_value_range<0, 5>, +/// nil::crypto3::marshalling::option::has_custom_version_update /// { -/// using Base = nil::marshalling::types::IntValue<...>; // Repeat base class definition +/// using Base = nil::crypto3::marshalling::types::IntValue<...>; // Repeat base class definition /// public: /// // Updated validity check /// bool valid() const @@ -2361,19 +2361,19 @@ /// version_type m_version = 0; /// }; /// @endcode -/// @b NOTE, the usage of @ref nil::marshalling::option::has_custom_version_update option. It +/// @b NOTE, the usage of @ref nil::crypto3::marshalling::option::has_custom_version_update option. It /// marks the defined field as "version dependent" and as the result its @b /// is_version_dependent() member function will return @b true. /// /// Also @b NOTE, that by default the @b version_type inner type is defined to /// be @b unsigned. If there is a need to change that, the @ref -/// nil::marshalling::option::version_type needs to be passed to the definition of the +/// nil::crypto3::marshalling::option::version_type needs to be passed to the definition of the /// common base class of all the fields: /// @code /// using MyFieldBase = -/// nil::marshalling::field_type< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::version_type +/// nil::crypto3::marshalling::field_type< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::version_type /// >; /// @endcode /// @@ -2382,16 +2382,16 @@ /// invalid values, such as the message must be dropped when some field has /// an invalid value. It is easy to implement by forcing @b read() operation on /// such field to fail when reading an invalid value is recognised. The Marshalling -/// library provides nil::marshalling::option::fail_on_invalid option to help with such task. +/// library provides nil::crypto3::marshalling::option::fail_on_invalid option to help with such task. /// For example: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint8_t, -/// nil::marshalling::option::valid_num_value_range<0, 5>, -/// nil::marshalling::option::fail_on_invalid +/// nil::crypto3::marshalling::option::valid_num_value_range<0, 5>, +/// nil::crypto3::marshalling::option::fail_on_invalid /// >; /// /// static const std::uint8_t InvalidBuf[] = { 0x6 }; @@ -2400,29 +2400,29 @@ /// MyField myField; /// auto* readIter = &InvalidBuf[0]; /// auto es = myField.read(readIter, InvalidBufSize); -/// assert(es != nil::marshalling::ErrorStatus::success); // Read failure is expected +/// assert(es != nil::crypto3::marshalling::ErrorStatus::success); // Read failure is expected /// /// static const std::uint8_t ValidBuf[] = { 0x1 }; /// static const auto ValidBufSize = std::extent::value; /// /// readIter = &ValidBuf[0]; /// es = myField.read(readIter, ValidBufSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // Read operation is expected to be successful now +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // Read operation is expected to be successful now /// @endcode /// /// @subsection sec_field_tutorial_common_options_ignore_invalid Ignore Invalid value -/// The Marshalling library also provides nil::marshalling::option::ignore_invalid option. It DOESN'T +/// The Marshalling library also provides nil::crypto3::marshalling::option::ignore_invalid option. It DOESN'T /// report failure on read operation when the invalid value is discovered -/// (like nil::marshalling::option::fail_on_invalid does). Instead the field's internal value +/// (like nil::crypto3::marshalling::option::fail_on_invalid does). Instead the field's internal value /// remains unchanged, although the read iterator is advanced as if the value /// is read. For example: /// @code -/// using MyFieldBase = nil::marshalling::field_type; -/// using MyField = nil::marshalling::types::IntValue< +/// using MyFieldBase = nil::crypto3::marshalling::field_type; +/// using MyField = nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint8_t, -/// nil::marshalling::option::valid_num_value_range<0, 5>, -/// nil::marshalling::option::ignore_invalid +/// nil::crypto3::marshalling::option::valid_num_value_range<0, 5>, +/// nil::crypto3::marshalling::option::ignore_invalid /// >; /// /// static const std::uint8_t InvalidBuf[] = { 0x6 }; @@ -2434,7 +2434,7 @@ /// /// auto* readIter = &InvalidBuf[0]; /// auto es = myField.read(readIter, InvalidBufSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No failure is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No failure is expected /// assert(myField.value() == 0U); // value mustn't be changed /// /// static const std::uint8_t ValidBuf[] = { 0x1 }; @@ -2442,23 +2442,23 @@ /// /// readIter = &ValidBuf[0]; /// es = myField.read(readIter, ValidBufSize); -/// assert(es == nil::marshalling::ErrorStatus::success); // No failure is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No failure is expected /// assert(myField.value() == 1U); // value is expected to be updated /// @endcode /// /// @subsection sec_field_tutorial_common_options_empty_ser Empty Serialisation /// Some protocols may define some constants which are NOT being sent over I/O /// link. Sometimes it may be useful to still treat these values as message fields. -/// Usage of @ref nil::marshalling::option::empty_serialization (or @ref -/// nil::marshalling::option::EmptySerialisation for those who prefer British spelling) can +/// Usage of @ref nil::crypto3::marshalling::option::empty_serialization (or @ref +/// nil::crypto3::marshalling::option::EmptySerialisation for those who prefer British spelling) can /// be used to achieve such effect. /// @code -/// using MyField = nil::marshalling::types::IntValue< +/// using MyField = nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint8_t, -/// nil::marshalling::option::valid_num_value_range<5, 5>, -/// nil::marshalling::option::default_num_value<5>, -/// nil::marshalling::option::empty_serialization +/// nil::crypto3::marshalling::option::valid_num_value_range<5, 5>, +/// nil::crypto3::marshalling::option::default_num_value<5>, +/// nil::crypto3::marshalling::option::empty_serialization /// >; /// /// MyField field; @@ -2468,7 +2468,7 @@ /// std::vector outBuf; /// auto writeIter = std::back_inserter(outBuf); /// auto es == field.write(writeIter, outBuf.max_size()); -/// assert(es == nil::marshalling::ErrorStatus::success); // No failure is expected +/// assert(es == nil::crypto3::marshalling::ErrorStatus::success); // No failure is expected /// assert(outBuf.empty()); // No data has been written /// @endcode /// @@ -2483,24 +2483,24 @@ /// @code /// template /// using MyField = -/// nil::marshalling::types::IntValue< -/// nil::marshalling::field_type, // base class of the field +/// nil::crypto3::marshalling::types::IntValue< +/// nil::crypto3::marshalling::field_type, // base class of the field /// std::uint16_t, /// TExtraOpts..., -/// nil::marshalling::option::default_num_value<5>, -/// nil::marshalling::option::valid_num_value_range<5, 1000> +/// nil::crypto3::marshalling::option::default_num_value<5>, +/// nil::crypto3::marshalling::option::valid_num_value_range<5, 1000> /// @endcode /// Please @b note, that current implementation gives preference to the options /// defined @b earlier. That's why @b TExtraOpts... should be listed before any /// other options. It will allow setting other default value needed by the application, -/// and/or override the valid values ranges (using @ref nil::marshalling::option::valid_ranges_clear). +/// and/or override the valid values ranges (using @ref nil::crypto3::marshalling::option::valid_ranges_clear). /// For example: /// @code /// using MyUpdatedField = /// MyField< -/// nil::marshalling::option::default_num_value<10>, -/// nil::marshalling::option::valid_num_value_range<10, 500>, -/// nil::marshalling::option::valid_ranges_clear +/// nil::crypto3::marshalling::option::default_num_value<10>, +/// nil::crypto3::marshalling::option::valid_num_value_range<10, 500>, +/// nil::crypto3::marshalling::option::valid_ranges_clear /// > /// @endcode /// @@ -2533,26 +2533,26 @@ /// /// // Read field value from input data sequence, using any type of input iterator /// template -/// nil::marshalling::ErrorStatus read(TIter& iter, std::size_t size); +/// nil::crypto3::marshalling::ErrorStatus read(TIter& iter, std::size_t size); /// /// // Write field value to output data sequence, using any type of output iterator /// template -/// nil::marshalling::ErrorStatus write(TIter& iter, std::size_t size) const; +/// nil::crypto3::marshalling::ErrorStatus write(TIter& iter, std::size_t size) const; /// }; /// @endcode -/// The nil::marshalling::field_type class provides @b read_data() and @b write_data() protected +/// The nil::crypto3::marshalling::field_type class provides @b read_data() and @b write_data() protected /// member functions that serialise data using endian provided as an option -/// to the class. It makes sense to inherit from nil::marshalling::field_type with right +/// to the class. It makes sense to inherit from nil::crypto3::marshalling::field_type with right /// option and reuse these functions inside: /// @code -/// class MyField : public nil::marshalling::field_type +/// class MyField : public nil::crypto3::marshalling::field_type /// { /// public: /// /// ... /// /// template -/// nil::marshalling::ErrorStatus read(TIter& iter, std::size_t size) +/// nil::crypto3::marshalling::ErrorStatus read(TIter& iter, std::size_t size) /// { /// ... /// auto val = read_data(iter); @@ -2560,7 +2560,7 @@ /// } /// /// template -/// nil::marshalling::ErrorStatus write(TIter& iter, std::size_t size) const +/// nil::crypto3::marshalling::ErrorStatus write(TIter& iter, std::size_t size) const /// { /// ... /// write_data(..., iter); @@ -2572,7 +2572,7 @@ /// in the Marshalling library it is recommended to provide an accessor functions /// @b value() for internal data storage: /// @code -/// class MyField : public nil::marshalling::field_type +/// class MyField : public nil::crypto3::marshalling::field_type /// { /// public: /// using value_type = ...; diff --git a/crypto3/libs/marshalling/core/docs/page_prot_stack.dox b/crypto3/libs/marshalling/core/docs/page_prot_stack.dox index 198db59649..66a62ad2f5 100644 --- a/crypto3/libs/marshalling/core/docs/page_prot_stack.dox +++ b/crypto3/libs/marshalling/core/docs/page_prot_stack.dox @@ -53,34 +53,34 @@ /// /// The Marshalling library provides multiple classes to define various layers when /// assembling the full protocol stack of layers. All these classes reside in -/// nil::marshalling::protocol namespace. +/// nil::crypto3::marshalling::protocol namespace. /// The following sections will cover all the layer classes required to /// assemble the protocol stack described above. /// /// @section page_prot_stack_tutorial_payload PAYLOAD Layer /// The top layer, that is responsible to read/write the payload of the message -/// is called @b PAYLOAD. It is implemented by nil::marshalling::protocol::MsgDataLayer +/// is called @b PAYLOAD. It is implemented by nil::crypto3::marshalling::protocol::MsgDataLayer /// class in the Marshalling library. /// @code -/// using MyMsgData = nil::marshalling::protocol::msg_data_layer<>; +/// using MyMsgData = nil::crypto3::marshalling::protocol::msg_data_layer<>; /// @endcode -/// @b NOTE, that @ref nil::marshalling::protocol::MsgDataLayer receives a template parameter. +/// @b NOTE, that @ref nil::crypto3::marshalling::protocol::MsgDataLayer receives a template parameter. /// In the normal operation, when transport frame fields are not stored anywhere, /// it is never used. However, there is way to perform @b read operation while -/// caching transport fields (by using @ref nil::marshalling::protocol::MsgDataLayer::read_fields_cached()) -/// The payload field is defined to be @ref nil::marshalling::types::array_list of raw data -/// (see @ref nil::marshalling::protocol::MsgDataLayer::field_type). It would be wise to provide +/// caching transport fields (by using @ref nil::crypto3::marshalling::protocol::MsgDataLayer::read_fields_cached()) +/// The payload field is defined to be @ref nil::crypto3::marshalling::types::array_list of raw data +/// (see @ref nil::crypto3::marshalling::protocol::MsgDataLayer::field_type). It would be wise to provide /// a way to supply extra options to choose storage type for this field, /// when defining protocol stack. As the result the definition becomes: /// @code -/// template -/// using MyMsgData = nil::marshalling::protocol::MsgDataLayer; +/// template +/// using MyMsgData = nil::crypto3::marshalling::protocol::MsgDataLayer; /// @endcode /// /// @section page_prot_stack_tutorial_id ID Layer /// The @b ID layer is responsible to process the ID of the message /// and based on this ID, create proper message object. The Marshalling library implements -/// this functionality in nil::marshalling::protocol::MsgIdLayer class. It receives +/// this functionality in nil::crypto3::marshalling::protocol::MsgIdLayer class. It receives /// at least four template parameters. The first one is a type of the /// field that can be used to read/write the ID information. The @ref /// page_define_prot_interface section described @b my_protocol::msg_id enum @@ -92,10 +92,10 @@ /// /// enum msg_id : std::uint8_t {...} // enum described earlier /// -/// using MyFieldBase = nil::marshalling::field_type; // Use big endian for all fields serialization +/// using MyFieldBase = nil::crypto3::marshalling::field_type; // Use big endian for all fields serialization /// /// using MsgIdField = -/// nil::marshalling::types::EnumValue< +/// nil::crypto3::marshalling::types::EnumValue< /// MyFieldBase, /// msg_id // enum type /// >; @@ -132,10 +132,10 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyMsgId = -/// nil::marshalling::protocol::MsgIdLayer< +/// nil::crypto3::marshalling::protocol::MsgIdLayer< /// MsgIdField, /// TMessage, /// TInputMessages, @@ -152,30 +152,30 @@ /// try to read all the messages with the found ID one by one in /// order of their definition until success is reported. /// -/// The nil::marshalling::protocol::MsgIdLayer defines @b msg_ptr_type -/// (see nil::marshalling::protocol::MsgIdLayer::msg_ptr_type) internal type, which is +/// The nil::crypto3::marshalling::protocol::MsgIdLayer defines @b msg_ptr_type +/// (see nil::crypto3::marshalling::protocol::MsgIdLayer::msg_ptr_type) internal type, which is /// smart pointer (@b std::unique_ptr) to the input message interface /// class (@b TMessage) provided as second template parameter. /// -/// During the normal @b read operation, the nil::marshalling::protocol::MsgIdLayer will +/// During the normal @b read operation, the nil::crypto3::marshalling::protocol::MsgIdLayer will /// dynamically allocate the proper message object. /// -/// The nil::marshalling::protocol::MsgIdLayer can also be used in bare metal systems, +/// The nil::crypto3::marshalling::protocol::MsgIdLayer can also be used in bare metal systems, /// that do NOT use dynamic memory allocation. In order to prevent this layer -/// from using dynamic memory allocation, the nil::marshalling::option::in_place_allocation +/// from using dynamic memory allocation, the nil::crypto3::marshalling::option::in_place_allocation /// option needs to be passed as fifth template parameter to the -/// nil::marshalling::protocol::MsgIdLayer class. However, an ability to use this option +/// nil::crypto3::marshalling::protocol::MsgIdLayer class. However, an ability to use this option /// needs to be provided to the application itself only if needed. In order to /// achive that additional template parameter needs to be used. /// @code /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyMsgId = -/// nil::marshalling::protocol::MsgIdLayer< +/// nil::crypto3::marshalling::protocol::MsgIdLayer< /// MsgIdField, /// TMessage, /// TInputMessages, @@ -183,54 +183,54 @@ /// TAllocationOptions /// >; /// @endcode -/// In this case, the nil::marshalling::protocol::MsgIdLayer will statically allocate +/// In this case, the nil::crypto3::marshalling::protocol::MsgIdLayer will statically allocate /// internal buffer in its private data members, big enough to hold any message object /// of any type listed in @b all_messages_type bundle. It means that only one message /// object can be allocated and used at a time, i.e. the previous object must /// be deleted prior to new one being allocated. @n -/// Also, the nil::marshalling::protocol::MsgIdLayer::msg_ptr_type will still be a variant of +/// Also, the nil::crypto3::marshalling::protocol::MsgIdLayer::msg_ptr_type will still be a variant of /// @b std::unique_ptr, but with custom deleter (defined by Marshalling library itself), /// which will make sure the proper destruction of the message object and /// release of the internal buffer for next allocation. In case new allocation /// is attempted when internal buffer is NOT released, the new message will NOT be allocated -/// and read operation will fail with @ref nil::marshalling::ErrorStatus::msg_alloc_failure +/// and read operation will fail with @ref nil::crypto3::marshalling::ErrorStatus::msg_alloc_failure /// error. /// /// By default, if the received data contains unknown message ID (the message /// type is not in @b all_messages_type bundle), the @b read operation returns -/// @ref nil::marshalling::ErrorStatus::invalid_msg_id and no message object is allocated. +/// @ref nil::crypto3::marshalling::ErrorStatus::invalid_msg_id and no message object is allocated. /// However, there are @b bridge / @b gateway / @b firewall type of applications /// which are interested to decode only limited number of messages, but still /// forward the received data (sometimes changing the transport wrapping) /// without actually decoding the contents. In this case the default behaviour -/// cannot be used. The @b Marshalling library provides @ref nil::marshalling::generic_message +/// cannot be used. The @b Marshalling library provides @ref nil::crypto3::marshalling::generic_message /// message definition which has a single variable length data field -/// (defined using @ref nil::marshalling::types::array_list class). The @ref -/// nil::marshalling::protocol::MsgIdLayer may also receive @ref nil::marshalling::option::support_generic_message +/// (defined using @ref nil::crypto3::marshalling::types::array_list class). The @ref +/// nil::crypto3::marshalling::protocol::MsgIdLayer may also receive @ref nil::crypto3::marshalling::option::support_generic_message /// option specifying type of the generic_message. /// In this case, if the appropriate message type hasn't been found in -/// @b all_messages_type bundle, the appropriate @ref nil::marshalling::generic_message object +/// @b all_messages_type bundle, the appropriate @ref nil::crypto3::marshalling::generic_message object /// will be created instead. However, just like with -/// @ref nil::marshalling::option::in_place_allocation, this option should be used by the application +/// @ref nil::crypto3::marshalling::option::in_place_allocation, this option should be used by the application /// if needed. /// -/// Note, that nil::marshalling::option::support_generic_message and nil::marshalling::option::in_place_allocation -/// options can be used together. In this case the @ref nil::marshalling::generic_message +/// Note, that nil::crypto3::marshalling::option::support_generic_message and nil::crypto3::marshalling::option::in_place_allocation +/// options can be used together. In this case the @ref nil::crypto3::marshalling::generic_message /// message object will be allocated in the same allocation area. The client /// application will be able to combine these option together in single tuple /// and use pass as @b TAllocationOptions parameter. /// @code /// using MyAllocOptions = /// std::tuple< -/// nil::marshalling::option::support_generic_message >, -/// nil::marshalling::option::in_place_allocation +/// nil::crypto3::marshalling::option::support_generic_message >, +/// nil::crypto3::marshalling::option::in_place_allocation /// >; /// @endcode -/// When constructed, the nil::marshalling::protocol::MsgIdLayer creates an array of +/// When constructed, the nil::crypto3::marshalling::protocol::MsgIdLayer creates an array of /// statically allocated factory methods, which are responsible to allocate /// right message objects. This array is used as a map of message ID to the /// factory method. The Marshalling library contains inner logic that analyses a tuple of all @b input message -/// types provided to @ref nil::marshalling::protocol::MsgIdLayer. If the IDs of the messages +/// types provided to @ref nil::crypto3::marshalling::protocol::MsgIdLayer. If the IDs of the messages /// are sequential ones starting from a low number such as 0 or 1, and the highest /// ID value do not significantly exceed the total number of message types in the tuple, /// then the one-to-one mapping is generated, i.e. to access the right factory @@ -239,85 +239,85 @@ /// is executed to get appropriate factory method having the numeric message ID /// value (O(log(n))). /// -/// @b NOTE, that nil::marshalling::protocol::MsgIdLayer doesn't use any dynamic memory +/// @b NOTE, that nil::crypto3::marshalling::protocol::MsgIdLayer doesn't use any dynamic memory /// allocation to store internal factory methods, that create proper message /// object given the ID of the message, which makes it possible and safe to /// use in bare-metal environment without any HEAP. /// -/// It may happen that @b nil::marshalling::protocol::MsgIdLayer class as-is is not really +/// It may happen that @b nil::crypto3::marshalling::protocol::MsgIdLayer class as-is is not really /// suitable for implementing message identification and creation of message /// object when implementing custom protocol. /// It is possible to implement a new custom layer (see @ref /// page_prot_stack_tutorial_new_layers section below) with the required /// functionality. However, it is recommended -/// to use @ref nil::marshalling::MsgFactory object internally. It will help in creation the proper +/// to use @ref nil::crypto3::marshalling::MsgFactory object internally. It will help in creation the proper /// message object once the ID value is known. /// /// @section page_prot_stack_tutorial_size SIZE Layer /// The @b SIZE layer is responsible to process information on the remaining /// message length, and forward the @b read/write operations to the upper layer /// in case it is safe to do so. The Marshalling library provides -/// @ref nil::marshalling::protocol::MsgSizeLayer class for that purpose. +/// @ref nil::crypto3::marshalling::protocol::MsgSizeLayer class for that purpose. /// @code /// namespace my_protocol /// { /// /// using RemSizeField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, -/// nil::marshalling::option::num_value_ser_offset +/// nil::crypto3::marshalling::option::num_value_ser_offset /// >; /// /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyMsgSize = -/// nil::marshalling::protocol::MsgSizeLayer< +/// nil::crypto3::marshalling::protocol::MsgSizeLayer< /// RemSizeField, /// MyMsgId /// >; /// /// } // namespace my_protocol /// @endcode -/// The @ref nil::marshalling::protocol::MsgSizeLayer receives two template parameters. The first +/// The @ref nil::crypto3::marshalling::protocol::MsgSizeLayer receives two template parameters. The first /// one is the definition of the @b field (see @ref page_field_tutorial for detail) /// that is responsible to read/write the remaining length information. The /// second template parameter is an upper layer that is being wrapped. @n -/// Please note the usage of @b nil::marshalling::option::num_value_ser_offset option when +/// Please note the usage of @b nil::crypto3::marshalling::option::num_value_ser_offset option when /// defining the @b field type. If it is NOT used, the serialized length value /// will cover only @b ID and @b PAYLOAD (layers it wraps). However, according to the protocol /// specification, the @b SIZE value must also include @b CHECKSUM. Usage of -/// nil::marshalling::option::num_value_ser_offset will add 2 +/// nil::crypto3::marshalling::option::num_value_ser_offset will add 2 /// (@b sizeof(std::uint16_t)) when serialising the length of wrapped fields. /// See also @ref sec_field_tutorial_int_value_ser_offset for more detail. /// /// @section page_prot_stack_tutorial_checksum CHECKSUM Layer /// The @b CHECKSUM layer is responsible to calculate and verify the checksum /// on the data read and/or written by the upper layers it wraps. -/// The Marshalling library provides nil::marshalling::protocol::ChecksumLayer and -/// nil::marshalling::protocol::ChecksumPrefixLayer for this purpose. They are very similar. -/// The only difference is that nil::marshalling::protocol::ChecksumLayer appends the -/// checksum value, while nil::marshalling::protocol::ChecksumPrefixLayer prepends it. +/// The Marshalling library provides nil::crypto3::marshalling::protocol::ChecksumLayer and +/// nil::crypto3::marshalling::protocol::ChecksumPrefixLayer for this purpose. They are very similar. +/// The only difference is that nil::crypto3::marshalling::protocol::ChecksumLayer appends the +/// checksum value, while nil::crypto3::marshalling::protocol::ChecksumPrefixLayer prepends it. /// @code /// namespace my_protocol /// { /// -/// using ChecksumField = nil::marshalling::types::IntValue; +/// using ChecksumField = nil::crypto3::marshalling::types::IntValue; /// /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyChecksum = -/// nil::marshalling::protocol::ChecksumLayer< +/// nil::crypto3::marshalling::protocol::ChecksumLayer< /// ChecksumField, -/// nil::marshalling::protocol::checksum::crc_ccitt +/// nil::crypto3::marshalling::protocol::checksum::crc_ccitt /// MyMsgSize /// >; /// @@ -328,21 +328,21 @@ /// /// The second template parameter is a checksum calculator class which is used /// to calculate a checksum value. Please refer to the documentation of -/// @ref nil::marshalling::protocol::ChecksumLayer or @ref nil::marshalling::protocol::ChecksumPrefixLayer class +/// @ref nil::crypto3::marshalling::protocol::ChecksumLayer or @ref nil::crypto3::marshalling::protocol::ChecksumPrefixLayer class /// for the detail on the interface this /// checksum calculator class must provide. The example above uses -/// @ref nil::marshalling::protocol::checksum::crc_ccitt, which calculates the the standard +/// @ref nil::crypto3::marshalling::protocol::checksum::crc_ccitt, which calculates the the standard /// CRC-CCITT value. All the checksum calculators the Marshalling library provides reside -/// in nil::marshalling::protocol::checksum namespace. +/// in nil::crypto3::marshalling::protocol::checksum namespace. /// /// The third template parameter is an upper layer that is being wrapped. /// -/// By default both @ref nil::marshalling::protocol::ChecksumLayer and -/// @ref nil::marshalling::protocol::ChecksumPrefixLayer allow inner (upper) layers to +/// By default both @ref nil::crypto3::marshalling::protocol::ChecksumLayer and +/// @ref nil::crypto3::marshalling::protocol::ChecksumPrefixLayer allow inner (upper) layers to /// complete their read operation before calculating and verifying checksum on /// read data. However, there may be protocols that may allow checksum verification /// before attempting to read message contents. In this case -/// @ref nil::marshalling::option::checksum_layer_verify_before_read option may be used as +/// @ref nil::crypto3::marshalling::option::checksum_layer_verify_before_read option may be used as /// fourth template parameter. /// @code /// namespace my_protocol @@ -350,15 +350,15 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyChecksum = -/// nil::marshalling::protocol::ChecksumLayer< +/// nil::crypto3::marshalling::protocol::ChecksumLayer< /// ChecksumField, -/// nil::marshalling::protocol::checksum::crc_ccitt +/// nil::crypto3::marshalling::protocol::checksum::crc_ccitt /// MyMsgSize, -/// nil::marshalling::option::checksum_layer_verify_before_read +/// nil::crypto3::marshalling::option::checksum_layer_verify_before_read /// >; /// /// @endcode @@ -366,38 +366,38 @@ /// @section page_prot_stack_tutorial_sync SYNC Layer /// The @b SYNC layer is responsible to recognise the synchronisation byte(s) /// in the input stream as well as write appropriate value when the write -/// operation takes place. The Marshalling library provides @ref nil::marshalling::protocol::SyncPrefixLayer +/// operation takes place. The Marshalling library provides @ref nil::crypto3::marshalling::protocol::SyncPrefixLayer /// class that helps with this task. /// @code /// namespace my_protocol /// { /// /// using SyncField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, -/// nil::marshalling::option::default_num_value<0xabcd>, -/// nil::marshalling::option::ValidNumValue<0xabcd>, -/// nil::marshalling::option::fail_on_invalid // fail read operation if read value is invalid +/// nil::crypto3::marshalling::option::default_num_value<0xabcd>, +/// nil::crypto3::marshalling::option::ValidNumValue<0xabcd>, +/// nil::crypto3::marshalling::option::fail_on_invalid // fail read operation if read value is invalid /// >; /// /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MySyncPrefix = -/// nil::marshalling::protocol::SyncPrefixLayer< +/// nil::crypto3::marshalling::protocol::SyncPrefixLayer< /// SyncField, /// MyChecksum /// >; /// /// } // namespace my_protocol /// @endcode -/// The nil::marshalling::protocol::SyncPrefixLayer class receives two template parameters. +/// The nil::crypto3::marshalling::protocol::SyncPrefixLayer class receives two template parameters. /// The first one is the type of the @b field, that is responsible to read/write -/// the synchronisation byte(s). Please note the usage of nil::marshalling::option::default_num_value +/// the synchronisation byte(s). Please note the usage of nil::crypto3::marshalling::option::default_num_value /// option when defining the @b field type. It insures that the default constructed /// field will have the required value. @n /// The second template parameter is the upper layer being wrapped. @@ -414,39 +414,39 @@ /// object may have some extra fields, which were introduced in later version of /// the protocol, and it needs to take into account the provided @b VERSION info. /// -/// The Marshalling library provides @ref nil::marshalling::protocol::TransportValueLayer to handle +/// The Marshalling library provides @ref nil::crypto3::marshalling::protocol::TransportValueLayer to handle /// such fields. @b HOWEVER it requires extra support from common message interface class. -/// The latter must use @ref nil::marshalling::option::extra_transport_fields option in order +/// The latter must use @ref nil::crypto3::marshalling::option::extra_transport_fields option in order /// to define expected interface (please refer to @ref page_define_prot_interface_extra_transport /// for detail). /// -/// The @ref nil::marshalling::protocol::TransportValueLayer class receives three +/// The @ref nil::crypto3::marshalling::protocol::TransportValueLayer class receives three /// template parameters. The first one is the field used to read / write the /// value. The second parameter is index of the relevant extra transport field -/// in the @ref nil::marshalling::Message::transport_fields_type tuple. And the third parameter +/// in the @ref nil::crypto3::marshalling::Message::transport_fields_type tuple. And the third parameter /// is the next layer. /// /// The whole protocol stack definition may look like this: /// @code /// // Base class of all the fields -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// /// // field_type describing protocol version. -/// using MyVersionField = nil::marshalling::types::IntValue; +/// using MyVersionField = nil::crypto3::marshalling::types::IntValue; /// /// // Payload control layer /// template < -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > -/// using MyMsgData = nil::marshalling::protocol::MsgDataLayer; +/// using MyMsgData = nil::crypto3::marshalling::protocol::MsgDataLayer; /// /// // Version control layer /// template < /// typename TMessage, // common interface class defined by the application -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyVersion = -/// nil::marshalling::protocol::TransportValueLayer< +/// nil::crypto3::marshalling::protocol::TransportValueLayer< /// MyVersionField, /// TMessage::TransportFieldIdx_version, /// MyMsgData @@ -456,11 +456,11 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyMsgId = -/// nil::marshalling::protocol::MsgIdLayer< +/// nil::crypto3::marshalling::protocol::MsgIdLayer< /// MsgIdField, /// TMessage, /// TInputMessages, @@ -472,11 +472,11 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyMsgSize = -/// nil::marshalling::protocol::MsgSizeLayer< +/// nil::crypto3::marshalling::protocol::MsgSizeLayer< /// RemSizeField, /// MyMsgId /// >; @@ -494,11 +494,11 @@ /// update created message object (if necessary) before /// the read operation is forwarded to the final (PAYLOAD) layer. /// -/// Unfortunatelly there are layers (@ref nil::marshalling::protocol::ChecksumLayer, -/// @ref nil::marshalling::protocol::ChecksumPrefixLayer, and @ref nil::marshalling::protocol::MsgSizeLayer), +/// Unfortunatelly there are layers (@ref nil::crypto3::marshalling::protocol::ChecksumLayer, +/// @ref nil::crypto3::marshalling::protocol::ChecksumPrefixLayer, and @ref nil::crypto3::marshalling::protocol::MsgSizeLayer), /// that cannot complete their read operation, without read of the PAYLOAD data /// being complete as well. As the result these layers do not support being wrapped by -/// @ref nil::marshalling::protocol::TransportValueLayer and will fail compilation with +/// @ref nil::crypto3::marshalling::protocol::TransportValueLayer and will fail compilation with /// static assert if such wrapping is attempted. /// /// @section page_prot_stack_tutorial_pseudo_transport_value Pseudo Transport Values @@ -506,26 +506,26 @@ /// one of the messages used to establish connection. After that, the reported /// value may have influence on how other message contents are being read. Handling /// such case is very similar to @ref page_prot_stack_tutorial_transport_value. -/// The only difference is passing @ref nil::marshalling::option::pseudo_value option to -/// @ref nil::marshalling::protocol::TransportValueLayer layer class. It will cause the +/// The only difference is passing @ref nil::crypto3::marshalling::option::pseudo_value option to +/// @ref nil::crypto3::marshalling::protocol::TransportValueLayer layer class. It will cause the /// transport value not actually being (de)serialized during @b read / @b write /// operations. The pseudo field value is going to be stored as private member -/// of @ref nil::marshalling::protocol::TransportValueLayer and can be accessed (and updated) using -/// @ref nil::marshalling::protocol::TransportValueLayer::pseudo_field() member function(s). -/// During the @b read operation the nil::marshalling::protocol::TransportValueLayer behaves +/// of @ref nil::crypto3::marshalling::protocol::TransportValueLayer and can be accessed (and updated) using +/// @ref nil::crypto3::marshalling::protocol::TransportValueLayer::pseudo_field() member function(s). +/// During the @b read operation the nil::crypto3::marshalling::protocol::TransportValueLayer behaves /// as if the value stored in this field was actually read. /// @code /// // Version control layer /// template < /// typename TMessage, // common interface class defined by the application -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using MyVersion = -/// nil::marshalling::protocol::TransportValueLayer< +/// nil::crypto3::marshalling::protocol::TransportValueLayer< /// MyVersionField, /// TMessage::TransportFieldIdx_version, /// MyMsgData, -/// nil::marshalling::option::pseudo_value +/// nil::crypto3::marshalling::option::pseudo_value /// >; /// @endcode /// @@ -540,22 +540,22 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// using ProtocolStack = MySyncPrefix ; /// @endcode /// Every protocol layer provides an ability to access the next one using /// @b next_layer() member function -/// (see @ref nil::marshalling::protocol::ProtocolLayerBase::next_layer()). It is strongly +/// (see @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::next_layer()). It is strongly /// recommended to generate convenience access functions using /// @ref MARSHALLING_PROTOCOL_LAYERS_ACCESS() macro. /// @code /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// struct ProtocolStack : public /// MySyncPrefix @@ -568,8 +568,8 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// struct ProtocolStack : public /// MySyncPrefix @@ -622,8 +622,8 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// class ProtocolStack : public /// MySyncPrefix @@ -642,8 +642,8 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// class ProtocolStack : public /// MySyncPrefix @@ -661,13 +661,13 @@ /// provide all the necessary layer classes required to implement custom logic /// of the protocol. The Marshalling library allows implementation and usage of /// custom layers as long as it defines the required types and implements required -/// functions. It is strongly recommended to inherit from nil::marshalling::protocol::ProtocolLayerBase +/// functions. It is strongly recommended to inherit from nil::crypto3::marshalling::protocol::ProtocolLayerBase /// and implement missing functionality /// @code /// // Must receive the next layer type as template parameter /// template /// class MyLayer : public -/// nil::marshalling::protocol::ProtocolLayerBase< +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase< /// TField, /// TNextLayer, /// MyLayer @@ -676,7 +676,7 @@ /// public: /// // Implement read /// template -/// nil::marshalling::ErrorStatus do_read( +/// nil::crypto3::marshalling::ErrorStatus do_read( /// field_type& field, /// TMsg& msg, // can be either smart pointer (ProtocolStack::msg_ptr_type) or message object itself /// TIter& iter, @@ -686,7 +686,7 @@ /// { /// // read the field's value /// auto es = field.read(iter, size); -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// return es; /// } /// @@ -698,7 +698,7 @@ /// /// // Implement write /// template -/// nil::marshalling::ErrorStatus do_write( +/// nil::crypto3::marshalling::ErrorStatus do_write( /// field_type& field, /// const TMsg& msg, /// TIter& iter, @@ -710,7 +710,7 @@ /// /// // write the field /// auto es = field.write(iter, size); -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// return es; /// } /// @@ -719,34 +719,34 @@ /// } /// }; /// @endcode -/// Note that the third template parameter to the nil::marshalling::protocol::ProtocolLayerBase +/// Note that the third template parameter to the nil::crypto3::marshalling::protocol::ProtocolLayerBase /// base class is the inheriting class itself. /// -/// The nil::marshalling::protocol::ProtocolLayerBase implements @ref -/// nil::marshalling::protocol::ProtocolLayerBase::read() and @ref -/// nil::marshalling::protocol::ProtocolLayerBase::read_fields_cached() member functions which +/// The nil::crypto3::marshalling::protocol::ProtocolLayerBase implements @ref +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::read() and @ref +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::read_fields_cached() member functions which /// are actual "read" interface, they invoke the @b do_read() member function implemented /// the derived layer class, while providing the "nextLayerReader" object to be /// used to forward the read operation to the next layer. The signature of the /// @b nextLayerReader.read() function is the same as @ref -/// nil::marshalling::protocol::ProtocolLayerBase::read(). @b NOTE, that @b msg parameter +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::read(). @b NOTE, that @b msg parameter /// to the @b do_read() member function can be either reference to a smart pointer -/// (@b ref nil::marshalling::protocol::ProtocolLayerBase::msg_ptr_type) or a reference to the message -/// object (one that extends @b nil::marshalling::MessageBase) itself. If the message object contents +/// (@b ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::msg_ptr_type) or a reference to the message +/// object (one that extends @b nil::crypto3::marshalling::MessageBase) itself. If the message object contents /// needs to be accessed, then it is necessary to know what exactly is passed as /// @b msg parameter to the @b do_read() function. The @ref -/// nil::marshalling::protocol::ProtocolLayerBase::isMessageObjRef() can be used to help in such task +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::isMessageObjRef() can be used to help in such task /// and "tag dispatch idiom" can be used to perform right functionality. /// @code /// // Must receive the next layer type as template parameter /// template -/// class MyLayer : public nil::marshalling::protocol::ProtocolLayerBase<...> +/// class MyLayer : public nil::crypto3::marshalling::protocol::ProtocolLayerBase<...> /// { -/// using Base = nil::marshalling::protocol::ProtocolLayerBase<...>; +/// using Base = nil::crypto3::marshalling::protocol::ProtocolLayerBase<...>; /// public: /// // Implement read /// template -/// nil::marshalling::ErrorStatus do_read( +/// nil::crypto3::marshalling::ErrorStatus do_read( /// field_type& field, /// TMsg& msg, // can be either smart pointer (ProtocolStack::msg_ptr_type) or message object itself /// TIter& iter, @@ -756,7 +756,7 @@ /// { /// // read the field's value /// auto es = field.read(iter, size); -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// return es; /// } /// @@ -791,28 +791,28 @@ /// }; /// @endcode /// -/// In similar way nil::marshalling::protocol::ProtocolLayerBase implements @ref -/// nil::marshalling::protocol::ProtocolLayerBase::write() and @ref -/// nil::marshalling::protocol::ProtocolLayerBase::write_fields_cached() member functions which +/// In similar way nil::crypto3::marshalling::protocol::ProtocolLayerBase implements @ref +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::write() and @ref +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::write_fields_cached() member functions which /// are actual "write" interface, they invoke the @b do_write() member function implemented /// the derived layer class, while providing the "nextLayerWriter" object to be /// used to forward the read operation to the next layer. The signature of the /// @b nextLayerWriter.write() function is the same as @ref -/// nil::marshalling::protocol::ProtocolLayerBase::write(). If the @b do_write() function +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::write(). If the @b do_write() function /// requires modification to the used iterator (moving it back and force), it /// must determine type of the iterators (using @b std::iterator_traits). In case /// the used iterator is @b output one (not @b random-access), then such update /// may be impossible. In this case the @b do_write() function is expected to -/// write some dummy value and return @ref nil::marshalling::ErrorStatus::update_required. +/// write some dummy value and return @ref nil::crypto3::marshalling::ErrorStatus::update_required. /// It will indicate to the client application that invocation of @b update /// functionality with random access iterator needs to follow the @b write operation. /// -/// The nil::marshalling::protocol::ProtocolLayerBase base class defines also "update" -/// interface functions @ref nil::marshalling::protocol::ProtocolLayerBase::update() and -/// @ref nil::marshalling::protocol::ProtocolLayerBase::update_fields_cached(), which in the +/// The nil::crypto3::marshalling::protocol::ProtocolLayerBase base class defines also "update" +/// interface functions @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::update() and +/// @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::update_fields_cached(), which in the /// similar way invoke @b do_update(). However, @ref -/// nil::marshalling::protocol::ProtocolLayerBase class provides a default implementation -/// of @b do_update() (see @ref nil::marshalling::protocol::ProtocolLayerBase::do_update()) +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase class provides a default implementation +/// of @b do_update() (see @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::do_update()) /// member function, which does nothing, just advances the iterator. If there /// is a need for a custom update functionality, please provide it in you /// layer class by implementing the custom version of @b do_update() member function. @@ -820,7 +820,7 @@ /// // Must receive the next layer type as template parameter /// template /// class MyLayer : public -/// nil::marshalling::protocol::ProtocolLayerBase< +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase< /// TField, /// TNextLayer, /// MyLayer @@ -829,7 +829,7 @@ /// public: /// ... /// template -/// nil::marshalling::ErrorStatus do_update( +/// nil::crypto3::marshalling::ErrorStatus do_update( /// field_type& field, /// TIter& iter, /// std::size_t size, @@ -838,7 +838,7 @@ /// // Update field with the new value and rewrite it to the output buffer /// field.value() = ...; /// auto es = field.write(iter, size); -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// return es; /// } /// @@ -849,16 +849,16 @@ /// @endcode /// The signature of the /// @b nextLayerUpdater.update() function is the same as @ref -/// nil::marshalling::protocol::ProtocolLayerBase::update(). +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase::update(). /// -/// If the new layer being implemented is similar to @ref nil::marshalling::protocol::MsgIdLayer, +/// If the new layer being implemented is similar to @ref nil::crypto3::marshalling::protocol::MsgIdLayer, /// i.e. creates message objects when id of the message is known, then it must -/// also override (hide) the inherited @ref nil::marshalling::protocol::ProtocolLayerBase::create_msg() +/// also override (hide) the inherited @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::create_msg() /// and implement its own version: /// @code /// template /// class MyLayer : public -/// nil::marshalling::protocol::ProtocolLayerBase< +/// nil::crypto3::marshalling::protocol::ProtocolLayerBase< /// TField, /// TNextLayer, /// MyLayer diff --git a/crypto3/libs/marshalling/core/docs/page_use_prot.dox b/crypto3/libs/marshalling/core/docs/page_use_prot.dox index bc02d4298b..47c72794e3 100644 --- a/crypto3/libs/marshalling/core/docs/page_use_prot.dox +++ b/crypto3/libs/marshalling/core/docs/page_use_prot.dox @@ -21,13 +21,13 @@ /// to run a script after library installation to replace /// the following strings with new name: /// @li "namespace marshalling" - replace with "namespace marshalling2" -/// @li @b "nil::marshalling::" - replace with "marshalling2::" +/// @li @b "nil::crypto3::marshalling::" - replace with "marshalling2::" /// @li @b "marshalling/" - replace with "marshalling2/" /// /// @section page_use_prot_error_handling Error Handling /// The Marshalling library is intended to be used in embedded systems (including /// bare metal), which means the library does not use exceptions to report errors. -/// The runtime errors are reported via @ref nil::marshalling::ErrorStatus return values. All +/// The runtime errors are reported via @ref nil::crypto3::marshalling::ErrorStatus return values. All /// pre- and post-conditions are checked using MARSHALLING_ASSERT() macro. /// It is, just like regular standard @b assert(), is compiled in if @b NDEBUG symbol /// is not defined. In case the provided condition doesn't hold true, the macro @@ -59,9 +59,9 @@ /// /// template /// using Message = -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, // endian -/// nil::marshalling::option::msg_id_type, // type of message ID +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, // endian +/// nil::crypto3::marshalling::option::msg_id_type, // type of message ID /// TOptions... /// >; /// @@ -72,13 +72,13 @@ /// namespace my_protocol /// { /// -/// class Message : public nil::marshalling::Message -/// // nil::marshalling::field_type class with the same endian option. +/// class Message : public nil::crypto3::marshalling::Message +/// // nil::crypto3::marshalling::field_type class with the same endian option. /// // Can (and should) be provided as a base class to all the /// // fields. -/// typedef nil::marshalling::field_type<.../* Same endian option*/> field_type; +/// typedef nil::crypto3::marshalling::field_type<.../* Same endian option*/> field_type; /// -/// // type of the ID, same as the one passed with nil::marshalling::option::msg_id_type +/// // type of the ID, same as the one passed with nil::crypto3::marshalling::option::msg_id_type /// typedef msg_id msg_id_type; /// /// // type of the ID, when it is passed as a parameter and/or returned from the function: @@ -120,20 +120,20 @@ /// the same name, but with @b Impl suffix. /// /// All the variants of message interface class that are going to be described -/// below are descendants of @ref nil::marshalling::Message class. Please refer to the +/// below are descendants of @ref nil::crypto3::marshalling::Message class. Please refer to the /// documentation of the latter for detailed info on the described functions and /// their parameters. /// /// @subsection page_use_prot_interface_id_retrieve Polymorphic Retrieval of Message ID /// When there is a need to be able to polymorphically retrieve message ID, -/// the nil::marshalling::option::id_info_interface option needs to be used. Note, that this -/// option requires presence of @ref nil::marshalling::option::msg_id_type (which is expected to +/// the nil::crypto3::marshalling::option::id_info_interface option needs to be used. Note, that this +/// option requires presence of @ref nil::crypto3::marshalling::option::msg_id_type (which is expected to /// be used in protocol definition) to specify type /// of the message ID in order to work properly. /// @code /// using MyMessage = /// my_protocol::Message< -/// nil::marshalling::option::id_info_interface, +/// nil::crypto3::marshalling::option::id_info_interface, /// ... /// >; /// @endcode @@ -152,26 +152,26 @@ /// virtual msg_id_param_type get_id_impl() const = 0; // Automatically implemented in the actual message class /// } /// @endcode -/// The usage of nil::marshalling::option::id_info_interface without nil::marshalling::option::msg_id_type +/// The usage of nil::crypto3::marshalling::option::id_info_interface without nil::crypto3::marshalling::option::msg_id_type /// will be ignored, and @b get_id() as well as @b get_id_impl() member functions /// won't be created. /// -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_get_id() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_get_id() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::id_info_interface option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::id_info_interface option has been used, i.e. /// the message interface class defines mentioned earlier /// functions. /// /// @subsection page_use_prot_interface_read Polymorphic Read of Payload (Deserialization) /// If the implementation requires polymorphic read and process of input messages, the @b read() /// operation needs to be added to the interface. It is achieved by using -/// @ref nil::marshalling::option::read_iterator option to provide a type of the iterator that +/// @ref nil::crypto3::marshalling::option::read_iterator option to provide a type of the iterator that /// is going to be used for reading: /// @code /// using MyMessage = /// my_protocol::Message< /// ... -/// nil::marshalling::option::read_iterator, +/// nil::crypto3::marshalling::option::read_iterator, /// ... /// >; /// @endcode @@ -181,20 +181,20 @@ /// { /// public: /// // type of the the iterator used for reading, the same as provided with -/// // nil::marshalling::option::read_iterator option. +/// // nil::crypto3::marshalling::option::read_iterator option. /// typedef ... read_iterator; /// /// // API function to perform read -/// nil::marshalling::ErrorStatus read(read_iterator& iter, std::size_t len) +/// nil::crypto3::marshalling::ErrorStatus read(read_iterator& iter, std::size_t len) /// { /// return readImpl(iter, len); /// } /// /// protected: /// // Expected to be overriden in the derived class. -/// virtual nil::marshalling::ErrorStatus readImpl(read_iterator& iter, std::size_t len) +/// virtual nil::crypto3::marshalling::ErrorStatus readImpl(read_iterator& iter, std::size_t len) /// { -/// return nil::marshalling::ErrorStatus::not_supported; +/// return nil::crypto3::marshalling::ErrorStatus::not_supported; /// } /// } /// @endcode @@ -210,7 +210,7 @@ /// { /// MyMessage::read_iterator readIter = buf; /// auto es = msg->read(readIter, len); // readIter is advanced in the read operation -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// ... // Report and handle error /// return 0U; /// } @@ -220,22 +220,22 @@ /// return bytesCount; /// } /// @endcode -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_read() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_read() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::read_iterator option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::read_iterator option has been used, i.e. /// the message interface class defines mentioned earlier /// types and functions. /// /// @subsection page_use_prot_interface_write Polymorphic Write of Payload (Serialisation) /// If the implementation requires polymorphic serialization of the messages and sending them over I/O /// link, the @b write() operation needs to be added to the interface. It is -/// achieved by using nil::marshalling::option::write_iterator option to provide a type of +/// achieved by using nil::crypto3::marshalling::option::write_iterator option to provide a type of /// the iterator that is going to be used for writing: /// @code /// using MyMessage = /// my_protocol::Message< /// ... -/// nil::marshalling::option::write_iterator > >, +/// nil::crypto3::marshalling::option::write_iterator > >, /// ... /// >; /// @endcode @@ -245,20 +245,20 @@ /// { /// public: /// // type of the the iterator used for writing, the same as provided with -/// // nil::marshalling::option::write_iterator option. +/// // nil::crypto3::marshalling::option::write_iterator option. /// typedef ... write_iterator; /// /// // API function to perform write -/// nil::marshalling::ErrorStatus write(write_iterator& iter, std::size_t len) +/// nil::crypto3::marshalling::ErrorStatus write(write_iterator& iter, std::size_t len) /// { /// return write_impl(iter, len); /// } /// /// protected: /// // Expected to be overriden in the derived class. -/// virtual nil::marshalling::ErrorStatus write_impl(write_iterator& iter, std::size_t len) +/// virtual nil::crypto3::marshalling::ErrorStatus write_impl(write_iterator& iter, std::size_t len) /// { -/// return nil::marshalling::ErrorStatus::not_supported; +/// return nil::crypto3::marshalling::ErrorStatus::not_supported; /// } /// } /// @endcode @@ -272,22 +272,22 @@ /// Also @b note, that iterator is passed by reference, which allows advancing /// operator when write operation is performed. /// -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_write() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_write() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::write_iterator option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::write_iterator option has been used, i.e. /// the message interface class defines mentioned earlier /// types and functions. /// /// @subsection page_use_prot_interface_length Polymorphic Serialisation length Retrieval /// Sometimes it may be needed to polymorphically retrieve the serialization length of the message /// in order to be able to reserve or allocate enough space for output buffer. -/// The Marshalling library provides nil::marshalling::option::length_info_interface option that +/// The Marshalling library provides nil::crypto3::marshalling::option::length_info_interface option that /// adds @b length() member function to the interface. /// @code /// using MyMessage = /// my_protocol::Message< /// ... -/// nil::marshalling::option::length_info_interface, +/// nil::crypto3::marshalling::option::length_info_interface, /// ... /// >; /// @endcode @@ -306,21 +306,21 @@ /// virtual std::size_t length_impl() const = 0; // Implemented in the derived class /// }; /// @endcode -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_length() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_length() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::length_info_interface option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::length_info_interface option has been used, i.e. /// the message interface class defines mentioned earlier /// functions. /// /// @subsection page_use_prot_interface_valid Polymorphic Validity Check /// Sometimes it may be needed to be able to check whether the message contents -/// (fields) have valid values. The Marshalling library provides nil::marshalling::option::valid_check_interface +/// (fields) have valid values. The Marshalling library provides nil::crypto3::marshalling::option::valid_check_interface /// option that adds @b valid() member function to the interface: /// @code /// using MyMessage = /// my_protocol::Message< /// ... -/// nil::marshalling::option::valid_check_interface, +/// nil::crypto3::marshalling::option::valid_check_interface, /// ... /// >; /// @endcode @@ -342,9 +342,9 @@ /// } /// }; /// @endcode -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_valid() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_valid() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::valid_check_interface option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::valid_check_interface option has been used, i.e. /// the message interface class defines mentioned earlier /// functions. /// @@ -360,7 +360,7 @@ /// to dispatch messages to appropriate handler. /// /// The handler class needs to be forward declared and passed -/// to the definition of @b MyMessage interface via nil::marshalling::option::handler option. +/// to the definition of @b MyMessage interface via nil::crypto3::marshalling::option::handler option. /// @code /// // Forward declaration /// class MyHandler; @@ -368,7 +368,7 @@ /// using MyHandler = /// my_protocol::Message< /// ... -/// nil::marshalling::option::handler, +/// nil::crypto3::marshalling::option::handler, /// ... /// >; /// @endcode @@ -378,7 +378,7 @@ /// class MyMessage /// { /// public: -/// // The same type as passed via nil::marshalling::option::handler option +/// // The same type as passed via nil::crypto3::marshalling::option::handler option /// typedef ... handler; /// /// // Return type of the dispatch function, which is the same as return type of @@ -398,9 +398,9 @@ /// More detail about polymorphic dispatching and handling will be provided /// below in @ref page_use_prot_handling section. /// -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_dispatch() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_dispatch() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::handler option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::handler option has been used, i.e. /// the message interface class defines mentioned earlier /// types and functions. /// @@ -412,13 +412,13 @@ /// After updating such fields directly, using the interface of the message object, /// the message contents may end up being in an inconsistent (or invalid) state. /// There may be a need to polymorphically normalise the state of the message object. The -/// Marshalling library provides nil::marshalling::option::refresh_interface option, that adds +/// Marshalling library provides nil::crypto3::marshalling::option::refresh_interface option, that adds /// @b refresh() member function to the message interface. /// @code /// using MyMessage = -/// nil::marshalling::Message< +/// nil::crypto3::marshalling::Message< /// ... -/// nil::marshalling::option::refresh_interface, +/// nil::crypto3::marshalling::option::refresh_interface, /// ... /// >; /// @endcode @@ -447,22 +447,22 @@ /// virtual function. The message object that require proper "refresh" functionality /// may just override it with proper implementation. /// -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_refresh() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_refresh() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::refresh_interface option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::refresh_interface option has been used, i.e. /// the message interface class defines mentioned earlier /// functions. /// /// @subsection page_use_prot_interface_name Polymorphic Message Name Retrieval /// Some applications may require knowledge about and report the name of the received / sent -/// message. The @b Marshalling library provides @ref nil::marshalling::option::name_interface +/// message. The @b Marshalling library provides @ref nil::crypto3::marshalling::option::name_interface /// option, that adds @b name() member function to the message interface -/// (see @ref nil::marshalling::Message::name()). +/// (see @ref nil::crypto3::marshalling::Message::name()). /// @code /// using MyMessage = -/// nil::marshalling::Message< +/// nil::crypto3::marshalling::Message< /// ... -/// nil::marshalling::option::name_interface, +/// nil::crypto3::marshalling::option::name_interface, /// ... /// >; /// @endcode @@ -481,27 +481,27 @@ /// virtual const char* name_impl() const = 0; /// }; /// @endcode -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_name() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_name() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::name_interface option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::name_interface option has been used, i.e. /// the message interface class defines mentioned earlier /// functions. /// /// @subsection page_use_prot_interface_virt_destructor Virtual Destructor -/// By default the @ref nil::marshalling::Message class defines its +/// By default the @ref nil::crypto3::marshalling::Message class defines its /// destructor as @b virtual if and only if it exhibits a polymorphic behaviour, /// i.e. if there is at least one other virtual function defined. There are a couple of /// ways to change this default behaviour. /// @li If the definition of the common message interface class using /// exhibits polymorphic /// behaviour (i.e. has other virtual functions), but mustn't define its -/// destructor as @b virtual, use @ref nil::marshalling::option::no_virtual_destructor +/// destructor as @b virtual, use @ref nil::crypto3::marshalling::option::no_virtual_destructor /// option in the interface class definition. /// @code /// using MyMessage = /// my_protocol::Message< /// ..., -/// nil::marshalling::option::no_virtual_destructor +/// nil::crypto3::marshalling::option::no_virtual_destructor /// >; /// @endcode /// @li If the definition of the common interface class @@ -523,14 +523,14 @@ /// priority over (or overrides) the same option defined later. @n /// For example, the definition below defines @b write_iterator to be /// std::uint8_t*, because it was defined with first -/// nil::marshalling::option::write_iterator option: +/// nil::crypto3::marshalling::option::write_iterator option: /// @code /// using MyMessage = /// my_protocol::Message< /// ... -/// nil::marshalling::option::write_iterator, +/// nil::crypto3::marshalling::option::write_iterator, /// ... -/// nil::marshalling::option::write_iterator >, +/// nil::crypto3::marshalling::option::write_iterator >, /// ... /// >; /// @endcode @@ -539,14 +539,14 @@ /// @b length(), @b valid(), @b refresh(), and @b name(). /// @code /// using MyMessage = my_protocol::Message< -/// nil::marshalling::option::id_info_interface, // Add an ability to retrieve message ID value -/// nil::marshalling::option::read_iterator, // Use const std::uint8_t* as iterator for reading -/// nil::marshalling::option::write_iterator, // Use std::uint8_t* as iterator for writing -/// nil::marshalling::option::handler, // My MyHandler class declared earlier as a handler for messages -/// nil::marshalling::option::length_info_interface, // Add an ability to retrieve serialization length -/// nil::marshalling::option::valid_check_interface, // Add an ability to check contents validity -/// nil::marshalling::option::refresh_interface, // Add an ability to refresh message contents -/// nil::marshalling::option::name_interface // Add an ability to retrieve message name +/// nil::crypto3::marshalling::option::id_info_interface, // Add an ability to retrieve message ID value +/// nil::crypto3::marshalling::option::read_iterator, // Use const std::uint8_t* as iterator for reading +/// nil::crypto3::marshalling::option::write_iterator, // Use std::uint8_t* as iterator for writing +/// nil::crypto3::marshalling::option::handler, // My MyHandler class declared earlier as a handler for messages +/// nil::crypto3::marshalling::option::length_info_interface, // Add an ability to retrieve serialization length +/// nil::crypto3::marshalling::option::valid_check_interface, // Add an ability to check contents validity +/// nil::crypto3::marshalling::option::refresh_interface, // Add an ability to refresh message contents +/// nil::crypto3::marshalling::option::name_interface // Add an ability to retrieve message name /// >; /// @endcode /// @@ -563,7 +563,7 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, /// ... /// > @@ -577,26 +577,26 @@ /// @endcode /// The interface class that was defined for the application (@b MyMessage) needs /// to be passed as @b TBase template parameter. The defined message class -/// extends @ref nil::marshalling::MessageBase, which in turn extends provided interface -/// class @b TBase, which in turn extends @ref nil::marshalling::Message. The inheritence +/// extends @ref nil::crypto3::marshalling::MessageBase, which in turn extends provided interface +/// class @b TBase, which in turn extends @ref nil::crypto3::marshalling::Message. The inheritence /// hierarchy may look like this: /// @diafile message_class_hierarchy.dia /// -/// Due to the fact that every protocol message class extends @ref nil::marshalling::MessageBase, +/// Due to the fact that every protocol message class extends @ref nil::crypto3::marshalling::MessageBase, /// the detailed documentation on available member types and functions -/// can be viewed on @ref nil::marshalling::MessageBase reference page. +/// can be viewed on @ref nil::crypto3::marshalling::MessageBase reference page. /// /// All the protocol message classes implement non-virtual functions that may be /// used to implement polymorphic behavior. These function has the same name as /// described earlier interface, but start with @b do* prefix. /// -/// @li @b do_read() - implements message read functionality (see @ref nil::marshalling::MessageBase::do_read()) -/// @li @b do_write() - implements message write functionality (see @ref nil::marshalling::MessageBase::do_write()) -/// @li @b do_length() - implements message serialization length calculation (see @ref nil::marshalling::MessageBase::do_length()) -/// @li @b do_valid() - implements message contents validity check (see @ref nil::marshalling::MessageBase::do_valid()) -/// @li @b do_refresh() - implements bringing message to a consistent state (see @ref nil::marshalling::MessageBase::do_refresh()) +/// @li @b do_read() - implements message read functionality (see @ref nil::crypto3::marshalling::MessageBase::do_read()) +/// @li @b do_write() - implements message write functionality (see @ref nil::crypto3::marshalling::MessageBase::do_write()) +/// @li @b do_length() - implements message serialization length calculation (see @ref nil::crypto3::marshalling::MessageBase::do_length()) +/// @li @b do_valid() - implements message contents validity check (see @ref nil::crypto3::marshalling::MessageBase::do_valid()) +/// @li @b do_refresh() - implements bringing message to a consistent state (see @ref nil::crypto3::marshalling::MessageBase::do_refresh()) /// -/// Based on the requested polymorphic functionality, the @b nil::marshalling::MessageBase +/// Based on the requested polymorphic functionality, the @b nil::crypto3::marshalling::MessageBase /// class automatically implements virtual @b *Impl() member functions (but only when needed). /// @code /// namespace my_protocol @@ -607,26 +607,26 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, /// ... /// > /// { /// public: /// template -/// nil::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) {...} +/// nil::crypto3::marshalling::ErrorStatus do_read(TIter& iter, std::size_t len) {...} /// /// template -/// nil::marshalling::ErrorStatus do_write(TIter& iter, std::size_t len) const {...} +/// nil::crypto3::marshalling::ErrorStatus do_write(TIter& iter, std::size_t len) const {...} /// /// ... /// protected: -/// virtual nil::marshalling::ErrorStatus readImpl(read_iterator& iter, std::size_t len) +/// virtual nil::crypto3::marshalling::ErrorStatus readImpl(read_iterator& iter, std::size_t len) /// { /// return do_read(iter, len); /// } /// -/// virtual nil::marshalling::ErrorStatus write_impl(write_iterator& iter, std::size_t len) const +/// virtual nil::crypto3::marshalling::ErrorStatus write_impl(write_iterator& iter, std::size_t len) const /// { /// return do_write(iter, len); /// } @@ -657,8 +657,8 @@ /// } /// @endcode /// Every message has zero or more fields, which are stored in @b std::tuple -/// as private members of @ref nil::marshalling::MessageBase. The access to the fields -/// can be obtained using @b fields() member function (see @ref nil::marshalling::MessageBase::fields()). +/// as private members of @ref nil::crypto3::marshalling::MessageBase. The access to the fields +/// can be obtained using @b fields() member function (see @ref nil::crypto3::marshalling::MessageBase::fields()). /// /// However, every message that has at least one field is expected to use /// @ref MARSHALLING_MSG_FIELDS_ACCESS() macro to provide names to inner fields. @@ -671,7 +671,7 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, /// ... /// > @@ -695,7 +695,7 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, /// ... /// > @@ -770,14 +770,14 @@ /// In order to continue with the tutorial, it is paramount to understand a /// concept of @b fields, which are abstractions around value storage primitives and/or objects, /// such as integral values, floating point values, strings, arrays, etc.. -/// Every @b field class is defined in @ref nil::marshalling::field namespace and +/// Every @b field class is defined in @ref nil::crypto3::marshalling::field namespace and /// exposes predefined interface in order to /// make template meta-programming as easy as possible. As an example let's -/// take a look at @ref nil::marshalling::types::IntValue class which is used to +/// take a look at @ref nil::crypto3::marshalling::types::IntValue class which is used to /// define integral value field. /// @code /// template -/// class nil::marshalling::types::IntValue : public TBase +/// class nil::crypto3::marshalling::types::IntValue : public TBase /// { /// public: /// // Define inner storage type @@ -789,11 +789,11 @@ /// /// // Read /// template -/// nil::marshalling::ErrorStatus read(TIter& iter, std::size_t len) {...} +/// nil::crypto3::marshalling::ErrorStatus read(TIter& iter, std::size_t len) {...} /// /// // Write /// template -/// nil::marshalling::ErrorStatus write(TIter& iter, std::size_t len) const {...} +/// nil::crypto3::marshalling::ErrorStatus write(TIter& iter, std::size_t len) const {...} /// /// // Serialisation length /// std::size_t length() const {...} @@ -811,12 +811,12 @@ /// The main things to note are that every field definition class: /// @li receives its base class as the first /// template parameter. It is expected to be a variant of @ref -/// nil::marshalling::field_type with @ref nil::marshalling::option::big_endian or @ref -/// nil::marshalling::option::little_endian option to specify the serialization endian. +/// nil::crypto3::marshalling::field_type with @ref nil::crypto3::marshalling::option::big_endian or @ref +/// nil::crypto3::marshalling::option::little_endian option to specify the serialization endian. /// It may be inner @b field_type type of @b MyMessage interface class defined -/// earlier (@b MyMessage::field_type - documented as @ref nil::marshalling::Message::field_type) +/// earlier (@b MyMessage::field_type - documented as @ref nil::crypto3::marshalling::Message::field_type) /// @li exhibits some default behaviour which can be modified by -/// passing various options from @ref nil::marshalling::option namespace as additional template +/// passing various options from @ref nil::crypto3::marshalling::option namespace as additional template /// parameters. The options that define how field is serialized are expected /// to be used as part of protocol definition. The protocol definition is /// also expected to allow passing extra options that are relevant to application @@ -848,28 +848,28 @@ /// message contents and provide other useful functionality. /// /// The available fields abstractions are: -/// @li @ref nil::marshalling::types::IntValue - used to define @ref page_use_prot_fields_int_value -/// @li @ref nil::marshalling::types::EnumValue - used to define @ref page_use_prot_fields_enum_value -/// @li @ref nil::marshalling::types::BitmaskValue - used to define @ref page_use_prot_fields_bitmask_value -/// @li @ref nil::marshalling::types::Bitfield - used to define @ref page_use_prot_fields_bitfield -/// @li @ref nil::marshalling::types::Bundle - used to define @ref page_use_prot_fields_bundle -/// @li @ref nil::marshalling::types::array_list - used to define @ref page_use_prot_fields_array_list -/// @li @ref nil::marshalling::types::String - used to define @ref page_use_prot_fields_string -/// @li @ref nil::marshalling::types::FloatValue - used to define @ref page_use_prot_fields_fp_value -/// @li @ref nil::marshalling::types::Optional - used to define @ref page_use_prot_fields_optional -/// @li @ref nil::marshalling::types::Variant - used to define @ref page_use_prot_fields_variant +/// @li @ref nil::crypto3::marshalling::types::IntValue - used to define @ref page_use_prot_fields_int_value +/// @li @ref nil::crypto3::marshalling::types::EnumValue - used to define @ref page_use_prot_fields_enum_value +/// @li @ref nil::crypto3::marshalling::types::BitmaskValue - used to define @ref page_use_prot_fields_bitmask_value +/// @li @ref nil::crypto3::marshalling::types::Bitfield - used to define @ref page_use_prot_fields_bitfield +/// @li @ref nil::crypto3::marshalling::types::Bundle - used to define @ref page_use_prot_fields_bundle +/// @li @ref nil::crypto3::marshalling::types::array_list - used to define @ref page_use_prot_fields_array_list +/// @li @ref nil::crypto3::marshalling::types::String - used to define @ref page_use_prot_fields_string +/// @li @ref nil::crypto3::marshalling::types::FloatValue - used to define @ref page_use_prot_fields_fp_value +/// @li @ref nil::crypto3::marshalling::types::Optional - used to define @ref page_use_prot_fields_optional +/// @li @ref nil::crypto3::marshalling::types::Variant - used to define @ref page_use_prot_fields_variant /// /// @subsection page_use_prot_fields_int_value Integral value fields_type -/// Integral value fields are defined using @ref nil::marshalling::types::IntValue class. +/// Integral value fields are defined using @ref nil::crypto3::marshalling::types::IntValue class. /// Its inner @b value_type type is the same as second template parameter. Most /// integral value fields are defined and used "as-is" /// @code /// // base class for all the fields, usually defined by the protocol definition library -/// using MyFieldBase = nil::marshalling::field_type +/// using MyFieldBase = nil::crypto3::marshalling::field_type /// /// // definition of integral field /// using MyIntField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, // base class for all the fields, defined by the protocol definition library /// std::uint16_t /// >; @@ -878,18 +878,18 @@ /// MyIntField field; /// field.value() = 5; // serialized as "00 05" /// @endcode -/// Some field's definitions may use @ref nil::marshalling::option::num_value_ser_offset +/// Some field's definitions may use @ref nil::crypto3::marshalling::option::num_value_ser_offset /// option, which adds predefined offset to the field before serialising and /// subtracts it before deserialising. Classic example would be having a "year" /// information, but serialized as offset from year @b 2000 with a single byte. /// Such field may be defined as following: /// @code /// using YearField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::int16_t, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::num_value_ser_offset<-2000> +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::num_value_ser_offset<-2000> /// >; /// @endcode /// @b NOTE, that while serialization takes only 1 byte, the client application @@ -902,18 +902,18 @@ /// integral ones. For example, multiply the floating point value by 1000 before /// the serialization, and upon reception divide the received value by 1000 to /// get the floating point one. Such fields will be defined using @ref -/// nil::marshalling::types::IntValue type with using @ref nil::marshalling::option::scaling_ratio +/// nil::crypto3::marshalling::types::IntValue type with using @ref nil::crypto3::marshalling::option::scaling_ratio /// option /// @code /// using MyFpField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, // base class for all the fields, defined by the protocol definition library /// std::int32_t, -/// nil::marshalling::option::scaling_ratio<1, 1000> +/// nil::crypto3::marshalling::option::scaling_ratio<1, 1000> /// >; /// @endcode /// The inner value of such field is integral one. However, there are -/// @ref nil::marshalling::types::IntValue::get_scaled() and @ref nil::marshalling::types::IntValue::set_scaled() +/// @ref nil::crypto3::marshalling::types::IntValue::get_scaled() and @ref nil::crypto3::marshalling::types::IntValue::set_scaled() /// member functions that allow get and set original floating point value without /// worrying what math operation needs to be performed. /// @code @@ -928,35 +928,35 @@ /// this /// @code /// using MyDistance = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::int32_t, -/// nil::marshalling::option::scaling_ratio<1, 10>, -/// nil::marshalling::option::units_millimeters +/// nil::crypto3::marshalling::option::scaling_ratio<1, 10>, +/// nil::crypto3::marshalling::option::units_millimeters /// @endcode /// The @b Marshalling library provides a set of units conversion functions in -/// @ref nil::marshalling::units namespace. When using the provided conversion function the application developer +/// @ref nil::crypto3::marshalling::units namespace. When using the provided conversion function the application developer /// doesn't need to remember the original units and/or scaling factor. The @b Marshalling library /// does all the math. It also prevents (at compile time) usage of wrong conversion /// functions, say calculating time (@b milliseconds), when specified units are /// @b distance (@b millimetres). /// @code /// MyDistance field; -/// nil::marshalling::units::setMeters(field, 1.2345); +/// nil::crypto3::marshalling::units::setMeters(field, 1.2345); /// std::cout << "distance in 1/10 of mm:" << field.value() << std::endl; // prints 12345 -/// std::cout << "distance in mm" << nil::marshalling::units::get_millimeters(field); // prints 1234.5 -/// std::cout << "distance in cm" << nil::marshalling::units::get_centimeters(field); // prints 123.45 +/// std::cout << "distance in mm" << nil::crypto3::marshalling::units::get_millimeters(field); // prints 1234.5 +/// std::cout << "distance in cm" << nil::crypto3::marshalling::units::get_centimeters(field); // prints 123.45 /// @endcode -/// By default, When @ref nil::marshalling::types::IntValue field is constructed, the inner +/// By default, When @ref nil::crypto3::marshalling::types::IntValue field is constructed, the inner /// value is constructed to be 0. However, the field definition may use -/// @ref nil::marshalling::option::default_num_value option to specify some other value +/// @ref nil::crypto3::marshalling::option::default_num_value option to specify some other value /// @code /// // definition of integral field /// using MyIntField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, // base class for all the fields, defined by the protocol definition library /// std::uint16_t, -/// nil::marshalling::option::default_num_value<25> +/// nil::crypto3::marshalling::option::default_num_value<25> /// >; /// /// MyIntField field; @@ -964,7 +964,7 @@ /// @endcode /// /// @subsection page_use_prot_fields_enum_value Enum value fields_type -/// The @b enum values are defined using @ref nil::marshalling::types::EnumValue class. It +/// The @b enum values are defined using @ref nil::crypto3::marshalling::types::EnumValue class. It /// is very similar to @ref page_use_prot_fields_int_value. The main difference, /// that second template parameter as well as inner @b value_type type is @b enum. /// The @b enum can be scoped (enum class) or regular (just enum). @@ -978,11 +978,11 @@ /// }; /// /// using SomeEnumField = -/// nil::marshalling::types::EnumValue< +/// nil::crypto3::marshalling::types::EnumValue< /// MyFieldBase, /// SomeEnumVal, -/// nil::marshalling::option::valid_num_value_range<0, (int)SomeEnumVal::NumOfValues - 1>, -/// nil::marshalling::option::default_num_value<(int)SomeEnumVal::Val3> +/// nil::crypto3::marshalling::option::valid_num_value_range<0, (int)SomeEnumVal::NumOfValues - 1>, +/// nil::crypto3::marshalling::option::default_num_value<(int)SomeEnumVal::Val3> /// >; /// /// SomeEnumField field; @@ -992,26 +992,26 @@ /// /// @subsection page_use_prot_fields_bitmask_value Bitmask value fields_type /// Bitmasks (or bitsets) are also numeric values where every bit has separate, -/// independent meaning. Such fields are defined using @ref nil::marshalling::types::BitmaskValue +/// independent meaning. Such fields are defined using @ref nil::crypto3::marshalling::types::BitmaskValue /// class. /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 /// > /// { /// ... /// }; /// @endcode -/// The field definition will use @ref nil::marshalling::option::fixed_length option in +/// The field definition will use @ref nil::crypto3::marshalling::option::fixed_length option in /// order to specify its serialization length. The inner @b value_type type will /// be calculated automatically and defined as one of the unsigned types: /// @b std::uint8_t, @b std::uint16_t, @b std::uint32_t, or @b std::uint64_t. -/// The usage of @ref nil::marshalling::option::bitmask_reserved_bits option will mark +/// The usage of @ref nil::crypto3::marshalling::option::bitmask_reserved_bits option will mark /// certain bits as "reserved". It influences only validity check functionality -/// (see @ref nil::marshalling::types::BitmaskValue::valid()). If any of the reserved bits +/// (see @ref nil::crypto3::marshalling::types::BitmaskValue::valid()). If any of the reserved bits /// doesn't have an expected value, the call to @b valid() member function will /// return @b false. /// @@ -1023,10 +1023,10 @@ /// effect. /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> // Second bit is reserved and must be 0 /// > /// { /// MARSHALLING_BITMASK_BITS(first, third=2, fourth, fifth, sixth, seventh, eighth); @@ -1036,10 +1036,10 @@ /// is equivalent to defining: /// @code /// struct MyBitmask : public -/// nil::marshalling::types::BitmaskValue< +/// nil::crypto3::marshalling::types::BitmaskValue< /// MyFieldBase, -/// nil::marshalling::option::fixed_length<1>, -/// nil::marshalling::option::bitmask_reserved_bits<0x2, 0> +/// nil::crypto3::marshalling::option::fixed_length<1>, +/// nil::crypto3::marshalling::option::bitmask_reserved_bits<0x2, 0> /// > /// { /// enum BitIdx @@ -1064,8 +1064,8 @@ /// } /// @endcode /// The generated convenience access functions use existing -/// @ref nil::marshalling::types::BitmaskValue::get_bit_value() and -/// @ref nil::marshalling::types::BitmaskValue::set_bit_value() member functions. +/// @ref nil::crypto3::marshalling::types::BitmaskValue::get_bit_value() and +/// @ref nil::crypto3::marshalling::types::BitmaskValue::set_bit_value() member functions. /// /// It is also possible to set multiple bits at the same time by accessing /// the stored value directly @@ -1111,7 +1111,7 @@ /// | Hardware | 1 | /// | Software | 2 | /// -/// The field definition will use @ref nil::marshalling::types::Bitfield and probably look similar to code below +/// The field definition will use @ref nil::crypto3::marshalling::types::Bitfield and probably look similar to code below /// @code /// enum class Baud {...} /// enum class Parity {...} @@ -1119,23 +1119,23 @@ /// enum class FlowControl {...} /// /// struct SerialConfigField : public -/// nil::marshalling::types::Bitfield< +/// nil::crypto3::marshalling::types::Bitfield< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::IntValue > +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::IntValue > /// > /// > /// { /// MARSHALLING_FIELD_MEMBERS_ACCESS(baud, parity, stopBits, flowControl, reserved); /// } /// @endcode -/// All the member fields of the @ref nil::marshalling::types::Bitfield are stored internally +/// All the member fields of the @ref nil::crypto3::marshalling::types::Bitfield are stored internally /// as @b std::tuple, as the result the inner @b value_type of such field is -/// @b std::tuple of all member fields and call to @ref nil::marshalling::types::Bitfield::value() +/// @b std::tuple of all member fields and call to @ref nil::crypto3::marshalling::types::Bitfield::value() /// member function will give an access to it. /// /// The field definition is expected to use @ref MARSHALLING_FIELD_MEMBERS_ACCESS() macro, @@ -1143,14 +1143,14 @@ /// functions. The code becomes equivalent to: /// @code /// struct SerialConfigField : public -/// nil::marshalling::types::Bitfield< +/// nil::crypto3::marshalling::types::Bitfield< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::EnumValue >, -/// nil::marshalling::types::IntValue > +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::EnumValue >, +/// nil::crypto3::marshalling::types::IntValue > /// > /// > /// { @@ -1204,8 +1204,8 @@ /// calculating length, checking field's contents validity, and bringing field's /// value into a consistent state. It may be required /// when a message contains sequence (see @ref page_use_prot_fields_array_list) -/// of such bundles/structs. The Marshalling library provides @ref nil::marshalling::types::Bundle -/// field for this purpose. It is quite similar to @ref nil::marshalling::types::Bitfield described +/// of such bundles/structs. The Marshalling library provides @ref nil::crypto3::marshalling::types::Bundle +/// field for this purpose. It is quite similar to @ref nil::crypto3::marshalling::types::Bitfield described /// earlier. The difference is that every member field /// doesn't specify any length in bits, just bytes. For example: /// @code @@ -1218,12 +1218,12 @@ /// } /// /// struct MyBundle : public -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::IntValue // 2 bytes int value -/// nil::marshalling::types::EnumValue, // 1 byte enum value -/// nil::marshalling::types::BitmaskValue > // 1 byte bitmask +/// nil::crypto3::marshalling::types::IntValue // 2 bytes int value +/// nil::crypto3::marshalling::types::EnumValue, // 1 byte enum value +/// nil::crypto3::marshalling::types::BitmaskValue > // 1 byte bitmask /// > /// > /// { @@ -1236,12 +1236,12 @@ /// inner @b FieldIdx enum and convenience access member functions: /// @code /// struct MyBundle : public -/// nil::marshalling::types::Bundle< +/// nil::crypto3::marshalling::types::Bundle< /// MyFieldBase, /// std::tuple< -/// nil::marshalling::types::IntValue // 2 bytes int value -/// nil::marshalling::types::EnumValue, // 1 byte enum value -/// nil::marshalling::types::BitmaskValue > // 1 byte bitmask +/// nil::crypto3::marshalling::types::IntValue // 2 bytes int value +/// nil::crypto3::marshalling::types::EnumValue, // 1 byte enum value +/// nil::crypto3::marshalling::types::BitmaskValue > // 1 byte bitmask /// > /// > /// { @@ -1278,20 +1278,20 @@ /// @subsection page_use_prot_fields_array_list Array List fields_type /// Some communication protocols may define messages that transmit sequence /// of similar fields and/or raw data buffers. To make it easier to handle, the -/// Marshalling library provides nil::marshalling::types::array_list field which provide a required +/// Marshalling library provides nil::crypto3::marshalling::types::array_list field which provide a required /// interface to properly handle such sequences of data. It supports a /// sequence of raw bytes /// @code /// using MySimpleList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// std::uint8_t // raw byte type as second template parameter /// >; /// @endcode -/// as well as using sequence of any fields defined in nil::marshalling::field namespace +/// as well as using sequence of any fields defined in nil::crypto3::marshalling::field namespace /// @code /// using MyComplexList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// MyBundle // Complex bundle field, defined in previous section /// >; @@ -1317,13 +1317,13 @@ /// auto mem1Value = firstMember1.value(); // get the actual value of "member1" /// @endcode /// Some protocols may define fixed size lists. In such case lists are defined -/// with usage of @ref nil::marshalling::option::sequence_fixed_size option. +/// with usage of @ref nil::crypto3::marshalling::option::sequence_fixed_size option. /// @code /// using MyList = -/// nil::marshalling::types::array_list< +/// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::sequence_fixed_size<4> +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::sequence_fixed_size<4> /// >; /// @endcode /// Usage of this option just ensures right amount of elements "on the wire" after @@ -1336,11 +1336,11 @@ /// /// @subsection page_use_prot_fields_string String fields_type /// Many protocols have to transfer strings. They are defined using -/// @ref nil::marshalling::types::String field. +/// @ref nil::crypto3::marshalling::types::String field. /// @code -/// using MyString = nil::marshalling::types::String; +/// using MyString = nil::crypto3::marshalling::types::String; /// @endcode -/// It is very similar to nil::marshalling::types::array_list +/// It is very similar to nil::crypto3::marshalling::types::array_list /// it terms of value storage, read/write operations, and supported options. /// By default the value is stored as /// std::string. @@ -1354,14 +1354,14 @@ /// in more detail in @ref page_use_prot_fields_customisation section below. /// /// Also similar to @ref page_use_prot_fields_array_list, fixed length strings -/// are defined using @ref nil::marshalling::option::sequence_fixed_size option, and just +/// are defined using @ref nil::crypto3::marshalling::option::sequence_fixed_size option, and just /// like with lists it doesn't automatically resize inner string, just ensures /// right amount of characters "on the wire" when field is serialized. /// @code /// using MyFixedString = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, -/// nil::marshalling::option::sequence_fixed_size<32> +/// nil::crypto3::marshalling::option::sequence_fixed_size<32> /// >; /// /// MyFixedString field; @@ -1369,7 +1369,7 @@ /// @endcode /// /// @subsection page_use_prot_fields_fp_value Floating Point value fields_type -/// Floating point value fields are defined using @ref nil::marshalling::types::FloatValue +/// Floating point value fields are defined using @ref nil::crypto3::marshalling::types::FloatValue /// They are very similar to /// @ref page_use_prot_fields_int_value, but use @b float or @b double as its /// internal storage type. They abstract the IEEE 754 floating point @@ -1383,12 +1383,12 @@ /// "flags" bitmask field which specifies whether the following field exists or /// missing. The optional field may also be tentative, i.e. if there is enough /// data in the input buffer it exists, and missing otherwise. The Marshalling -/// library provides @ref nil::marshalling::types::Optional which is a mere wrapper around +/// library provides @ref nil::crypto3::marshalling::types::Optional which is a mere wrapper around /// other fields and provides an ability to set the optional state of the field. /// @code /// using OptField = -/// nil::marshalling::types::Optional< -/// nil::marshalling::types::IntValue +/// nil::crypto3::marshalling::types::Optional< +/// nil::crypto3::marshalling::types::IntValue /// >; /// @endcode /// The default mode of such field is "tentative". @@ -1396,20 +1396,20 @@ /// OptField field; /// assert(field.is_tentative()); /// @endcode -/// The default mode can be changed using @ref nil::marshalling::option::exists_by_default -/// or @ref nil::marshalling::option::missing_by_default options. For example +/// The default mode can be changed using @ref nil::crypto3::marshalling::option::exists_by_default +/// or @ref nil::crypto3::marshalling::option::missing_by_default options. For example /// @code /// using ExistingOptField = -/// nil::marshalling::types::Optional< -/// nil::marshalling::types::IntValue, -/// nil::marshalling::option::exists_by_default +/// nil::crypto3::marshalling::types::Optional< +/// nil::crypto3::marshalling::types::IntValue, +/// nil::crypto3::marshalling::option::exists_by_default /// >; /// /// ExistingOptField field; /// assert(field.does_exist()); /// @endcode /// @b NOTE, that inner @b value_type of such field is wrapped actual field and -/// both @ref nil::marshalling::types::Optional::value() and @ref nil::marshalling::types::Optional::field() +/// both @ref nil::crypto3::marshalling::types::Optional::value() and @ref nil::crypto3::marshalling::types::Optional::field() /// member functions allow to access it. For example: /// @code /// OptField field; @@ -1424,7 +1424,7 @@ /// would be a list of @b properties, where every property is a key/value pair. The /// key is a numeric ID of the property, while value can be a numeric field of /// any length or a string one. Such fields are defined using -/// @ref nil::marshalling::types::Variant class. It is very similar to @ref +/// @ref nil::crypto3::marshalling::types::Variant class. It is very similar to @ref /// page_use_prot_fields_bundle, but serves as one big union of provided member /// fields, i.e. only one can be used at a time. These fields are quite rare /// and if your protocol defines one, please read @ref sec_field_tutorial_variant @@ -1459,7 +1459,7 @@ /// using field1 = ...; /// using field2 = ... /// using field3 = -/// nil::marshalling::types::String< +/// nil::crypto3::marshalling::types::String< /// MyFieldBase, /// typename TOpt::message::Message1Fields::field3 // Extra option(s) /// > @@ -1475,11 +1475,11 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::fields_impl::All>, // using fields with extra options -/// nil::marshalling::option::msg_type > +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::fields_impl::All>, // using fields with extra options +/// nil::crypto3::marshalling::option::msg_type > /// > /// { /// // Provide names for the fields @@ -1502,9 +1502,9 @@ /// { /// struct Message1Fields /// { -/// using field1 = nil::marshalling::option::empty_option; // no extra functionality by default -/// using field2 = nil::marshalling::option::empty_option; // no extra functionality by default -/// using field3 = nil::marshalling::option::empty_option; // no extra functionality by default +/// using field1 = nil::crypto3::marshalling::option::empty_option; // no extra functionality by default +/// using field2 = nil::crypto3::marshalling::option::empty_option; // no extra functionality by default +/// using field3 = nil::crypto3::marshalling::option::empty_option; // no extra functionality by default /// }; /// }; /// }; @@ -1520,7 +1520,7 @@ /// { /// struct Message1Fields : public my_protocol::DefaultOptions::message::Message1Fields /// { -/// using field3 = nil::marshalling::option::fixed_size_storage<32>; +/// using field3 = nil::crypto3::marshalling::option::fixed_size_storage<32>; /// }; /// }; /// }; @@ -1554,19 +1554,19 @@ /// /// The @b Marshalling library provides /// multiple options to change the default storage type. -/// There is @ref nil::marshalling::option::fixed_size_storage option. When passed to the -/// @ref nil::marshalling::types::array_list or @ref nil::marshalling::types::String, it changes the -/// default storage type to be @ref nil::marshalling::container::static_vector or -/// @ref nil::marshalling::processing::StaticString respectively. These types expose the same +/// There is @ref nil::crypto3::marshalling::option::fixed_size_storage option. When passed to the +/// @ref nil::crypto3::marshalling::types::array_list or @ref nil::crypto3::marshalling::types::String, it changes the +/// default storage type to be @ref nil::crypto3::marshalling::container::static_vector or +/// @ref nil::crypto3::marshalling::processing::StaticString respectively. These types expose the same /// public API as @b std::vector or @b std::string, but use pre-allocated /// storage area (as their private member) to store the elements / characters. -/// Note, that the @ref nil::marshalling::option::fixed_size_storage option has a template +/// Note, that the @ref nil::crypto3::marshalling::option::fixed_size_storage option has a template /// parameter, which specify number of elements (not necessarily bytes) to be -/// stored. If the field definition already uses @ref nil::marshalling::option::sequence_fixed_size +/// stored. If the field definition already uses @ref nil::crypto3::marshalling::option::sequence_fixed_size /// option to specify that number of elements is fixed, there is -/// @ref nil::marshalling::option::sequence_fixed_size_use_fixed_size_storage -/// option which has the same effect of forcing @ref nil::marshalling::container::static_vector -/// or @ref nil::marshalling::processing::StaticString to be storage types, but does not +/// @ref nil::crypto3::marshalling::option::sequence_fixed_size_use_fixed_size_storage +/// option which has the same effect of forcing @ref nil::crypto3::marshalling::container::static_vector +/// or @ref nil::crypto3::marshalling::processing::StaticString to be storage types, but does not /// require repeating specification of storage area size. /// For example, if message type is defined to use provided @b DefaultOptions, then /// the storage type of @b field3 will be @b std::string @@ -1576,21 +1576,21 @@ /// std::string& field3Str = msg.field_value3().value(); /// @endcode /// However, if message type is defined to used described earlier @b MyOptions, then -/// the storage type of @b field3 will be @ref nil::marshalling::processing::StaticString +/// the storage type of @b field3 will be @ref nil::crypto3::marshalling::processing::StaticString /// @code /// using MyMessage1 = my_protocol::Message1; /// MyMessage1 msg; -/// nil::marshalling::container::static_string<32>& field3Str = msg.field_value3().value(); +/// nil::crypto3::marshalling::container::static_string<32>& field3Str = msg.field_value3().value(); /// @endcode /// NOTE, that using default @b std::vector / @b std::string or provided -/// @ref nil::marshalling::container::static_vector / @ref nil::marshalling::processing::StaticString will involve +/// @ref nil::crypto3::marshalling::container::static_vector / @ref nil::crypto3::marshalling::processing::StaticString will involve /// copying of the data to these storage areas during the @b read operation. If /// the input buffer is contiguous, i.e the pointer to the last element is @b always /// greater than pointer to the first one (not some kind of circular buffer), then -/// to copying of the data may be avoided by using @ref nil::marshalling::option::orig_data_view +/// to copying of the data may be avoided by using @ref nil::crypto3::marshalling::option::orig_data_view /// option. The option will change the default storage types to be -/// @ref nil::marshalling::processing::ArrayView or @ref nil::marshalling::processing::StringView. @b NOTE, that -/// passing @ref nil::marshalling::option::orig_data_view option to @ref nil::marshalling::types::array_list +/// @ref nil::crypto3::marshalling::processing::ArrayView or @ref nil::crypto3::marshalling::processing::StringView. @b NOTE, that +/// passing @ref nil::crypto3::marshalling::option::orig_data_view option to @ref nil::crypto3::marshalling::types::array_list /// is possible only if it is list of raw data (@b std::uint8_t is used as element type). /// @code /// struct MyOptions : public my_protocol::DefaultOptions @@ -1599,7 +1599,7 @@ /// { /// struct Message1Fields : public my_protocol::DefaultOptions::message::Message1Fields /// { -/// using field3 = nil::marshalling::option::orig_data_view; +/// using field3 = nil::crypto3::marshalling::option::orig_data_view; /// }; /// }; /// }; @@ -1608,7 +1608,7 @@ /// If default standard @b std::vector / @b std::string or all the provided /// by the @b Marshalling library storage type are /// not good enough, it is possible to specify custom storage type -/// using @ref nil::marshalling::option::custom_storage_type option. For example: +/// using @ref nil::crypto3::marshalling::option::custom_storage_type option. For example: /// @code /// struct MyOptions : public my_protocol::DefaultOptions /// { @@ -1617,7 +1617,7 @@ /// struct Message1Fields : public my_protocol::DefaultOptions::message::Message1Fields /// { /// using field3 = -/// nil::marshalling::option::custom_storage_type< +/// nil::crypto3::marshalling::option::custom_storage_type< /// boost::container::pmr::string /// >; /// }; @@ -1648,23 +1648,23 @@ /// struct Message1Fields /// { /// using field1 = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint8_t, /// typename TOpt::message::Message1Fields::field1, // Extra options -/// nil::marshalling::option::default_num_value<10>, -/// nil::marshalling::option::valid_num_value_range<10, 20> +/// nil::crypto3::marshalling::option::default_num_value<10>, +/// nil::crypto3::marshalling::option::valid_num_value_range<10, 20> /// >; /// ... /// }; /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::fields_impl::All>, // using fields with extra options -/// nil::marshalling::option::msg_type > +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::fields_impl::All>, // using fields with extra options +/// nil::crypto3::marshalling::option::msg_type > /// > /// { /// ... @@ -1689,8 +1689,8 @@ /// { /// using field1 = /// std::tuple< -/// nil::marshalling::option::default_num_value<5>, -/// nil::marshalling::option::ValidNumValue<5> +/// nil::crypto3::marshalling::option::default_num_value<5>, +/// nil::crypto3::marshalling::option::ValidNumValue<5> /// >; /// }; /// }; @@ -1700,24 +1700,24 @@ /// equivalent to /// @code /// using field1 = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint8_t, -/// nil::marshalling::option::default_num_value<5>, // overrides default value 10 defined below -/// nil::marshalling::option::ValidNumValue<5>, // added to previously defined range [10, 20] -/// nil::marshalling::option::default_num_value<10>, -/// nil::marshalling::option::valid_num_value_range<10, 20> +/// nil::crypto3::marshalling::option::default_num_value<5>, // overrides default value 10 defined below +/// nil::crypto3::marshalling::option::ValidNumValue<5>, // added to previously defined range [10, 20] +/// nil::crypto3::marshalling::option::default_num_value<10>, +/// nil::crypto3::marshalling::option::valid_num_value_range<10, 20> /// >; /// @endcode /// @b NOTE that @b Marshalling library processes all the options @b bottom-up, i.e. -/// starts with @b nil::marshalling::option::valid_num_value_range<10, 20> (which records initial -/// valid range [10, 20]), then processes @b nil::marshalling::option::default_num_value<10> -/// (which records default value to be 10), then processes @b nil::marshalling::option::ValidNumValue<5> +/// starts with @b nil::crypto3::marshalling::option::valid_num_value_range<10, 20> (which records initial +/// valid range [10, 20]), then processes @b nil::crypto3::marshalling::option::default_num_value<10> +/// (which records default value to be 10), then processes @b nil::crypto3::marshalling::option::ValidNumValue<5> /// (which @b adds value 5 to the existing valid ranges), then processes -/// @b nil::marshalling::option::default_num_value<5> (which changes the default value to be 5). +/// @b nil::crypto3::marshalling::option::default_num_value<5> (which changes the default value to be 5). /// /// In case the application needs to override originally defined valid range(s) of -/// the field, it can use @ref nil::marshalling::option::valid_ranges_clear +/// the field, it can use @ref nil::crypto3::marshalling::option::valid_ranges_clear /// option, which will clear all /// previously defined valid ranges and will start accumulating them anew. For /// example: @@ -1730,16 +1730,16 @@ /// { /// using field1 = /// std::tuple< -/// nil::marshalling::option::default_num_value<5>, // change the default value -/// nil::marshalling::option::ValidNumValue<5>, // add 5 to valid ranges of [40, 50] -/// nil::marshalling::option::valid_num_value_range<40, 50>, // new range -/// nil::marshalling::option::valid_ranges_clear // clear the default ranges +/// nil::crypto3::marshalling::option::default_num_value<5>, // change the default value +/// nil::crypto3::marshalling::option::ValidNumValue<5>, // add 5 to valid ranges of [40, 50] +/// nil::crypto3::marshalling::option::valid_num_value_range<40, 50>, // new range +/// nil::crypto3::marshalling::option::valid_ranges_clear // clear the default ranges /// >; /// }; /// }; /// }; /// @endcode -/// Additional option that may be quite useful is @ref nil::marshalling::option::fail_on_invalid. +/// Additional option that may be quite useful is @ref nil::crypto3::marshalling::option::fail_on_invalid. /// It causes the @b read operation to fail with provided error status when /// read value is not valid (@b valid() member function returns @b false). /// @@ -1753,7 +1753,7 @@ /// over the I/O link to the other side. The serialized message payload must /// be wrapped in some kind of transport information prior to being sent and /// unwrapped on the other side when received. The @b Marshalling protocol defines -/// multiple so called @b layers (defined in @b nil::marshalling::protocol namespace). +/// multiple so called @b layers (defined in @b nil::crypto3::marshalling::protocol namespace). /// The transport framing will be defined using those @b layer classes and will /// probably be called @b ProtocolStack. Its definition is expected to /// looke something like this: @@ -1764,8 +1764,8 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for nil::marshalling::protocol::MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for nil::crypto3::marshalling::protocol::MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// struct ProtocolStack : public /// MySyncPrefix @@ -1786,9 +1786,9 @@ /// /// The third template parameter (@b TAllocationOptions) is extra option(s) /// (bundled in @b std::tuple if more than one) to be passed to -/// @ref nil::marshalling::protocol::MsgIdLayer class which is responsible for message +/// @ref nil::crypto3::marshalling::protocol::MsgIdLayer class which is responsible for message /// allocation. By default the message object is dynamically allocated, it is -/// possible to modify such behaviour by using @ref nil::marshalling::option::in_place_allocation +/// possible to modify such behaviour by using @ref nil::crypto3::marshalling::option::in_place_allocation /// option. It will be explained in more detail further below. /// /// The fourth template parameter (@b TPayloadOptions) is irrelevant in @@ -1796,9 +1796,9 @@ /// for further analysis. It will also be explained in more detail further below. /// /// @b NOTE, that @b ProtocolStack definition is actually an alias to one -/// of the classes from @ref nil::marshalling::protocol namespace. To get a detailed +/// of the classes from @ref nil::crypto3::marshalling::protocol namespace. To get a detailed /// information on available public API please reference to one of them, for -/// example @ref nil::marshalling::protocol::SyncPrefixLayer. +/// example @ref nil::crypto3::marshalling::protocol::SyncPrefixLayer. /// /// @subsection page_use_prot_transport_read Reading Transport Framing and Message Payload /// Below is an example of how to implement data processing loop, which parses @@ -1824,22 +1824,22 @@ /// using msg_type = ProtStack::msg_ptr_type::element_type; /// /// // Get the iterator for reading -/// auto begIter = nil::marshalling::readIteratorFor(buf + consumed); +/// auto begIter = nil::crypto3::marshalling::readIteratorFor(buf + consumed); /// auto iter = begIter; /// /// // Do the read /// auto es = protStack.read(msgPtr, iter, len - consumed); -/// if (es == nil::marshalling::ErrorStatus::not_enough_data) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::not_enough_data) { /// break; // Not enough data in the buffer, stop processing /// } /// -/// if (es == nil::marshalling::ErrorStatus::protocol_error) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::protocol_error) { /// // Something is not right with the data, remove one character and try again /// ++consumed; /// continue; /// } /// -/// if (es == nil::marshalling::ErrorStatus::success) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::success) { /// assert(msgPtr); // If read is successful, msgPtr is expected to hold a valid pointer /// msgPtr->dispatch(handler); // Dispatch message for handling /// } @@ -1870,12 +1870,12 @@ /// using msg_type = ProtStack::msg_ptr_type::element_type; /// @endcode /// @li During the read operation, when message object has been successfully allocated, -/// the message payload will be read by invoking the @ref nil::marshalling::Message::read() +/// the message payload will be read by invoking the @ref nil::crypto3::marshalling::Message::read() /// member function. It means that common message interface class must support /// polymorphic read (see @ref page_use_prot_interface_read). /// It means that the iterator used -/// for reading needs to be convertible to @ref nil::marshalling::Message::read_iterator. It -/// can be achieved by using @ref nil::marshalling::read_iterator_for() template function, +/// for reading needs to be convertible to @ref nil::crypto3::marshalling::Message::read_iterator. It +/// can be achieved by using @ref nil::crypto3::marshalling::read_iterator_for() template function, /// which will initialise and return appropriate iterator type. Another /// possible way of allocating the iterator can be as following: /// @code @@ -1908,24 +1908,24 @@ /// /// MyAckMsg msg; // actual message object /// auto es = protStack.read(msg, iter, len - consumed); -/// if (es == nil::marshalling::ErrorStatus::not_enough_data) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::not_enough_data) { /// break; // Not enough data in the buffer, stop processing /// } /// -/// if (es == nil::marshalling::ErrorStatus::invalid_msg_id) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::invalid_msg_id) { /// // Unexpected message (not AckMsg) has been received, report or handle error /// ... /// consumed += std::distance(begIter, iter); /// continue; /// } /// -/// if (es == nil::marshalling::ErrorStatus::protocol_error) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::protocol_error) { /// // Something is not right with the data, remove one character and try again /// ++consumed; /// continue; /// } /// -/// if (es == nil::marshalling::ErrorStatus::success) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::success) { /// handler.handle(msg); // Handle message without polymorphic dispatch /// } /// @@ -1944,7 +1944,7 @@ /// @subsection page_use_prot_transport_msg_alloc Message Object Allocation /// By default, the message object is dynamically allocated. However, some /// applications (especially bare-metal ones) may require something different. -/// The @b Marshalling library has @ref nil::marshalling::option::in_place_allocation option, +/// The @b Marshalling library has @ref nil::crypto3::marshalling::option::in_place_allocation option, /// which may be passed as third template parameter (@b TAllocationOptions) /// to @b ProtocolStack type definition. It statically allocates (in private data /// members) storage area, that is capable to store any message object from @@ -1962,13 +1962,13 @@ /// number of input messages, all the rest need to be forwarded "as-is" or /// maybe wrapped in different transport frame before sending it over /// different I/O link. To help with such task @b Marshalling library provides -/// @ref nil::marshalling::generic_message class. There is also @ref nil::marshalling::option::support_generic_message +/// @ref nil::crypto3::marshalling::generic_message class. There is also @ref nil::crypto3::marshalling::option::support_generic_message /// option that can be passed as third template parameter (@b TAllocationOptions) /// to the @b ProtocolStack type definition. It will force of creation -/// @ref nil::marshalling::generic_message object when appropriate message object is not found. +/// @ref nil::crypto3::marshalling::generic_message object when appropriate message object is not found. /// @code /// // Define generic message type -/// using MyGenericMessage = nil::marshalling::generic_message; +/// using MyGenericMessage = nil::crypto3::marshalling::generic_message; /// /// // Limited number of supported messages /// using MyInputMessages = @@ -1982,24 +1982,24 @@ /// my_protocol::ProtocolStack< /// MyMessage, /// MyInputMessages, -/// nil::marshalling::option::support_generic_message +/// nil::crypto3::marshalling::option::support_generic_message /// >; /// @endcode -/// @b NOTE, that @ref nil::marshalling::generic_message has only single field, which -/// is a list of raw data (@ref nil::marshalling::types::array_list). The @b read operation +/// @b NOTE, that @ref nil::crypto3::marshalling::generic_message has only single field, which +/// is a list of raw data (@ref nil::crypto3::marshalling::types::array_list). The @b read operation /// of such field will result in copying the data from input buffer to -/// internal storage of this field. The @ref nil::marshalling::generic_message +/// internal storage of this field. The @ref nil::crypto3::marshalling::generic_message /// class has also other template parameters (except common message interface class). /// The second template parameter is option(s) that are going to be passed to this -/// nil::marshalling::types::array_list field. If allocated message is @b not going to -/// outlive input buffer, than it may make sense to pass @ref nil::marshalling::option::orig_data_view -/// as second template parameter to @ref nil::marshalling::generic_message. +/// nil::crypto3::marshalling::types::array_list field. If allocated message is @b not going to +/// outlive input buffer, than it may make sense to pass @ref nil::crypto3::marshalling::option::orig_data_view +/// as second template parameter to @ref nil::crypto3::marshalling::generic_message. /// @code -/// using MyGenericMessage = nil::marshalling::generic_message; +/// using MyGenericMessage = nil::crypto3::marshalling::generic_message; /// @endcode /// -/// Also @b note, that it is possible to combine usage of @ref nil::marshalling::option::in_place_allocation -/// and @ref nil::marshalling::option::support_generic_message as the third template parameter to +/// Also @b note, that it is possible to combine usage of @ref nil::crypto3::marshalling::option::in_place_allocation +/// and @ref nil::crypto3::marshalling::option::support_generic_message as the third template parameter to /// @b ProtocolStack type definition using @b std::tuple bundling. /// @code /// using ProtStack = @@ -2007,8 +2007,8 @@ /// MyMessage, /// MyInputMessages, /// std::tuple< -/// nil::marshalling::option::in_place_allocation, -/// nil::marshalling::option::support_generic_message +/// nil::crypto3::marshalling::option::in_place_allocation, +/// nil::crypto3::marshalling::option::support_generic_message /// > /// >; /// @endcode @@ -2020,9 +2020,9 @@ /// ProtStack protStack; // Protocol stack defined in one of previous sections /// void sendMessage(const MyMessage& msg, std::uint8_t* buf, std::size_t len) /// { -/// auto writeIter = nil::marshalling::write_iterator_for(&buf[0]); +/// auto writeIter = nil::crypto3::marshalling::write_iterator_for(&buf[0]); /// auto es = protStack.write(msg, writeIter, len); -/// if (es == nil::marshalling::ErrorStatus::success) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::success) { /// ... // Send contents of dataToSend via I/O link /// } /// } @@ -2040,12 +2040,12 @@ /// the number of written bytes will be calculated and the previously written /// dummy value updated accordingly. @b NOTE, that such update is possible only /// if iterator used for writing is random-access one. Such update won't be -/// possible. In this case @ref nil::marshalling::ErrorStatus::update_required error status +/// possible. In this case @ref nil::crypto3::marshalling::ErrorStatus::update_required error status /// will be returned. It means that the write operation is incomplete, there /// is a need to perform @b update() call with random-access iterator. /// For example, let's assume the @ref page_use_prot_interface_length is /// not supported and std::back_insert_iterator\ \> -/// is passed to @b MyMessage with @ref nil::marshalling::option::write_iterator option. +/// is passed to @b MyMessage with @ref nil::crypto3::marshalling::option::write_iterator option. /// the message object to perform polymorphic write /// @code /// ProtStack protStack; // Protocol stack defined in one of previous sections @@ -2054,17 +2054,17 @@ /// assert(outBuf.empty()) // Make sure buffer is empty /// auto writeIter = std::back_inserter(outBuf); /// auto es = protStack.write(msg, writeIter, outBuf.max_size()); -/// if (es == nil::marshalling::ErrorStatus::update_required) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::update_required) { /// auto updateIter = &outBuf[0]; /// es = protStack.update(updateIter, outBuf.size()); /// } /// -/// if (es == nil::marshalling::ErrorStatus::success) { +/// if (es == nil::crypto3::marshalling::ErrorStatus::success) { /// ... // Send contents of dataToSend via I/O link /// } /// } /// @endcode -/// Similar scenario of a need to handle @ref nil::marshalling::ErrorStatus::update_required +/// Similar scenario of a need to handle @ref nil::crypto3::marshalling::ErrorStatus::update_required /// error status may occur when transport framing contains checksum value and /// output (not random-access) iterator is used. The checksum calculation requires /// going over the written data to calculate the value. However, it won't be @@ -2087,9 +2087,9 @@ /// @endcode /// Such implementation does not require any polymorphic behaviour from the /// message object being sent, it takes all the required information from the -/// direct calls to non-virtual @b do_get_id() (see @ref nil::marshalling::MessageBase::do_get_id()) and -/// @b do_length() (see @ref nil::marshalling::MessageBase::do_length()). The payload write is also performed using -/// direct call to @b do_write() (see @ref nil::marshalling::MessageBase::do_write()). +/// direct calls to non-virtual @b do_get_id() (see @ref nil::crypto3::marshalling::MessageBase::do_get_id()) and +/// @b do_length() (see @ref nil::crypto3::marshalling::MessageBase::do_length()). The payload write is also performed using +/// direct call to @b do_write() (see @ref nil::crypto3::marshalling::MessageBase::do_write()). /// /// @subsection page_use_prot_transport_caching Access to Processed Stack fields_type /// All the examples above do not store the read/written transport fields @@ -2098,8 +2098,8 @@ /// also defines @b all_fields_type type which is @b std::tuple of all the fields used by all the /// layer classes. @n /// Also, the @b ProtocolStack defines @b read_fields_cached() (see -/// @ref nil::marshalling::protocol::ProtocolLayerBase::read_fields_cached()) and @b write_fields_cached() -/// (see @ref nil::marshalling::protocol::ProtocolLayerBase::write_fields_cached()) +/// @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::read_fields_cached()) and @b write_fields_cached() +/// (see @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::write_fields_cached()) /// member functions which are substitutes to normal read() and write(). The first /// parameter to these functions is reference to the @b all_fields_type bundle /// object. @@ -2108,22 +2108,22 @@ /// auto es = protStack.read_fields_cached(fields, msgPtr, readIter, bufSize); /// @endcode /// The layer class that is responsible to read/write payload data -/// (see @ref nil::marshalling::protocol::MsgDataLayer) uses @ref nil::marshalling::types::array_list +/// (see @ref nil::crypto3::marshalling::protocol::MsgDataLayer) uses @ref nil::crypto3::marshalling::types::array_list /// to define a field that will store the payload when "caching" operations are /// performed. That's where the fourth template parameter (@b TPayloadOptions) /// to @b ProtocolStack definition comes in play. /// In case the the input / output buffer outlives the @b all_fields_type -/// object, consider passing @ref nil::marshalling::option::orig_data_view option as the +/// object, consider passing @ref nil::crypto3::marshalling::option::orig_data_view option as the /// fourth template parameter to @b ProtocolStack definition, which will pass it to /// to the field containing the message payload raw data. Otherwise, the /// payload part from the read / written buffer will also be copied to storage /// area of the cached payload field. /// /// As was mentioned earlier, the protocol stack is defined using so called -/// @b layer classes (defined in @ref nil::marshalling::protocol namespace) by wrapping +/// @b layer classes (defined in @ref nil::crypto3::marshalling::protocol namespace) by wrapping /// one another. Access to the appropriate layer may be obtained using a /// sequence of calls to @b next_layer() member functions (see -/// @ref nil::marshalling::protocol::ProtocolLayerBase::next_layer()). Alternatively, the protocol stack +/// @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::next_layer()). Alternatively, the protocol stack /// definition is also expected to use @ref MARSHALLING_PROTOCOL_LAYERS_ACCESS() /// macro to generate a convenience access functions. For example /// @code @@ -2133,8 +2133,8 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// struct ProtocolStack : public /// MySyncPrefix @@ -2151,8 +2151,8 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// struct ProtocolStack : public /// MySyncPrefix @@ -2190,13 +2190,13 @@ /// @endcode /// Then the access to the appropriate layer as as simple as calling appropriate /// @b layer_*() member function. Once the access is obtained, it is possible to -/// call @b access_cached_field() (see @ref nil::marshalling::protocol::ProtocolLayerBase::access_cached_field()) +/// call @b access_cached_field() (see @ref nil::crypto3::marshalling::protocol::ProtocolLayerBase::access_cached_field()) /// member function to get an access to appropriate field. For example: /// @code /// ProtStack protStack; // Protocol stack object /// ProtStack::all_fields_type fields; // Transport fields /// auto es = protStack.read_fields_cached(fields, msgPtr, readIter, bufSize); -/// if (es != nil::marshalling::ErrorStatus::success) { +/// if (es != nil::crypto3::marshalling::ErrorStatus::success) { /// ... // handle error /// return; /// } @@ -2219,7 +2219,7 @@ /// /// The @b Marshalling library has a built-in efficient (O(1)) dispatch mechanism, which /// uses "Double Dispatch" idiom. The @ref page_use_prot_interface_handle -/// section above described using @b nil::marshalling::option::handler option, which +/// section above described using @b nil::crypto3::marshalling::option::handler option, which /// adds polymorphic @b dispatch() member function to the common interface class /// (@b MyMessage). The provided handling class (@b MyHandler) is expected /// to define @b handle() member function for every message class it is expected to @@ -2307,7 +2307,7 @@ /// /// @subsection page_use_prot_handling_generic Generic handler /// The Marshalling library provides some help in defining custom message handlers. -/// There is @ref nil::marshalling::generic_handler class that receives at least two template +/// There is @ref nil::crypto3::marshalling::generic_handler class that receives at least two template /// parameters. The first one is a common interface class for all the handled messages /// (@b MyMessage). The second template parameter is /// all the types of all the custom messages the handler is supposed to handle, @@ -2317,9 +2317,9 @@ /// @code /// using MyMessagesToHandle = MyInputMessages; /// @endcode -/// As the result the nil::marshalling::generic_handler implements @b virtual @b handle() +/// As the result the nil::crypto3::marshalling::generic_handler implements @b virtual @b handle() /// function for all the provided messages including the provided interface one. -/// The code that automatically generated by @b nil::marshalling::generic_message is equivalent +/// The code that automatically generated by @b nil::crypto3::marshalling::generic_message is equivalent /// to the one below. /// @code /// template<> @@ -2341,10 +2341,10 @@ /// ... /// }; /// @endcode -/// Now, what remains is to inherit from nil::marshalling::generic_handler and override +/// Now, what remains is to inherit from nil::crypto3::marshalling::generic_handler and override /// the functions that need to be overridden: /// @code -/// class MyHandler : public nil::marshalling::generic_handler +/// class MyHandler : public nil::crypto3::marshalling::generic_handler /// { /// public: /// // Enable polymorphic delete @@ -2363,7 +2363,7 @@ /// } /// }; /// @endcode -/// Pay attention that @ref nil::marshalling::generic_handler doesn't declare its destructor as virtual. +/// Pay attention that @ref nil::crypto3::marshalling::generic_handler doesn't declare its destructor as virtual. /// If the handler object requires support for polymorphic delete (destruction), /// make sure to declare its destructor as virtual. /// @@ -2386,13 +2386,13 @@ /// }; /// @endcode /// If inner @b RetType type is defined, it is propagated to be also the return type of -/// the @ref nil::marshalling::Message::dispatch() member function as well. As the result the developer may +/// the @ref nil::crypto3::marshalling::Message::dispatch() member function as well. As the result the developer may /// use constructs like this: /// @code /// bool result = msg->dispatch(handler); /// @endcode /// -/// If @ref nil::marshalling::generic_handler class is used to define the handler class, its +/// If @ref nil::crypto3::marshalling::generic_handler class is used to define the handler class, its /// third template parameter (which defaults to @b void), can be used to /// specify the return type of handling functions. /// @@ -2404,7 +2404,7 @@ /// not (because they were introduced in later version of the protocol). /// Such extra information is stored in the message object itself. If this is /// the case, the protocol definition is expected to use -/// @ref nil::marshalling::option::extra_transport_fields option in addition to specifying +/// @ref nil::crypto3::marshalling::option::extra_transport_fields option in addition to specifying /// serialization endian and message ID type (described in @ref /// page_use_prot_interface). /// (see @ref page_field_tutorial) and bundled in @b std::tuple: @@ -2414,10 +2414,10 @@ /// /// // field_type describing protocol version. /// using MyVersionField = -/// nil::marshalling::types::IntValue< +/// nil::crypto3::marshalling::types::IntValue< /// MyFieldBase, /// std::uint16_t, -/// nil::marshalling::option::default_num_value<5> // Implementing v5 of the protocol by default +/// nil::crypto3::marshalling::option::default_num_value<5> // Implementing v5 of the protocol by default /// >; /// /// // Relevant extra transport fields, bundled in std::tuple @@ -2428,10 +2428,10 @@ /// /// template /// class Message : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, -/// nil::marshalling::option::extra_transport_fields, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::option::extra_transport_fields, /// TOptions... /// > /// { @@ -2441,7 +2441,7 @@ /// /// } // namespace my_protocol /// @endcode -/// Usage of @ref nil::marshalling::option::extra_transport_fields option as well as +/// Usage of @ref nil::crypto3::marshalling::option::extra_transport_fields option as well as /// @ref MARSHALLING_MSG_TRANSPORT_FIELDS_ACCESS() macro in the message class definition /// is equivalent to having the following types and member functions defined /// @code @@ -2450,9 +2450,9 @@ /// /// template /// class Message : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, /// TOptions... /// > /// { @@ -2486,7 +2486,7 @@ /// /// } // namespace my_protocol /// @endcode -/// For reference see also description of @ref nil::marshalling::Message::transport_fields() +/// For reference see also description of @ref nil::crypto3::marshalling::Message::transport_fields() /// member function. /// /// Access to the version information given a reference to message object may @@ -2505,9 +2505,9 @@ /// object itself. These fields are @b NOT getting serialized / deserialized when message /// object (payload) being read / written. /// -/// The @ref nil::marshalling::Message interface class defines @ref nil::marshalling::Message::has_transport_fields() +/// The @ref nil::crypto3::marshalling::Message interface class defines @ref nil::crypto3::marshalling::Message::has_transport_fields() /// static constexpr member function, which may be used at compile time to -/// determine whether the @ref nil::marshalling::option::extra_transport_fields option has been used, i.e. +/// determine whether the @ref nil::crypto3::marshalling::option::extra_transport_fields option has been used, i.e. /// the message interface class defines mentioned earlier /// types and functions. /// @@ -2515,15 +2515,15 @@ /// The @b Marshalling library contain a built-in protocol version support when /// version info is provided within @ref page_use_prot_extra_transport. To support /// this feature, the -/// message interface definition class needs to use @ref nil::marshalling::option::version_in_extra_transport_fields -/// option, in addition to @ref nil::marshalling::option::extra_transport_fields option itself, to +/// message interface definition class needs to use @ref nil::crypto3::marshalling::option::version_in_extra_transport_fields +/// option, in addition to @ref nil::crypto3::marshalling::option::extra_transport_fields option itself, to /// specify which field is @b version. /// @code /// namespace my_protocol /// { /// /// // field_type describing protocol version. -/// using MyVersionField = nil::marshalling::types::IntValue<...>; +/// using MyVersionField = nil::crypto3::marshalling::types::IntValue<...>; /// /// // Relevant extra transport fields, bundled in std::tuple /// using MyExtraTransportFields = @@ -2533,11 +2533,11 @@ /// /// template /// class Message : public -/// nil::marshalling::Message< -/// nil::marshalling::option::big_endian, -/// nil::marshalling::option::msg_id_type, -/// nil::marshalling::option::extra_transport_fields, -/// nil::marshalling::option::version_in_extra_transport_fields<0> +/// nil::crypto3::marshalling::Message< +/// nil::crypto3::marshalling::option::big_endian, +/// nil::crypto3::marshalling::option::msg_id_type, +/// nil::crypto3::marshalling::option::extra_transport_fields, +/// nil::crypto3::marshalling::option::version_in_extra_transport_fields<0> /// TOptions... /// > /// { @@ -2546,9 +2546,9 @@ /// /// } // namespace my_protocol /// @endcode -/// Usage of @ref nil::marshalling::option::version_in_extra_transport_fields option generates -/// inner @b version_type type (see @ref nil::marshalling::Message::version_type) as well -/// as @b version() access functions (see @ref nil::marshalling::Message::version()) for direct +/// Usage of @ref nil::crypto3::marshalling::option::version_in_extra_transport_fields option generates +/// inner @b version_type type (see @ref nil::crypto3::marshalling::Message::version_type) as well +/// as @b version() access functions (see @ref nil::crypto3::marshalling::Message::version()) for direct /// access to it. It is equivalent to having the following functions defined: /// @code /// namespace my_protocol @@ -2556,7 +2556,7 @@ /// /// template /// class Message : public -/// nil::marshalling::Message<...> +/// nil::crypto3::marshalling::Message<...> /// { /// public: /// ... @@ -2573,7 +2573,7 @@ /// @b NOTE, that updating the version information only modifies the value /// of the relevant transport fields itself. The message contents are not /// being updated. There is a need to invoke @b do_fields_version_update() member -/// function (see @ref nil::marshalling::MessageBase::do_fields_version_update()), +/// function (see @ref nil::crypto3::marshalling::MessageBase::do_fields_version_update()), /// which will do the job of updating message /// contents accordingly. /// @code @@ -2598,8 +2598,8 @@ /// the way how other messages being deserialized and/or handled. Usually it is /// some kind of @b CONNECT message. Such scenario is implemented in the /// very similar way to @ref page_use_prot_extra_transport. The protocol stack -/// is still defined using @ref nil::marshalling::protocol::TransportValueLayer but with @ref -/// nil::marshalling::option::pseudo_value option. Such layer contains the "pseudo" field in +/// is still defined using @ref nil::crypto3::marshalling::protocol::TransportValueLayer but with @ref +/// nil::crypto3::marshalling::option::pseudo_value option. Such layer contains the "pseudo" field in /// its internal data members and pretends to read it during @b read operation. /// /// Let's assume the protocol framing is defined to be @@ -2621,8 +2621,8 @@ /// template < /// typename TMessage, // common interface class defined by the application /// typename TInputMessages = all_messages_type, // Input messages that need to be recognised -/// typename TAllocationOptions = nil::marshalling::option::empty_option, // Extra options for MsgIdLayer -/// typename TPayloadOptions = nil::marshalling::option::empty_option // Extra options for payload storage +/// typename TAllocationOptions = nil::crypto3::marshalling::option::empty_option, // Extra options for MsgIdLayer +/// typename TPayloadOptions = nil::crypto3::marshalling::option::empty_option // Extra options for payload storage /// > /// struct ProtocolStack : public /// MySizePrefix @@ -2634,8 +2634,8 @@ /// @endcode /// Then after reception and handling of the mentioned @b CONNECT message, the /// stored pseudo version field may be accessed using @b pseudo_field() member -/// function of @ref nil::marshalling::protocol::TransportValueLayer layer (see @ref -/// nil::marshalling::protocol::TransportValueLayer::pseudo_field()) and updated with +/// function of @ref nil::crypto3::marshalling::protocol::TransportValueLayer layer (see @ref +/// nil::crypto3::marshalling::protocol::TransportValueLayer::pseudo_field()) and updated with /// reported value. /// @code /// ProtStack protStack; // Protocol stack object @@ -2654,15 +2654,15 @@ /// @code /// using MyInputMessage = /// my_protocol::Message< -/// nil::marshalling::option::read_iterator, // polymorphic read -/// nil::marshalling::option::handler // polymorphic dispatch +/// nil::crypto3::marshalling::option::read_iterator, // polymorphic read +/// nil::crypto3::marshalling::option::handler // polymorphic dispatch /// >; /// /// using MyOutputMessage = /// my_protocol::Message< -/// nil::marshalling::option::write_iterator, // polymorphic write -/// nil::marshalling::option::id_info_interface, // polymorphic ID retrieve -/// nil::marshalling::option::length_info_interface // polymorphic serialization length retrieve +/// nil::crypto3::marshalling::option::write_iterator, // polymorphic write +/// nil::crypto3::marshalling::option::id_info_interface, // polymorphic ID retrieve +/// nil::crypto3::marshalling::option::length_info_interface // polymorphic serialization length retrieve /// >; /// /// using MyInputMessage1 = my_protocol::Message1; @@ -2682,12 +2682,12 @@ /// functions for bare-metal application may be a heavy price to pay, especially /// when ROM size is small. The @b Marshalling library provides several /// options that inhibit generation of virtual functions. These extra options -/// need to be passed to @ref nil::marshalling::MessageBase class when defining a message +/// need to be passed to @ref nil::crypto3::marshalling::MessageBase class when defining a message /// class. Available options are: -/// @li @ref nil::marshalling::option::no_read_impl -/// @li @ref nil::marshalling::option::no_write_impl -/// @li @ref nil::marshalling::option::no_valid_impl -/// @li @ref nil::marshalling::option::no_length_impl +/// @li @ref nil::crypto3::marshalling::option::no_read_impl +/// @li @ref nil::crypto3::marshalling::option::no_write_impl +/// @li @ref nil::crypto3::marshalling::option::no_valid_impl +/// @li @ref nil::crypto3::marshalling::option::no_length_impl /// /// In order to be able to pass these extra options to message definition classes, /// the support from the latter is required. If the protocol definition @@ -2702,8 +2702,8 @@ /// { /// struct message /// { -/// using Message1 = nil::marshalling::option::empty_option; -/// using Message2 = nil::marshalling::option::empty_option; +/// using Message1 = nil::crypto3::marshalling::option::empty_option; +/// using Message2 = nil::crypto3::marshalling::option::empty_option; /// ... /// }; /// }; @@ -2713,11 +2713,11 @@ /// /// template /// class Message1 : public -/// nil::marshalling::MessageBase< +/// nil::crypto3::marshalling::MessageBase< /// TBase, -/// nil::marshalling::option::static_num_id_impl, -/// nil::marshalling::option::fields_impl::All>, -/// nil::marshalling::option::msg_type >, +/// nil::crypto3::marshalling::option::static_num_id_impl, +/// nil::crypto3::marshalling::option::fields_impl::All>, +/// nil::crypto3::marshalling::option::msg_type >, /// typename TOpt::message::Message1 // Extra options /// > /// { @@ -2737,8 +2737,8 @@ /// { /// struct message : public my_protocol::DefaultOptions::message /// { -/// using Message1 = nil::marshalling::option::no_read_impl; -/// using Message2 = nil::marshalling::option::no_write_impl; +/// using Message1 = nil::crypto3::marshalling::option::no_read_impl; +/// using Message2 = nil::crypto3::marshalling::option::no_write_impl; /// }; /// }; /// @@ -2748,7 +2748,7 @@ /// /// @section page_use_prot_msg_extension Message Interface Extension /// Sometimes the public interface of the messages, generated by the -/// @b Marshalling library out of available options passed to @ref nil::marshalling::Message, +/// @b Marshalling library out of available options passed to @ref nil::crypto3::marshalling::Message, /// may be insufficient for some applications and its interface needs to be extended /// with custom member functions. It is easy to achieve by /// just implementing required function in common message interface class @@ -2789,7 +2789,7 @@ /// >; /// /// using MyProtocolStack = my_protocol::ProtocolStack; -/// using MyHandler = nil::marshalling::generic_handler; +/// using MyHandler = nil::crypto3::marshalling::generic_handler; /// ... /// @endcode /// diff --git a/crypto3/libs/marshalling/core/example/endian.cpp b/crypto3/libs/marshalling/core/example/endian.cpp index a0bdd7ab4e..7080386547 100644 --- a/crypto3/libs/marshalling/core/example/endian.cpp +++ b/crypto3/libs/marshalling/core/example/endian.cpp @@ -50,7 +50,7 @@ #include #include -using namespace nil::marshalling; +using namespace nil::crypto3::marshalling; int main(int argc, char *argv[]) { status_type status; @@ -82,4 +82,4 @@ int main(int argc, char *argv[]) { assert(status == status_type::success); assert(out3 == res3); -} \ No newline at end of file +} diff --git a/crypto3/libs/marshalling/core/example/interfaces.cpp b/crypto3/libs/marshalling/core/example/interfaces.cpp index 6d5b67a5ac..0c10fba26a 100644 --- a/crypto3/libs/marshalling/core/example/interfaces.cpp +++ b/crypto3/libs/marshalling/core/example/interfaces.cpp @@ -49,7 +49,7 @@ #include #include -using namespace nil::marshalling; +using namespace nil::crypto3::marshalling; using T = std::vector; const std::vector in = {{0x1234, 0x5678}}; @@ -112,4 +112,4 @@ int main(int argc, char *argv[]) { std::cout << std::endl << "Result type as iterator parameter:" << std::endl; result_as_iterator_parameter(); -} \ No newline at end of file +} diff --git a/crypto3/libs/marshalling/core/example/pack.cpp b/crypto3/libs/marshalling/core/example/pack.cpp index c3ea0a844f..6a615d3868 100644 --- a/crypto3/libs/marshalling/core/example/pack.cpp +++ b/crypto3/libs/marshalling/core/example/pack.cpp @@ -50,7 +50,7 @@ #include #include -using namespace nil::marshalling; +using namespace nil::crypto3::marshalling; template void to_big_vector(T input) { @@ -59,7 +59,7 @@ void to_big_vector(T input) { const TOut out = {0x12345678}; TOut result = pack(input, status); - if (status == nil::marshalling::status_type::success && equal(result.begin(), result.end(), out.begin())) { + if (status == nil::crypto3::marshalling::status_type::success && equal(result.begin(), result.end(), out.begin())) { std::cout << "success" << std::endl; } else { std::cout << "fail" << std::endl; @@ -73,7 +73,7 @@ void to_small_vector(T input) { const TOut out = {0x12, 0x34, 0x56, 0x78}; TOut result = pack(input, status); - if (status == nil::marshalling::status_type::success && std::equal(result.begin(), result.end(), out.begin())) { + if (status == nil::crypto3::marshalling::status_type::success && std::equal(result.begin(), result.end(), out.begin())) { std::cout << "success" << std::endl; } else { std::cout << "fail" << std::endl; @@ -87,7 +87,7 @@ void to_big_array(T input) { const TOut out = {0x12345678}; TOut result = pack(input, status); - if (status == nil::marshalling::status_type::success && std::equal(result.begin(), result.end(), out.begin())) { + if (status == nil::crypto3::marshalling::status_type::success && std::equal(result.begin(), result.end(), out.begin())) { std::cout << "success" << std::endl; } else { std::cout << "fail" << std::endl; @@ -101,7 +101,7 @@ void to_small_array(T input) { TOut out = {0x12, 0x34, 0x56, 0x78}; TOut result = pack(input, status); - if (status == nil::marshalling::status_type::success && std::equal(result.begin(), result.end(), out.begin())) { + if (status == nil::crypto3::marshalling::status_type::success && std::equal(result.begin(), result.end(), out.begin())) { std::cout << "success" << std::endl; } else { std::cout << "fail" << std::endl; @@ -115,7 +115,7 @@ void to_type(T input) { TOut out = 0x12345678; TOut result = pack(input, status); - if (status == nil::marshalling::status_type::success && result == out) { + if (status == nil::crypto3::marshalling::status_type::success && result == out) { std::cout << "success" << std::endl; } else { std::cout << "fail" << std::endl; @@ -129,7 +129,7 @@ void to_marshalling_type(T input) { std::uint16_t out = 0x1234; TOut result = pack(input, status); - if (status == nil::marshalling::status_type::success && result.value() == out) { + if (status == nil::crypto3::marshalling::status_type::success && result.value() == out) { std::cout << "success" << std::endl; } else { std::cout << "fail" << std::endl; @@ -181,4 +181,4 @@ int main(int argc, char *argv[]) { to_different_types(type_in); std::cout << "From marshalling type to:" << std::endl; to_different_types(marshalling_type_in); -} \ No newline at end of file +} diff --git a/crypto3/libs/marshalling/core/include/nil/detail/type_traits.hpp b/crypto3/libs/marshalling/core/include/nil/detail/type_traits.hpp index 9873546cca..7c57066c01 100644 --- a/crypto3/libs/marshalling/core/include/nil/detail/type_traits.hpp +++ b/crypto3/libs/marshalling/core/include/nil/detail/type_traits.hpp @@ -34,6 +34,7 @@ #include #include +#ifndef GENERATE_HAS_MEMBER_TYPE #define GENERATE_HAS_MEMBER_TYPE(Type) \ template \ class HasMemberType_##Type { \ @@ -63,7 +64,9 @@ \ template \ struct has_##Type : public std::integral_constant::RESULT> { }; +#endif +#ifndef GENERATE_HAS_MEMBER #define GENERATE_HAS_MEMBER(member) \ template \ class HasMember_##member { \ @@ -93,7 +96,9 @@ \ template \ struct has_##member : public std::integral_constant::RESULT> { }; +#endif +#ifndef GENERATE_HAS_MEMBER_FUNCTION #define GENERATE_HAS_MEMBER_FUNCTION(Function, ...) \ \ template \ @@ -115,7 +120,9 @@ \ static bool const value = sizeof(f(0)) == 2; \ }; +#endif +#ifndef GENERATE_HAS_MEMBER_CONST_FUNCTION #define GENERATE_HAS_MEMBER_CONST_FUNCTION(Function, ...) \ \ template \ @@ -137,7 +144,9 @@ \ static bool const value = sizeof(f(0)) == 2; \ }; +#endif +#ifndef GENERATE_HAS_MEMBER_RETURN_FUNCTION #define GENERATE_HAS_MEMBER_RETURN_FUNCTION(Function, ReturnType, ...) \ \ template \ @@ -165,7 +174,9 @@ \ static bool const value = sizeof(f(0)) == 2; \ }; +#endif +#ifndef GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION #define GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(Function, ReturnType, ...) \ \ template \ @@ -193,8 +204,9 @@ \ static bool const value = sizeof(f(0)) == 2; \ }; +#endif -namespace nil { +namespace nil::crypto3::marshalling { namespace detail { GENERATE_HAS_MEMBER_TYPE(iterator) @@ -294,4 +306,4 @@ namespace nil { } // namespace detail } // namespace nil -#endif // NIL_DETAIL_TYPE_TRAITS_HPP \ No newline at end of file +#endif // NIL_DETAIL_TYPE_TRAITS_HPP diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/algorithms/pack.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/algorithms/pack.hpp index e114944a13..5a6f207318 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/algorithms/pack.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/algorithms/pack.hpp @@ -29,7 +29,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { /*! * @defgroup marshalling Marshalling @@ -60,7 +60,7 @@ namespace nil { */ template typename std::enable_if< - nil::detail::is_range::value, + detail::is_range::value, detail::range_repack_impl>::type pack(const SinglePassRange &val, status_type &status) { @@ -69,7 +69,7 @@ namespace nil { } template - typename std::enable_if::value, + typename std::enable_if::value, detail::value_repack_impl>::type pack(const TInput &val, status_type &status) { @@ -93,7 +93,7 @@ namespace nil { */ template typename std::enable_if< - nil::detail::is_iterator::value + detail::is_iterator::value && std::is_integral::value_type>::value, detail::range_repack_impl>::type pack(InputIterator first, InputIterator last, status_type &status) { @@ -102,7 +102,7 @@ namespace nil { } template - typename std::enable_if::value && nil::detail::is_iterator::value, + typename std::enable_if::value && detail::is_iterator::value, TOutputIterator>::type pack(const TInput &val, TOutputIterator out, status_type &status) { using T = typename std::iterator_traits::value_type; @@ -111,8 +111,8 @@ namespace nil { } template - typename std::enable_if::value - && nil::detail::is_iterator::value, + typename std::enable_if::value + && detail::is_iterator::value, TOutputIterator>::type pack(const SinglePassRange &rng_input, TOutputIterator out, status_type &status) { BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept)); @@ -122,8 +122,8 @@ namespace nil { } template - typename std::enable_if::value - && nil::detail::is_iterator::value, + typename std::enable_if::value + && detail::is_iterator::value, TOutputIterator>::type pack(InputIterator first, InputIterator last, TOutputIterator out, status_type &status) { using T = typename std::iterator_traits::value_type; @@ -132,7 +132,7 @@ namespace nil { } template - typename std::enable_if::value && nil::detail::is_range::value + typename std::enable_if::value && detail::is_range::value && std::is_constructible::const_iterator, typename std::vector::const_iterator>::value, @@ -147,7 +147,7 @@ namespace nil { } template - typename std::enable_if::value && nil::detail::is_range::value + typename std::enable_if::value && detail::is_range::value && !std::is_constructible::const_iterator, typename std::vector::const_iterator>::value, @@ -161,8 +161,8 @@ namespace nil { } template - typename std::enable_if::value - && nil::detail::is_range::value + typename std::enable_if::value + && detail::is_range::value && std::is_constructible::value, @@ -179,7 +179,7 @@ namespace nil { template typename std::enable_if< - nil::detail::is_range::value && nil::detail::is_range::value + detail::is_range::value && detail::is_range::value && !std::is_constructible< SinglePassRange2, typename std::vector::const_iterator, @@ -195,7 +195,7 @@ namespace nil { template typename std::enable_if< - nil::detail::is_iterator::value && nil::detail::is_range::value + detail::is_iterator::value && detail::is_range::value && std::is_constructible< SinglePassRange, typename std::vector::const_iterator, @@ -211,8 +211,8 @@ namespace nil { } template - typename std::enable_if::value - && nil::detail::is_range::value + typename std::enable_if::value + && detail::is_range::value && !std::is_constructible::value, @@ -225,8 +225,8 @@ namespace nil { } template - typename std::enable_if::value - && !(nil::detail::is_range::value || nil::detail::is_array::value) + typename std::enable_if::value + && !(detail::is_range::value || detail::is_array::value) && !std::is_same::value, status_type>::type pack(InputIterator first, InputIterator last, TOutput &rng_output) { @@ -237,8 +237,8 @@ namespace nil { } template - typename std::enable_if::value - && !(nil::detail::is_range::value || nil::detail::is_array::value) + typename std::enable_if::value + && !(detail::is_range::value || detail::is_array::value) && !std::is_same::value, status_type>::type pack(const SinglePassRange &rng_input, TOutput &rng_output) { @@ -249,7 +249,7 @@ namespace nil { } template - typename std::enable_if::value && nil::detail::is_iterator::value, + typename std::enable_if::value && detail::is_iterator::value, status_type>::type pack(const TInput &val, TOutputIterator out) { @@ -261,8 +261,8 @@ namespace nil { } template - typename std::enable_if::value - && nil::detail::is_iterator::value, + typename std::enable_if::value + && detail::is_iterator::value, status_type>::type pack(const SinglePassRange &rng_input, TOutputIterator out) { BOOST_RANGE_CONCEPT_ASSERT((boost::SinglePassRangeConcept)); @@ -274,8 +274,8 @@ namespace nil { } template - typename std::enable_if::value - && nil::detail::is_iterator::value, + typename std::enable_if::value + && detail::is_iterator::value, status_type>::type pack(InputIterator first, InputIterator last, TOutputIterator out) { using T = typename std::iterator_traits::value_type; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/assert_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/assert_type.hpp index 87359e5f3e..40d75e1846 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/assert_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/assert_type.hpp @@ -34,7 +34,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { /// @brief Base class for any custom assertion behaviour. @@ -103,7 +103,7 @@ namespace nil { /// assertion failure. /// @tparam TAssert Class derived from Assert that implements new custom /// behaviour of the assertion failure. - /// @pre TAssert class must be derived from nil::marshalling::assert_type. + /// @pre TAssert class must be derived from nil::crypto3::marshalling::assert_type. /// @headerfile nil/marshalling/assert_type.hpp template class enable_assert { @@ -154,7 +154,7 @@ namespace nil { #ifndef NOSTDLIB #define MARSHALLING_ASSERT_FAIL_FUNC(expr) assert(expr) #else // #ifndef NOSTDLIB -#define MARSHALLING_ASSERT_FAIL_FUNC(expr) nil::marshalling::assert_manager::instance().infinite_loop() +#define MARSHALLING_ASSERT_FAIL_FUNC(expr) nil::crypto3::marshalling::assert_manager::instance().infinite_loop() #endif // #ifndef NOSTDLIB /// @endcond @@ -167,8 +167,8 @@ namespace nil { /// @param expr Boolean expression #define MARSHALLING_ASSERT(expr) \ ((expr) ? static_cast(0) : \ - (nil::marshalling::assert_manager::instance().has_assert_registered() ? \ - nil::marshalling::assert_manager::instance().get_assert()->fail( \ + (nil::crypto3::marshalling::assert_manager::instance().has_assert_registered() ? \ + nil::crypto3::marshalling::assert_manager::instance().get_assert()->fail( \ #expr, __FILE__, __LINE__, MARSHALLING_ASSERT_FUNCTION_STR) : \ MARSHALLING_ASSERT_FAIL_FUNC(expr))) diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/container/array_view.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/container/array_view.hpp index f1c4752df5..7e1cb12f34 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/container/array_view.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/container/array_view.hpp @@ -24,7 +24,7 @@ //---------------------------------------------------------------------------// /// @file -/// @brief Contains nil::marshalling::container::array_view class. +/// @brief Contains nil::crypto3::marshalling::container::array_view class. #ifndef MARSHALLING_ARRAY_VIEW_HPP #define MARSHALLING_ARRAY_VIEW_HPP @@ -34,7 +34,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace container { @@ -271,9 +271,9 @@ namespace nil { namespace std { /// @brief Specializes the std::swap algorithm. - /// @related nil::marshalling::container::ArrayView + /// @related nil::crypto3::marshalling::container::ArrayView template - void swap(nil::marshalling::container::array_view &view1, nil::marshalling::container::array_view &view2) { + void swap(nil::crypto3::marshalling::container::array_view &view1, nil::crypto3::marshalling::container::array_view &view2) { view1.swap(view2); } diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_queue.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_queue.hpp index 039de509ba..8d1632d6a5 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_queue.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_queue.hpp @@ -43,7 +43,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace container { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_string.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_string.hpp index f90d2f2894..ae681a7bd9 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_string.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_string.hpp @@ -34,7 +34,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace container { namespace detail { @@ -1679,10 +1679,10 @@ namespace std { /// @brief Specializes the std::swap algorithm. /// @see Reference - /// @related nil::marshalling::container::static_string + /// @related nil::crypto3::marshalling::container::static_string template - void swap(nil::marshalling::container::static_string &str1, - nil::marshalling::container::static_string &str2) { + void swap(nil::crypto3::marshalling::container::static_string &str1, + nil::crypto3::marshalling::container::static_string &str2) { str1.swap(str2); } diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_vector.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_vector.hpp index b3b3d4f9b9..d568de30f8 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_vector.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/container/static_vector.hpp @@ -34,7 +34,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace container { namespace detail { @@ -1270,10 +1270,10 @@ namespace std { /// @brief Specializes the std::swap algorithm. /// @see Reference - /// @related nil::marshalling::container::static_vector + /// @related nil::crypto3::marshalling::container::static_vector template - void swap(nil::marshalling::container::static_vector &v1, - nil::marshalling::container::static_vector &v2) { + void swap(nil::crypto3::marshalling::container::static_vector &v1, + nil::crypto3::marshalling::container::static_vector &v2) { v1.swap(v2); } diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/container/string_view.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/container/string_view.hpp index ec0c2f0808..fa3bfebd3e 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/container/string_view.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/container/string_view.hpp @@ -24,7 +24,7 @@ //---------------------------------------------------------------------------// /// @file -/// @brief Contains nil::marshalling::container::string_view class. +/// @brief Contains nil::crypto3::marshalling::container::string_view class. #ifndef MARSHALLING_STRING_VIEW_HPP #define MARSHALLING_STRING_VIEW_HPP @@ -37,7 +37,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace container { @@ -604,8 +604,8 @@ namespace std { /// @brief Specializes the std::swap algorithm. /// @see Reference - /// @related nil::marshalling::container::string_view - inline void swap(nil::marshalling::container::string_view &str1, nil::marshalling::container::string_view &str2) { + /// @related nil::crypto3::marshalling::container::string_view + inline void swap(nil::crypto3::marshalling::container::string_view &str1, nil::crypto3::marshalling::container::string_view &str2) { str1.swap(str2); } diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/container/type_traits.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/container/type_traits.hpp index ff9a73e39f..280ff48bed 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/container/type_traits.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/container/type_traits.hpp @@ -28,7 +28,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace container { namespace detail { @@ -39,7 +39,7 @@ namespace nil { }; template - struct is_static_string> { + struct is_static_string> { static const bool value = true; }; @@ -49,23 +49,23 @@ namespace nil { }; template - struct is_static_vector> { + struct is_static_vector> { static const bool value = true; }; } // namespace detail /// @brief Compile time check whether the provided type is a variant of - /// @ref nil::marshalling::container::static_string - /// @related nil::marshalling::container::static_string + /// @ref nil::crypto3::marshalling::container::static_string + /// @related nil::crypto3::marshalling::container::static_string template static constexpr bool is_static_string() { return detail::is_static_string::value; } /// @brief Compile time check whether the provided type is a variant of - /// @ref nil::marshalling::container::static_vector - /// @related nil::marshalling::container::static_vector + /// @ref nil::crypto3::marshalling::container::static_vector + /// @related nil::crypto3::marshalling::container::static_vector template static constexpr bool is_static_vector() { return detail::is_static_vector::value; @@ -74,4 +74,4 @@ namespace nil { } // namespace marshalling } // namespace nil -#endif // MARSHALLING_CONTAINER_TYPE_TRAITS_HPP \ No newline at end of file +#endif // MARSHALLING_CONTAINER_TYPE_TRAITS_HPP diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/bits_access.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/bits_access.hpp index 4f546e6be8..af31a43c41 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/bits_access.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/bits_access.hpp @@ -38,9 +38,9 @@ #define MARSHALLING_AS_BITMASK_CONST_FUNC const Base& asBitmask() const #else // #ifdef MARSHALLING_MUST_DEFINE_BASE #define MARSHALLING_AS_BITMASK_FUNC \ - FUNC_AUTO_REF_RETURN(asBitmask, decltype(nil::marshalling::types::to_field_base(*this))) + FUNC_AUTO_REF_RETURN(asBitmask, decltype(nil::crypto3::marshalling::types::to_field_base(*this))) #define MARSHALLING_AS_BITMASK_CONST_FUNC \ - FUNC_AUTO_REF_RETURN_CONST(asBitmask, decltype(nil::marshalling::types::to_field_base(*this))) + FUNC_AUTO_REF_RETURN_CONST(asBitmask, decltype(nil::crypto3::marshalling::types::to_field_base(*this))) #endif // #ifdef MARSHALLING_MUST_DEFINE_BASE #define MARSHALLING_BIT_ACC_FUNC(f_, n_) \ diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/field_base.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/field_base.hpp index c35c95ebce..3a45fda3aa 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/field_base.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/field_base.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace detail { @@ -40,26 +40,26 @@ namespace nil { class field_base<> { protected: // Use big endian by default - using endian_type = nil::marshalling::endian::big_endian; + using endian_type = nil::crypto3::marshalling::endian::big_endian; // Use unsigned type by default for versioning using version_type = unsigned; }; template - class field_base, TOptions...> : public field_base { + class field_base, TOptions...> : public field_base { protected: using endian_type = TEndian; }; template - class field_base, TOptions...> : public field_base { + class field_base, TOptions...> : public field_base { protected: using version_type = T; }; template - class field_base : public field_base { }; + class field_base : public field_base { }; template class field_base, TOptions...> : public field_base { }; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/fields_access.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/fields_access.hpp index 3214d9b120..b0fb5cedbf 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/fields_access.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/fields_access.hpp @@ -47,9 +47,9 @@ #else // #ifdef MARSHALLING_MUST_DEFINE_BASE #define MARSHALLING_FIELD_VALUE_ACCESS_FUNC \ - FUNC_AUTO_REF_RETURN(value, decltype(nil::marshalling::types::to_field_base(*this).value())) + FUNC_AUTO_REF_RETURN(value, decltype(nil::crypto3::marshalling::types::to_field_base(*this).value())) #define MARSHALLING_FIELD_VALUE_ACCESS_CONST_FUNC \ - FUNC_AUTO_REF_RETURN_CONST(value, decltype(nil::marshalling::types::to_field_base(*this).value())) + FUNC_AUTO_REF_RETURN_CONST(value, decltype(nil::crypto3::marshalling::types::to_field_base(*this).value())) #define MARSHALLING_ACCESS_MEMBER_FIELD_FUNC(T_, t_, n_) \ FUNC_AUTO_REF_RETURN(MARSHALLING_CONCATENATE(field_, n_), \ decltype(std::get(t_))) @@ -57,9 +57,9 @@ FUNC_AUTO_REF_RETURN_CONST(MARSHALLING_CONCATENATE(field_, n_), \ decltype(std::get(t_))) #define MARSHALLING_MSG_FIELDS_ACCESS_FUNC \ - FUNC_AUTO_REF_RETURN(fields, decltype(nil::marshalling::to_message_base(*this).fields())) + FUNC_AUTO_REF_RETURN(fields, decltype(nil::crypto3::marshalling::to_message_base(*this).fields())) #define MARSHALLING_MSG_FIELDS_ACCESS_CONST_FUNC \ - FUNC_AUTO_REF_RETURN_CONST(fields, decltype(nil::marshalling::to_message_base(*this).fields())) + FUNC_AUTO_REF_RETURN_CONST(fields, decltype(nil::crypto3::marshalling::to_message_base(*this).fields())) #endif // #ifdef MARSHALLING_MUST_DEFINE_BASE #define MARSHALLING_FIELD_ACC_FUNC(T_, t_, n_) \ diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/pack_value.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/pack_value.hpp index 6d8816c754..aa6e5eabf9 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/pack_value.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/pack_value.hpp @@ -43,7 +43,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace detail { @@ -92,7 +92,7 @@ namespace nil { template::template type<>>::value>::type> + !detail::is_container::template type<>>::value>::type> inline operator std::array() { return similar_std_array_marshalling>(); @@ -100,7 +100,7 @@ namespace nil { template::template type<>>::value>::type> + !detail::is_container::template type<>>::value>::type> inline operator boost::array() { return similar_std_array_marshalling>(); @@ -117,7 +117,7 @@ namespace nil { } template::value>::type, - typename = typename std::enable_if::template type<>>::value>::type> inline operator TOutput() const { using marshalling_type = typename is_compatible::template type; @@ -131,8 +131,8 @@ namespace nil { template::value && !is_marshalling_type::value - && !nil::marshalling::is_container::value && !is_marshalling_type::value + && !nil::crypto3::marshalling::is_container::template type<>>::value>::type> inline operator OutputRange() { using T = typename OutputRange::value_type; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/repack_value.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/repack_value.hpp index ec83e70374..fef7255109 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/repack_value.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/repack_value.hpp @@ -44,7 +44,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace detail { @@ -60,7 +60,7 @@ namespace nil { template::value && is_marshalling_type::value - && !nil::marshalling::is_supported_representation_type::value>::type> + && !nil::crypto3::marshalling::is_supported_representation_type::value>::type> inline operator T() { status_type status_unpack, status_pack; std::vector buffer = value_unpack_impl(input, status_unpack); @@ -75,7 +75,7 @@ namespace nil { template::value && !is_marshalling_type::value - && !nil::marshalling::is_supported_representation_type::value>::type, + && !nil::crypto3::marshalling::is_supported_representation_type::value>::type, bool Enable = true> inline operator T() { status_type status_unpack, status_pack; @@ -93,7 +93,7 @@ namespace nil { template::value && !is_marshalling_type::value - && nil::marshalling::is_supported_representation_type::value>::type, + && nil::crypto3::marshalling::is_supported_representation_type::value>::type, bool Enable1 = true, bool Enable2 = true> inline operator T() { status_type status_unpack; @@ -109,7 +109,7 @@ namespace nil { template::value && is_marshalling_type::value - && nil::marshalling::is_supported_representation_type::value>::type, + && nil::crypto3::marshalling::is_supported_representation_type::value>::type, bool Enable1 = true, bool Enable2 = true, bool Enable3 = true> inline operator T() { status_type status_unpack; @@ -146,7 +146,7 @@ namespace nil { template::value - && nil::marshalling::is_supported_representation_type::value>::type> + && nil::crypto3::marshalling::is_supported_representation_type::value>::type> inline operator T() { T result = range_pack_impl(iterator, count_elements, status_pack); @@ -157,9 +157,9 @@ namespace nil { template::value - && !nil::marshalling::is_supported_representation_type::value - && (nil::marshalling::is_supported_representation_type::value - || nil::marshalling::is_supported_representation_type< + && !nil::crypto3::marshalling::is_supported_representation_type::value + && (nil::crypto3::marshalling::is_supported_representation_type::value + || nil::crypto3::marshalling::is_supported_representation_type< typename T::value_type>::value)>::type, bool Enable = true> inline operator T() { @@ -171,8 +171,8 @@ namespace nil { template::value - && !nil::marshalling::is_supported_representation_type::value - && !nil::marshalling::is_supported_representation_type::value>::type, + && !nil::crypto3::marshalling::is_supported_representation_type::value + && !nil::crypto3::marshalling::is_supported_representation_type::value>::type, bool Enable1 = true, bool Enable2 = true> inline operator T() { std::vector buffer @@ -211,7 +211,7 @@ namespace nil { template::value - && nil::marshalling::is_supported_representation_type< + && nil::crypto3::marshalling::is_supported_representation_type< typename std::iterator_traits::value_type>::value>::type> inline operator T() { status_type status_pack; @@ -226,8 +226,8 @@ namespace nil { template::value - && !nil::marshalling::is_supported_representation_type::value - && nil::marshalling::is_supported_representation_type::value>::type, + && !nil::crypto3::marshalling::is_supported_representation_type::value + && nil::crypto3::marshalling::is_supported_representation_type::value>::type, bool Enable = true> inline operator T() { status_type status_unpack; @@ -242,7 +242,7 @@ namespace nil { template::value - && !nil::marshalling::is_supported_representation_type< + && !nil::crypto3::marshalling::is_supported_representation_type< typename std::iterator_traits::value_type>::value>::type, bool Enable1 = true, bool Enable2 = true> inline operator T() { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/transport_fields_access.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/transport_fields_access.hpp index 98654d55d3..ed240804cb 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/transport_fields_access.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/transport_fields_access.hpp @@ -52,9 +52,9 @@ FUNC_AUTO_REF_RETURN_CONST(MARSHALLING_CONCATENATE(transportField_, n_), \ decltype(std::get(t_))) #define MARSHALLING_MSG_TRANSPORT_FIELDS_ACCESS_FUNC \ - FUNC_AUTO_REF_RETURN(transport_fields, decltype(nil::marshalling::to_message(*this).transport_fields())) + FUNC_AUTO_REF_RETURN(transport_fields, decltype(nil::crypto3::marshalling::to_message(*this).transport_fields())) #define MARSHALLING_MSG_TRANSPORT_FIELDS_ACCESS_CONST_FUNC \ - FUNC_AUTO_REF_RETURN_CONST(transport_fields, decltype(nil::marshalling::to_message(*this).transport_fields())) + FUNC_AUTO_REF_RETURN_CONST(transport_fields, decltype(nil::crypto3::marshalling::to_message(*this).transport_fields())) #endif // #ifdef MARSHALLING_MUST_DEFINE_BASE #define MARSHALLING_TRANSPORT_FIELD_ACC_FUNC(T_, t_, n_) \ diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/unpack_value.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/unpack_value.hpp index a35579e664..c4a6a6eb60 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/unpack_value.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/unpack_value.hpp @@ -43,7 +43,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace detail { @@ -139,7 +139,7 @@ namespace nil { // using marshalling_vector = typename // std::conditional::fixed_size, - // nil::marshalling::container::static_vector, std::vector>::type; using marshalling_vector = std::vector; marshalling_vector values; @@ -171,7 +171,7 @@ namespace nil { // using marshalling_vector = typename // std::conditional::fixed_size, - // nil::marshalling::container::static_vector, std::vector>::type; using marshalling_vector = std::vector; marshalling_vector values; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/variant_access.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/variant_access.hpp index df4cea31d1..ea7b01523f 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/detail/variant_access.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/detail/variant_access.hpp @@ -48,9 +48,9 @@ #else // #ifdef MARSHALLING_MUST_DEFINE_BASE #define MARSHALLING_AS_VARIANT_FUNC \ - FUNC_AUTO_REF_RETURN(as_variant, decltype(nil::marshalling::types::to_field_base(*this))) + FUNC_AUTO_REF_RETURN(as_variant, decltype(nil::crypto3::marshalling::types::to_field_base(*this))) #define MARSHALLING_AS_VARIANT_CONST_FUNC \ - FUNC_AUTO_REF_RETURN_CONST(as_variant, decltype(nil::marshalling::types::to_field_base(*this))) + FUNC_AUTO_REF_RETURN_CONST(as_variant, decltype(nil::crypto3::marshalling::types::to_field_base(*this))) #define MARSHALLING_VARIANT_INIT_FIELD_FUNC(v_, n_) \ FUNC_ARGS_AUTO_REF_RETURN( \ MARSHALLING_CONCATENATE(initField_, n_), TArgs&&... args, \ diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/endianness.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/endianness.hpp index ae202e4384..9bb878c44e 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/endianness.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/endianness.hpp @@ -34,7 +34,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace endian { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/field_cast.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/field_cast.hpp index dd90b875be..2d7ee1698d 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/field_cast.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/field_cast.hpp @@ -36,7 +36,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace detail { template diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/field_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/field_type.hpp index 913b2bd0cd..5eaea1cac1 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/field_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/field_type.hpp @@ -24,7 +24,7 @@ //---------------------------------------------------------------------------// /// @file -/// @brief Contains definition of @ref nil::marshalling::field_type class. +/// @brief Contains definition of @ref nil::crypto3::marshalling::field_type class. #ifndef MARSHALLING_FIELD_TYPE_HPP #define MARSHALLING_FIELD_TYPE_HPP @@ -36,13 +36,13 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { /// @brief Base class to all the field classes. /// @details Every custom "field" class should inherit from this one. /// @tparam TOptions Zero or more options. The supported options are: - /// @li nil::marshalling::option::big_endian or nil::marshalling::option::little_endian - Option to + /// @li nil::crypto3::marshalling::option::big_endian or nil::crypto3::marshalling::option::little_endian - Option to /// specify serialization endian. If none is provided big endian is /// assumed. /// @headerfile nil/marshalling/field_type.hpp @@ -52,8 +52,8 @@ namespace nil { public: /// @brief endian_type type - /// @details Equal to either @ref nil::marshalling::endian::big_endian or - /// @ref nil::marshalling::endian::little_endian + /// @details Equal to either @ref nil::crypto3::marshalling::endian::big_endian or + /// @ref nil::crypto3::marshalling::endian::little_endian using endian_type = typename base_impl_type::endian_type; /// @brief Version type @@ -166,21 +166,21 @@ namespace nil { }; /// @brief Add convenience access enum and functions to the members of -/// bundle fields, such as nil::marshalling::types::bundle or nil::marshalling::types::bitfield. -/// @details The fields of "bundle" types, such as nil::marshalling::types::bundle or -/// nil::marshalling::types::bitfield keep their members bundled in +/// bundle fields, such as nil::crypto3::marshalling::types::bundle or nil::crypto3::marshalling::types::bitfield. +/// @details The fields of "bundle" types, such as nil::crypto3::marshalling::types::bundle or +/// nil::crypto3::marshalling::types::bitfield keep their members bundled in /// std::tuple /// and provide access to them via @b value() member functions. /// The access to the specific member field can be obtained using /// std::get /// later on: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using ... Field1; /// using ... Field2; /// using ... Field3; /// using MyField = -/// nil::marshalling::types::bitfield< +/// nil::crypto3::marshalling::types::bitfield< /// MyFieldBase, /// std::tuple /// >; @@ -197,7 +197,7 @@ namespace nil { /// the "bundle" field and use the macro inside with the names for the /// member fields: /// @code -/// class MyField : public nil::marshalling::types::bitfield<...> +/// class MyField : public nil::crypto3::marshalling::types::bitfield<...> /// { /// public: /// MARSHALLING_FIELD_MEMBERS_ACCESS(member1, member2, member3); @@ -206,7 +206,7 @@ namespace nil { /// It would be equivalent to having the following types and functions /// definitions: /// @code -/// class MyField : public nil::marshalling::types::bitfield<...> +/// class MyField : public nil::crypto3::marshalling::types::bitfield<...> /// { /// public: /// // Access indices for member fields @@ -262,7 +262,7 @@ namespace nil { /// /// See @ref sec_field_tutorial_bitfield for more examples and details /// @param[in] ... List of member fields' names. -/// @related nil::marshalling::types::bitfield +/// @related nil::crypto3::marshalling::types::bitfield /// @warning Some compilers, such as @b clang or early versions of @b g++ /// may have problems compiling code generated by this macro even /// though it uses valid C++11 constructs in attempt to automatically identify the @@ -271,11 +271,11 @@ namespace nil { /// @ref MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE() macro instead. In /// case this macro needs to reside inside a @b template class, then /// there is a need to define inner @b Base type, which specifies -/// exact type of the @ref nil::marshalling::types::bitfield class. For example: +/// exact type of the @ref nil::crypto3::marshalling::types::bitfield class. For example: /// @code /// template /// class MyField : public -/// nil::marshalling::types::bitfield< +/// nil::crypto3::marshalling::types::bitfield< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -283,7 +283,7 @@ namespace nil { /// { /// // Define type of the base class /// using Base = -/// nil::marshalling::types::bitfield< +/// nil::crypto3::marshalling::types::bitfield< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -295,14 +295,14 @@ namespace nil { #define MARSHALLING_FIELD_MEMBERS_ACCESS(...) \ MARSHALLING_EXPAND(MARSHALLING_DEFINE_FIELD_ENUM(__VA_ARGS__)) \ MARSHALLING_FIELD_VALUE_ACCESS_FUNC { \ - auto &val = nil::marshalling::types::to_field_base(*this).value(); \ + auto &val = nil::crypto3::marshalling::types::to_field_base(*this).value(); \ using AllFieldsTuple = typename std::decay::type; \ static_assert(std::tuple_size::value == FieldIdx_numOfValues, \ "Invalid number of names for fields tuple"); \ return val; \ } \ MARSHALLING_FIELD_VALUE_ACCESS_CONST_FUNC { \ - auto &val = nil::marshalling::types::to_field_base(*this).value(); \ + auto &val = nil::crypto3::marshalling::types::to_field_base(*this).value(); \ using AllFieldsTuple = typename std::decay::type; \ static_assert(std::tuple_size::value == FieldIdx_numOfValues, \ "Invalid number of names for fields tuple"); \ @@ -319,28 +319,28 @@ namespace nil { /// compilation fails and the class it is being used in is @b NOT a /// template one, please use @ref MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE() /// instead. -/// @related nil::marshalling::types::bitfield +/// @related nil::crypto3::marshalling::types::bitfield #define MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE(...) \ MARSHALLING_EXPAND(MARSHALLING_DEFINE_FIELD_ENUM(__VA_ARGS__)) \ MARSHALLING_EXPAND(MARSHALLING_DO_FIELD_ACC_FUNC_NOTEMPLATE(__VA_ARGS__)) #ifdef FOR_DOXYGEN_DOC_ONLY /// @brief Add convenience access enum and functions to the members of - /// bundle fields, such as nil::marshalling::types::bundle or nil::marshalling::types::bitfield. - /// @detail The fields of "bundle" types, such as nil::marshalling::types::bundle or - /// nil::marshalling::types::bitfield keep their members bundled in + /// bundle fields, such as nil::crypto3::marshalling::types::bundle or nil::crypto3::marshalling::types::bitfield. + /// @detail The fields of "bundle" types, such as nil::crypto3::marshalling::types::bundle or + /// nil::crypto3::marshalling::types::bitfield keep their members bundled in /// std::tuple /// and provide access to them via @b value() member functions. /// The access to the specific member field can be obtained using /// std::get /// later on: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using ... Field1; /// using ... Field2; /// using ... Field3; /// using MyField = - /// nil::marshalling::types::bundle< + /// nil::crypto3::marshalling::types::bundle< /// MyFieldBase, /// std::tuple /// >; @@ -357,7 +357,7 @@ namespace nil { /// the "bundle" field and use the macro inside with names for the /// member fields: /// @code - /// class MyField : public nil::marshalling::types::bundle<...> + /// class MyField : public nil::crypto3::marshalling::types::bundle<...> /// { /// public: /// MARSHALLING_FIELD_MEMBERS_ACCESS(member1, member2, member3); @@ -366,7 +366,7 @@ namespace nil { /// It would be equivalent to having the following types and functions /// definitions: /// @code - /// class MyField : public nil::marshalling::types::bundle<...> + /// class MyField : public nil::crypto3::marshalling::types::bundle<...> /// { /// public: /// // Access indices for member fields @@ -422,7 +422,7 @@ namespace nil { /// /// See @ref sec_field_tutorial_bundle for more examples and detail /// @param[in] ... List of member fields' names. - /// @related nil::marshalling::types::bundle + /// @related nil::crypto3::marshalling::types::bundle /// @warning Some compilers, such as @b clang or early versions of @b g++ /// may have problems compiling code generated by this macro even /// though it uses valid C++11 constructs in attempt to automatically identify the @@ -431,11 +431,11 @@ namespace nil { /// @ref MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE() macro instead. In /// case this macro needs to reside inside a @b template class, then /// there is a need to define inner @b Base type, which specifies - /// exact type of the @ref nil::marshalling::types::bundle class. For example: + /// exact type of the @ref nil::crypto3::marshalling::types::bundle class. For example: /// @code /// template /// class MyField : public - /// nil::marshalling::types::bundle< + /// nil::crypto3::marshalling::types::bundle< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -443,7 +443,7 @@ namespace nil { /// { /// // Define type of the base class /// using Base = - /// nil::marshalling::types::bundle< + /// nil::crypto3::marshalling::types::bundle< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -463,7 +463,7 @@ namespace nil { /// compilation fails and the class it is being used in is @b NOT a /// template one, please use @ref MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE() /// instead. - /// @related nil::marshalling::types::bundle + /// @related nil::crypto3::marshalling::types::bundle #define MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE(...) \ MARSHALLING_EXPAND(MARSHALLING_DEFINE_FIELD_ENUM(__VA_ARGS__)) \ MARSHALLING_EXPAND(MARSHALLING_DO_FIELD_ACC_FUNC_NOTEMPLATE(__VA_ARGS__)) diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/inference.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/inference.hpp index c57e92ebfa..aeba60366c 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/inference.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/inference.hpp @@ -34,7 +34,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { template @@ -104,4 +104,4 @@ namespace nil { } // namespace marshalling } // namespace nil -#endif // MARSHALLING_INFERENCE_TYPE_TRAITS_HPP \ No newline at end of file +#endif // MARSHALLING_INFERENCE_TYPE_TRAITS_HPP diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/marshalling_state.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/marshalling_state.hpp index b5829c04ba..1c8185a033 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/marshalling_state.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/marshalling_state.hpp @@ -32,7 +32,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { template #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { // We cannot include integral.hpp, it includes this file. So just declare the class. @@ -72,39 +72,39 @@ namespace nil { // message/field_t common options /// @brief options to specify endian. - /// @tparam TEndian endian_type type. Must be either nil::marshalling::endian::big_endian or - /// nil::marshalling::endian::little_endian. + /// @tparam TEndian endian_type type. Must be either nil::crypto3::marshalling::endian::big_endian or + /// nil::crypto3::marshalling::endian::little_endian. /// @headerfile nil/marshalling/options.hpp template struct endian { }; /// @brief Alias option to endian_type specifying big endian. /// @headerfile nil/marshalling/options.hpp - using big_endian = endian; + using big_endian = endian; /// @brief Alias option to endian_type specifying little endian. /// @headerfile nil/marshalling/options.hpp - using little_endian = endian; + using little_endian = endian; /// @brief No-op option, doesn't have any effect. /// @headerfile nil/marshalling/options.hpp struct empty_option { }; /// @brief Option used to specify number of bytes that is used for field serialization. - /// @details Applicable only to numeric fields, such as nil::marshalling::types::integral or - /// nil::marshalling::types::enumeration. + /// @details Applicable only to numeric fields, such as nil::crypto3::marshalling::types::integral or + /// nil::crypto3::marshalling::types::enumeration. /// /// For example, protocol specifies that some field is serialized using /// only 3 bytes. There is no basic integral type that takes 3 bytes /// of space exactly. The closest alternative is std::int32_t or /// std::uint32_t. Such field may be defined as: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::integral< + /// nil::crypto3::marshalling::types::integral< /// MyFieldBase, /// std::uint32_t, - /// nil::marshalling::option::fixed_length<3> + /// nil::crypto3::marshalling::option::fixed_length<3> /// >; /// @endcode /// @tparam TLen length of the serialized value. @@ -114,25 +114,25 @@ namespace nil { struct fixed_length { }; /// @brief Option used to specify number of bits that is used for field serialization - /// when a field is a member of nil::marshalling::types::bitfield. + /// when a field is a member of nil::crypto3::marshalling::types::bitfield. /// @details For example, the protocol specifies that two independent integer /// values of 6 and 10 bits respectively packed into two bytes to save space. /// Such combined field may be defined as: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::bitfield< + /// nil::crypto3::marshalling::types::bitfield< /// MyFieldBase, /// std::tuple< - /// nil::marshalling::types::integral< + /// nil::crypto3::marshalling::types::integral< /// MyFieldBase, /// std::uint8_t, - /// nil::marshalling::option::fixed_bit_length<6> + /// nil::crypto3::marshalling::option::fixed_bit_length<6> /// >, - /// nil::marshalling::types::integral< + /// nil::crypto3::marshalling::types::integral< /// MyFieldBase, /// std::uint16_t, - /// nil::marshalling::option::fixed_bit_length<10> + /// nil::crypto3::marshalling::option::fixed_bit_length<10> /// > /// > /// >; @@ -143,8 +143,8 @@ namespace nil { struct fixed_bit_length { }; /// @brief Option used to specify that field may have variable serialization length - /// @details Applicable only to numeric fields, such as nil::marshalling::types::integral - /// or nil::marshalling::types::enumeration. + /// @details Applicable only to numeric fields, such as nil::crypto3::marshalling::types::integral + /// or nil::crypto3::marshalling::types::enumeration. /// Use this option to specify that serialized value has /// Base-128 /// encoding, i.e. the most significant bit in the byte indicates whether @@ -153,12 +153,12 @@ namespace nil { /// which value can be serialized using between 1 and 4 bytes can be /// defined as: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::integral< + /// nil::crypto3::marshalling::types::integral< /// MyFieldBase, /// std::uint32_t, - /// nil::marshalling::option::var_length<1, 4> + /// nil::crypto3::marshalling::option::var_length<1, 4> /// >; /// @endcode /// @tparam TMin Minimal length the field may consume. @@ -171,8 +171,8 @@ namespace nil { }; /// @brief Option to specify numeric value serialization offset. - /// @details Applicable only to numeric fields such as nil::marshalling::types::integral or - /// nil::marshalling::types::enumeration. + /// @details Applicable only to numeric fields such as nil::crypto3::marshalling::types::integral or + /// nil::crypto3::marshalling::types::enumeration. /// The provided value will be added to the field's value and the /// result will be written to the buffer when serialising. Good example /// for such option would be serialising a "current year" value. Most protocols @@ -180,21 +180,21 @@ namespace nil { /// single byte, i.e. to specify year 2015 is to write value 15. /// However it may be inconvenient to manually adjust serialized/deserialized /// value by predefined offset 2000. To help with such case option - /// nil::marshalling::option::num_value_ser_offset can be used. For example: + /// nil::crypto3::marshalling::option::num_value_ser_offset can be used. For example: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::integral< + /// nil::crypto3::marshalling::types::integral< /// MyFieldBase, /// std::uint16_t, - /// nil::marshalling::option::fixed_length<1>, - /// nil::marshalling::option::num_value_ser_offset<-2000> + /// nil::crypto3::marshalling::option::fixed_length<1>, + /// nil::crypto3::marshalling::option::num_value_ser_offset<-2000> /// >; /// @endcode /// Note that in the example above the field value (accessible by @b value() member /// function of the field) will have type std::uint16_t and will be equal to /// say 2015, while when serialized it consumes only 1 byte (thanks to - /// nil::marshalling::option::fixed_length option) and reduced value of 15 is written. + /// nil::crypto3::marshalling::option::fixed_length option) and reduced value of 15 is written. /// @tparam TOffset Offset value to be added when serialising field. /// @headerfile nil/marshalling/options.hpp template @@ -203,54 +203,54 @@ namespace nil { /// @brief Option that forces usage of embedded uninitialised data area instead /// of dynamic memory allocation. /// @details Applicable to fields that represent collection of raw data or other - /// fields, such as nil::marshalling::types::array_list or nil::marshalling::types::string. By + /// fields, such as nil::crypto3::marshalling::types::array_list or nil::crypto3::marshalling::types::string. By /// default, these fields will use /// std::vector or /// std::string /// for their internal data storage. If this option is used, it will force - /// such fields to use @ref nil::marshalling::container::static_vector or @ref - /// nil::marshalling::container::static_string with the capacity provided by this option. + /// such fields to use @ref nil::crypto3::marshalling::container::static_vector or @ref + /// nil::crypto3::marshalling::container::static_string with the capacity provided by this option. /// @tparam TSize Size of the storage area in number of elements, for strings it does @b NOT include /// the '\0' terminating character. /// @headerfile nil/marshalling/options.hpp template struct fixed_size_storage { }; - /// @brief Set custom storage type for fields like nil::marshalling::types::string or - /// nil::marshalling::types::array_list. - /// @details By default nil::marshalling::types::string uses + /// @brief Set custom storage type for fields like nil::crypto3::marshalling::types::string or + /// nil::crypto3::marshalling::types::array_list. + /// @details By default nil::crypto3::marshalling::types::string uses /// std::string - /// and nil::marshalling::types::array_list uses + /// and nil::crypto3::marshalling::types::array_list uses /// std::vector as /// their internal storage types. The @ref fixed_size_storage option forces - /// them to use nil::marshalling::container::static_string and - /// nil::marshalling::container::static_vector instead. This option can be used to provide any other + /// them to use nil::crypto3::marshalling::container::static_string and + /// nil::crypto3::marshalling::container::static_vector instead. This option can be used to provide any other /// third party type. Such type must define the same public interface as @b std::string (when used with - /// nil::marshalling::types::string) or @b std::vector (when used with - /// nil::marshalling::types::array_list). + /// nil::crypto3::marshalling::types::string) or @b std::vector (when used with + /// nil::crypto3::marshalling::types::array_list). /// @tparam TType Custom storage type /// @headerfile nil/marshalling/options.hpp template struct custom_storage_type { }; /// @brief Option to specify scaling ratio. - /// @details Applicable only to nil::marshalling::types::integral. + /// @details Applicable only to nil::crypto3::marshalling::types::integral. /// Sometimes the protocol specifies values being transmitted in /// one units while when handling the message they are better to be handled /// in another. For example, some distance information is transmitted as /// integer value of millimetres, but while processing it should be handled as floating /// point value of meters. Such field is defined as: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::integral< + /// nil::crypto3::marshalling::types::integral< /// MyFieldBase, /// std::int32_t, - /// nil::marshalling::option::scaling_ratio<1, 100> + /// nil::crypto3::marshalling::option::scaling_ratio<1, 100> /// >; /// @endcode /// Then, to accessed the scaled value of the field use @b scale_as() or - /// @b set_scaled() methods of nil::marshalling::types::integral field: + /// @b set_scaled() methods of nil::crypto3::marshalling::types::integral field: /// @code /// void processField(const MyField& field) /// { @@ -273,17 +273,17 @@ namespace nil { /// prepended with one or more bytes indicating number of elements that will /// follow. /// Applicable to fields that represent collection of raw data or other - /// fields, such as nil::marshalling::types::array_list or nil::marshalling::types::string.@n + /// fields, such as nil::crypto3::marshalling::types::array_list or nil::crypto3::marshalling::types::string.@n /// For example sequence of raw bytes must be prefixed with 2 bytes stating /// the size of the sequence: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::array_list< + /// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// std::uint8_t, - /// nil::marshalling::option::sequence_size_field_prefix< - /// nil::marshalling::types::integral + /// nil::crypto3::marshalling::option::sequence_size_field_prefix< + /// nil::crypto3::marshalling::types::integral /// > /// >; /// @endcode @@ -294,7 +294,7 @@ namespace nil { template using size_t_sequence_size_field_prefix = sequence_size_field_prefix< - nil::marshalling::types::integral>; + nil::crypto3::marshalling::types::integral>; /// @brief Option that modifies the default behaviour of collection fields to /// prepend the serialized data with number of @b bytes information. @@ -302,18 +302,18 @@ namespace nil { /// number of @b elements to follow, the prefix field contains number of /// @b bytes that will follow. /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::array_list< + /// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, - /// nil::marshalling::types::bundle< + /// nil::crypto3::marshalling::types::bundle< /// std::tuple< - /// nil::marshalling::types::integral, - /// nil::marshalling::types::string + /// nil::crypto3::marshalling::types::integral, + /// nil::crypto3::marshalling::types::string /// > /// >, - /// nil::marshalling::option::sequence_ser_length_field_prefix< - /// nil::marshalling::types::integral + /// nil::crypto3::marshalling::option::sequence_ser_length_field_prefix< + /// nil::crypto3::marshalling::types::integral /// > /// >; /// @endcode @@ -324,7 +324,7 @@ namespace nil { status_type TReadErrorStatus = status_type::invalid_msg_data> struct sequence_ser_length_field_prefix { }; - /// @brief Option that forces every element of @ref nil::marshalling::types::array_list to + /// @brief Option that forces every element of @ref nil::crypto3::marshalling::types::array_list to /// be prefixed with its serialization length. /// @details Similar to @ref sequence_ser_length_field_prefix but instead of the whole /// list, every element is prepended with its serialization length. @@ -335,7 +335,7 @@ namespace nil { status_type TReadErrorStatus = status_type::invalid_msg_data> struct sequence_elem_ser_length_field_prefix { }; - /// @brief Option that forces @b first element only of @ref nil::marshalling::types::array_list to + /// @brief Option that forces @b first element only of @ref nil::crypto3::marshalling::types::array_list to /// be prefixed with its serialization length. /// @details Similar to @ref sequence_elem_ser_length_field_prefix, but /// applicable only to the lists where elements are of the same @@ -354,13 +354,13 @@ namespace nil { /// prefixing them with their size. Below is an example of how to achieve /// such termination using sequence_termination_field_suffix option. /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::string< + /// nil::crypto3::marshalling::types::string< /// MyFieldBase, - /// nil::marshalling::option::sequence_termination_field_suffix< - /// nil::marshalling::types::integral > + /// nil::crypto3::marshalling::option::sequence_termination_field_suffix< + /// nil::crypto3::marshalling::types::integral > /// > /// >; /// @endcode @@ -378,14 +378,14 @@ namespace nil { /// occupies exactly 6 bytes when serialized (padded with zeroes at the end) /// will be defined like this: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::string< + /// nil::crypto3::marshalling::types::string< /// MyFieldBase, - /// nil::marshalling::option::sequence_fixed_size<5>, - /// nil::marshalling::option::sequence_trailing_field_suffix< - /// nil::marshalling::types::integral > + /// nil::crypto3::marshalling::option::sequence_fixed_size<5>, + /// nil::crypto3::marshalling::option::sequence_trailing_field_suffix< + /// nil::crypto3::marshalling::types::integral > /// > /// >; /// @endcode @@ -401,8 +401,8 @@ namespace nil { /// impossible to use @ref sequence_size_field_prefix option. Instead, the size /// information must be provided by external calls. Usage of this option /// enables @b force_read_elem_count() and @b clear_read_elem_count() functions in - /// the collection fields, such as nil::marshalling::types::array_list or - /// nil::marshalling::types::string which can be used to specify the size information after it was read + /// the collection fields, such as nil::crypto3::marshalling::types::array_list or + /// nil::crypto3::marshalling::types::string which can be used to specify the size information after it was read /// independently. /// @headerfile nil/marshalling/options.hpp struct sequence_size_forcing_enabled { }; @@ -415,8 +415,8 @@ namespace nil { /// impossible to use @ref sequence_ser_length_field_prefix option. Instead, the length /// information must be provided by external calls. Usage of this option /// enables @b force_read_length() and @b clear_read_length_forcing() functions in - /// the collection fields, such as nil::marshalling::types::array_list or - /// nil::marshalling::types::string which can be used to specify the size information after it was read + /// the collection fields, such as nil::crypto3::marshalling::types::array_list or + /// nil::crypto3::marshalling::types::string which can be used to specify the size information after it was read /// independently. /// @headerfile nil/marshalling/options.hpp struct sequence_length_forcing_enabled { }; @@ -427,7 +427,7 @@ namespace nil { /// length of a single element in addition to the number of elements /// in the list. Usage of this option /// enables @b force_read_elem_length() and @b clear_read_elem_length_forcing() functions in - /// the nil::marshalling::types::array_list + /// the nil::crypto3::marshalling::types::array_list /// which can be used to specify the element serialization length after it was read /// independently. @n /// @headerfile nil/marshalling/options.hpp @@ -445,7 +445,7 @@ namespace nil { /// @brief Option that forces usage of fixed size storage for sequences with fixed /// size. /// @details Equivalent to @ref fixed_size_storage option, but applicable only - /// to sequence types @ref nil::marshalling::types::array_list or @ref nil::marshalling::types::string, + /// to sequence types @ref nil::crypto3::marshalling::types::array_list or @ref nil::crypto3::marshalling::types::string, /// that alrady use @ref sequence_fixed_size option. Usage of this option do not require knowledge of /// the storage area size. /// @headerfile nil/marshalling/options.hpp @@ -476,11 +476,11 @@ namespace nil { /// } /// }; /// - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::string< + /// nil::crypto3::marshalling::types::string< /// MyFieldBase, - /// nil::marshalling::option::default_value_initializer + /// nil::crypto3::marshalling::option::default_value_initializer /// >; /// @endcode /// @tparam T Type of the initializer class. @@ -516,16 +516,16 @@ namespace nil { /// } /// }; /// - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::string< + /// nil::crypto3::marshalling::types::string< /// MyFieldBase, - /// nil::marshalling::option::contents_validator + /// nil::crypto3::marshalling::option::contents_validator /// >; /// @endcode /// Note that in the example above the default constructed MyField will /// have invalid value. To fix that you must also use - /// nil::marshalling::option::default_value_initializer option to specify proper default + /// nil::crypto3::marshalling::option::default_value_initializer option to specify proper default /// value. /// @tparam T Type of the validator class. /// @headerfile nil/marshalling/options.hpp @@ -555,28 +555,28 @@ namespace nil { /// @brief Option that specifies custom value reader class. /// @details It may be useful to override default reading functionality for complex - /// fields, such as nil::marshalling::types::bundle, where the way members are read is + /// fields, such as nil::crypto3::marshalling::types::bundle, where the way members are read is /// defined by the values of other members. For example, bundle of two integer /// fields, the first one is normal, and the second one is optional. /// The optional mode of the latter is determined by /// the value of the first field. If its value is 0, than the second /// member exists, otherwise it's missing. /// @code - /// typedef nil::marshalling::types::bundle< - /// nil::marshalling::field_type, + /// typedef nil::crypto3::marshalling::types::bundle< + /// nil::crypto3::marshalling::field_type, /// std::tuple< - /// nil::marshalling::types::integral< - /// nil::marshalling::field_type, + /// nil::crypto3::marshalling::types::integral< + /// nil::crypto3::marshalling::field_type, /// std::uint8_t /// >, - /// nil::marshalling::types::optional< - /// nil::marshalling::types::integral< - /// nil::marshalling::field_type, + /// nil::crypto3::marshalling::types::optional< + /// nil::crypto3::marshalling::types::integral< + /// nil::crypto3::marshalling::field_type, /// std::uint16_t /// > /// > /// >, - /// nil::marshalling::option::custom_value_reader + /// nil::crypto3::marshalling::option::custom_value_reader /// > field_type; /// @endcode /// The @b MyCustomReader custom reading class may implement required @@ -589,7 +589,7 @@ namespace nil { /// struct MyCustomReader /// { /// template - /// nil::marshalling::ErrorStatus operator()(TField& field, TIter& iter, std::size_t len) {...} + /// nil::crypto3::marshalling::ErrorStatus operator()(TField& field, TIter& iter, std::size_t len) {...} /// }; /// @endcode /// @@ -598,22 +598,22 @@ namespace nil { /// struct MyCustomReader /// { /// template - /// nil::marshalling::ErrorStatus operator()(TField& field, TIter& iter, std::size_t len) const + /// nil::crypto3::marshalling::ErrorStatus operator()(TField& field, TIter& iter, std::size_t len) const /// { /// auto& members = field.value(); /// auto& first = std::get<0>(members); /// auto& second = std::get<1>(members); /// /// auto es = first.read(iter, len); - /// if (es != nil::marshalling::ErrorStatus::Success) { + /// if (es != nil::crypto3::marshalling::ErrorStatus::Success) { /// return es; /// } /// /// if (first.value() != 0) { - /// second.set_mode(nil::marshalling::types::optional_mode::missing); + /// second.set_mode(nil::crypto3::marshalling::types::optional_mode::missing); /// } /// else { - /// second.set_mode(nil::marshalling::types::optional_mode::exists); + /// second.set_mode(nil::crypto3::marshalling::types::optional_mode::exists); /// } /// /// return second.read(iter, len - first.length()); @@ -629,7 +629,7 @@ namespace nil { /// is received. /// @details Sometimes protocol is very strict about what field's values are /// allowed and forces to abandon a message if invalid value is received. - /// If nil::marshalling::option::fail_on_invalid is provided as an option to a field, + /// If nil::crypto3::marshalling::option::fail_on_invalid is provided as an option to a field, /// the validity is going to checked automatically after the read. If invalid /// value is identified, error will be returned from the @b read() operation. /// @tparam TStatus Error status to return when the content of the read field is invalid. @@ -647,7 +647,7 @@ namespace nil { struct ignore_invalid { }; /// @brief options to specify units of the field. - /// @tparam TType Type of the unints, can be any type from nil::marshalling::traits::units + /// @tparam TType Type of the unints, can be any type from nil::crypto3::marshalling::traits::units /// namespace. /// @tparam TRatio Ratio within the units type, must be a variant of /// @b std::ratio type. @@ -663,187 +663,187 @@ namespace nil { /// @brief Alias option, specifying field value units are "nanoseconds". /// @headerfile nil/marshalling/options.hpp using units_nanoseconds - = units; + = units; /// @brief Alias option, specifying field value units are "microseconds". /// @headerfile nil/marshalling/options.hpp using units_microseconds - = units; + = units; /// @brief Alias option, specifying field value units are "milliseconds". /// @headerfile nil/marshalling/options.hpp using units_milliseconds - = units; + = units; /// @brief Alias option, specifying field value units are "seconds". /// @headerfile nil/marshalling/options.hpp using units_seconds - = units; + = units; /// @brief Alias option, specifying field value units are "minutes". /// @headerfile nil/marshalling/options.hpp using units_minutes - = units; + = units; /// @brief Alias option, specifying field value units are "hours". /// @headerfile nil/marshalling/options.hpp using units_hours - = units; + = units; /// @brief Alias option, specifying field value units are "days". /// @headerfile nil/marshalling/options.hpp using units_days - = units; + = units; /// @brief Alias option, specifying field value units are "weeks". /// @headerfile nil/marshalling/options.hpp using units_weeks - = units; + = units; /// @brief Alias option, specifying field value units are "nanometers". /// @headerfile nil/marshalling/options.hpp using units_nanometers - = units; + = units; /// @brief Alias option, specifying field value units are "micrometers". /// @headerfile nil/marshalling/options.hpp using units_micrometers - = units; + = units; /// @brief Alias option, specifying field value units are "millimeters". /// @headerfile nil/marshalling/options.hpp using units_millimeters - = units; + = units; /// @brief Alias option, specifying field value units are "centimeters". /// @headerfile nil/marshalling/options.hpp using units_centimeters - = units; + = units; /// @brief Alias option, specifying field value units are "meters". /// @headerfile nil/marshalling/options.hpp using units_meters - = units; + = units; /// @brief Alias option, specifying field value units are "kilometers". /// @headerfile nil/marshalling/options.hpp using units_kilometers - = units; + = units; /// @brief Alias option, specifying field value units are "nanometers per second". /// @headerfile nil/marshalling/options.hpp - using units_nanometers_per_second = units; + using units_nanometers_per_second = units; /// @brief Alias option, specifying field value units are "micrometers per second". /// @headerfile nil/marshalling/options.hpp - using units_micrometers_per_second = units; + using units_micrometers_per_second = units; /// @brief Alias option, specifying field value units are "millimeters per second". /// @headerfile nil/marshalling/options.hpp - using units_millimeters_per_second = units; + using units_millimeters_per_second = units; /// @brief Alias option, specifying field value units are "centimeters per second". /// @headerfile nil/marshalling/options.hpp - using units_centimeters_per_second = units; + using units_centimeters_per_second = units; /// @brief Alias option, specifying field value units are "meters per second". /// @headerfile nil/marshalling/options.hpp - using units_meters_per_second = units; + using units_meters_per_second = units; /// @brief Alias option, specifying field value units are "kilometers per second". /// @headerfile nil/marshalling/options.hpp - using units_kilometers_per_second = units; + using units_kilometers_per_second = units; /// @brief Alias option, specifying field value units are "kilometers per hour". /// @headerfile nil/marshalling/options.hpp - using units_kilometers_per_hour = units; + using units_kilometers_per_hour = units; /// @brief Alias option, specifying field value units are "hertz". /// @headerfile nil/marshalling/options.hpp using units_hertz - = units; + = units; /// @brief Alias option, specifying field value units are "kilohertz". /// @headerfile nil/marshalling/options.hpp using units_kilohertz - = units; + = units; /// @brief Alias option, specifying field value units are "megahertz". /// @headerfile nil/marshalling/options.hpp using units_megahertz - = units; + = units; /// @brief Alias option, specifying field value units are "gigahertz". /// @headerfile nil/marshalling/options.hpp using units_gigahertz - = units; + = units; /// @brief Alias option, specifying field value units are "degrees". /// @headerfile nil/marshalling/options.hpp using units_degrees - = units; + = units; /// @brief Alias option, specifying field value units are "radians". /// @headerfile nil/marshalling/options.hpp using units_radians - = units; + = units; /// @brief Alias option, specifying field value units are "nanoamps". /// @headerfile nil/marshalling/options.hpp using units_nanoamps - = units; + = units; /// @brief Alias option, specifying field value units are "microamps". /// @headerfile nil/marshalling/options.hpp using units_microamps - = units; + = units; /// @brief Alias option, specifying field value units are "milliamps". /// @headerfile nil/marshalling/options.hpp using units_milliamps - = units; + = units; /// @brief Alias option, specifying field value units are "amps". /// @headerfile nil/marshalling/options.hpp using units_amps - = units; + = units; /// @brief Alias option, specifying field value units are "kiloamps". /// @headerfile nil/marshalling/options.hpp using units_kiloamps - = units; + = units; /// @brief Alias option, specifying field value units are "nanovolts". /// @headerfile nil/marshalling/options.hpp using units_nanovolts - = units; + = units; /// @brief Alias option, specifying field value units are "microvolts". /// @headerfile nil/marshalling/options.hpp using units_microvolts - = units; + = units; /// @brief Alias option, specifying field value units are "millivolts". /// @headerfile nil/marshalling/options.hpp using units_millivolts - = units; + = units; /// @brief Alias option, specifying field value units are "volts". /// @headerfile nil/marshalling/options.hpp using units_volts - = units; + = units; /// @brief Alias option, specifying field value units are "kilovolts". /// @headerfile nil/marshalling/options.hpp using units_kilovolts - = units; + = units; namespace detail { @@ -915,7 +915,7 @@ namespace nil { } }; - template + template struct default_opt_mode_initializer { template void operator()(TField &field) const { @@ -958,8 +958,8 @@ namespace nil { = default_value_initializer>; /// @brief Provide range of valid numeric values. - /// @details Quite often numeric fields such as nil::marshalling::types::integral or - /// nil::marshalling::types::enumeration have limited number of valid values ranges. + /// @details Quite often numeric fields such as nil::crypto3::marshalling::types::integral or + /// nil::crypto3::marshalling::types::enumeration have limited number of valid values ranges. /// This option can be used multiple times to provide several valid ranges.@n /// If values are too big to fit into @b std::intmax_t type, please use /// @ref valid_big_unsigned_num_value_range option instead. @@ -1040,7 +1040,7 @@ namespace nil { /// @brief Alias to contents_validator, it defines validator class that checks /// that reserved bits of the field have expected values. - /// @details It is usually used with nil::marshalling::types::BitmaskValue field to + /// @details It is usually used with nil::crypto3::marshalling::types::BitmaskValue field to /// specify values of the unused/reserved bits. /// The custom validator will return true if /// @code @@ -1058,30 +1058,30 @@ namespace nil { /// @see @ref MissingByDefault /// @see @ref ExistsByDefault /// @headerfile nil/marshalling/options.hpp - template + template using default_optional_mode = default_value_initializer>; /// @brief Alias to @ref default_optional_mode. /// @details Equivalent to /// @code - /// default_optional_mode + /// default_optional_mode /// @endcode - using missing_by_default = default_optional_mode; + using missing_by_default = default_optional_mode; /// @brief Alias to @ref default_optional_mode. /// @details Equivalent to /// @code - /// default_optional_mode + /// default_optional_mode /// @endcode - using exists_by_default = default_optional_mode; + using exists_by_default = default_optional_mode; - /// @brief Alias to default_optional_mode + /// @brief Alias to default_optional_mode using optional_missing_by_default = missing_by_default; - /// @brief Alias to default_optional_mode + /// @brief Alias to default_optional_mode using optional_exists_by_default = exists_by_default; - /// @brief Alias to default_value_initializer, it initalises nil::marshalling::types::variant field + /// @brief Alias to default_value_initializer, it initalises nil::crypto3::marshalling::types::variant field /// to contain valid default value of the specified member. /// @tparam TIdx Index of the default member. /// @headerfile nil/marshalling/options.hpp @@ -1089,15 +1089,15 @@ namespace nil { using default_variant_index = default_value_initializer>; /// @brief Use "view" on original raw data instead of copying it. - /// @details Can be used with @ref nil::marshalling::types::string and raw data @ref - /// nil::marshalling::types::array_list, - /// will force usage of @ref nil::marshalling::container::string_view and - /// nil::marshalling::container::array_view respectively as data storage type. + /// @details Can be used with @ref nil::crypto3::marshalling::types::string and raw data @ref + /// nil::crypto3::marshalling::types::array_list, + /// will force usage of @ref nil::crypto3::marshalling::container::string_view and + /// nil::crypto3::marshalling::container::array_view respectively as data storage type. /// @note The original data must be preserved until destruction of the field /// that uses the "view". /// @note Incompatible with other options that contol data storage type, - /// such as @ref nil::marshalling::option::custom_storage_type or @ref - /// nil::marshalling::option::fixed_size_storage + /// such as @ref nil::crypto3::marshalling::option::custom_storage_type or @ref + /// nil::crypto3::marshalling::option::fixed_size_storage /// @headerfile nil/marshalling/options.hpp struct orig_data_view { }; @@ -1134,7 +1134,7 @@ namespace nil { /// @headerfile nil/marshalling/options.hpp struct has_custom_version_update { }; - /// @brief Mark an @ref nil::marshalling::types::optional field as existing + /// @brief Mark an @ref nil::crypto3::marshalling::types::optional field as existing /// between specified versions. /// @tparam TFrom First version when field has been added /// @tparam TUntil Last version when field still hasn't been removed. @@ -1144,14 +1144,14 @@ namespace nil { static_assert(TFrom <= TUntil, "Invalid version parameters"); }; - /// @brief Mark an @ref nil::marshalling::types::optional field as existing + /// @brief Mark an @ref nil::crypto3::marshalling::types::optional field as existing /// starting from specified version. /// @details Alias to @ref ExistsBetweenVersions /// @tparam TVer First version when field has been added template using exists_since_version = exists_between_versions::max()>; - /// @brief Mark an @ref nil::marshalling::types::optional field as existing + /// @brief Mark an @ref nil::crypto3::marshalling::types::optional field as existing /// only until specified version. /// @details Alias to @ref ExistsBetweenVersions /// @tparam TVer Last version when field still hasn't been removed. diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/access.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/access.hpp index 92f844675b..b0d1815905 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/access.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/access.hpp @@ -35,7 +35,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace processing { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/aligned_union.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/aligned_union.hpp index 6859d29c48..91c6459951 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/aligned_union.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/aligned_union.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace processing { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/bit_size_to_byte_size.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/bit_size_to_byte_size.hpp index f13b703a79..0fa4e025b7 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/bit_size_to_byte_size.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/bit_size_to_byte_size.hpp @@ -28,7 +28,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace processing { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/access.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/access.hpp index 49c02b0bcb..91cbc905ce 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/access.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/access.hpp @@ -34,7 +34,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace processing { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/size_to_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/size_to_type.hpp index 9e6d90da28..098e880c65 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/size_to_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/detail/size_to_type.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace processing { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/size_to_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/size_to_type.hpp index 997c6fe073..3b0923c184 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/size_to_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/size_to_type.hpp @@ -31,7 +31,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace processing { /// @cond SKIP_DOC diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/tuple.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/tuple.hpp index 281de480c6..239eeea356 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/processing/tuple.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/processing/tuple.hpp @@ -36,7 +36,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace processing { @@ -47,7 +47,7 @@ namespace nil { template struct tuple_as_aligned_union { /// @cond DOCUMENT_STATIC_ASSERT - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); /// @endcond /// @brief Type definition is invalid for any type that is not @@ -72,7 +72,7 @@ namespace nil { /// @brief Check whether tuple is unique, i.e. doesn't have contain types. template struct tuple_is_unique { - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); /// @brief Value is set to true when tuple is discovered to be unique. static const bool value = false; @@ -81,7 +81,7 @@ namespace nil { /// @cond SKIP_DOC template struct tuple_is_unique> { - static const bool value = (!nil::detail::is_in_tuple>::value) + static const bool value = (!marshalling::detail::is_in_tuple>::value) && tuple_is_unique>::value; }; @@ -103,7 +103,7 @@ namespace nil { template static void exec(TTuple &&tuple, TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static const std::size_t TupleSize = std::tuple_size::value; static const std::size_t OffsetedRem = TRem + TOff; static_assert(OffsetedRem <= TupleSize, "Incorrect parameters"); @@ -220,7 +220,7 @@ namespace nil { template static void exec(TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static const std::size_t TupleSize = std::tuple_size::value; static_assert(TRem <= TupleSize, "Incorrect TRem"); @@ -276,7 +276,7 @@ namespace nil { template static void exec(TTuple &&tuple, TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static const std::size_t TupleSize = std::tuple_size::value; static_assert(TRem <= TupleSize, "Incorrect TRem"); @@ -332,7 +332,7 @@ namespace nil { template static void exec(TTuple &&tuple, TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static const std::size_t TupleSize = std::tuple_size::value; static_assert(TRem <= TupleSize, "Incorrect TRem"); @@ -397,7 +397,7 @@ namespace nil { template static constexpr TValue exec(TTuple &&tuple, const TValue &value, TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static_assert((TOff + TRem) <= std::tuple_size::value, "Incorrect params"); return tuple_accumulate_helper::exec( @@ -482,7 +482,7 @@ namespace nil { template static constexpr TValue exec(const TValue &value, TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static_assert((TOff + TRem) <= std::tuple_size::value, "Incorrect TRem"); return tuple_type_accumulate_helper::template exec( @@ -562,8 +562,8 @@ namespace nil { /// @tparam TSecond Type of the second tuple. template struct tuple_cat { - static_assert(nil::detail::is_tuple::value, "TFirst must be tuple"); - static_assert(nil::detail::is_tuple::value, "TSecond must be tuple"); + static_assert(marshalling::detail::is_tuple::value, "TFirst must be tuple"); + static_assert(marshalling::detail::is_tuple::value, "TSecond must be tuple"); /// @brief Result type of tuples concatenation. using type = typename std::decay(), @@ -588,7 +588,7 @@ namespace nil { template static void exec(std::size_t idx, TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static const std::size_t TupleSize = std::tuple_size::value; static_assert(TCount <= TupleSize, "Incorrect TCount"); static_assert(0U < TCount, "Incorrect instantiation"); @@ -653,7 +653,7 @@ namespace nil { template void tuple_for_selected_type(std::size_t idx, TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "Provided tupe must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "Provided tupe must be std::tuple"); static const std::size_t TupleSize = std::tuple_size::value; static_assert(0U < TupleSize, "Empty tuples are not supported"); @@ -694,8 +694,8 @@ namespace nil { /// @tparam TTuple Containing tuple template constexpr bool tuple_is_tail_of() { - static_assert(nil::detail::is_tuple::value, "TTail param must be tuple"); - static_assert(nil::detail::is_tuple::value, "TTuple param must be tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTail param must be tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple param must be tuple"); return std::tuple_size::value <= std::tuple_size::value && detail::tuple_tail_check_helpler< TTail, TTuple, std::tuple_size::value - std::tuple_size::value>::value; @@ -712,7 +712,7 @@ namespace nil { template static constexpr bool check(TFunc &&func) { using Tuple = typename std::decay::type; - static_assert(nil::detail::is_tuple::value, "TTuple must be std::tuple"); + static_assert(marshalling::detail::is_tuple::value, "TTuple must be std::tuple"); static_assert(TRem <= std::tuple_size::value, "Incorrect TRem"); using ElemType = typename std::tuple_element::value - TRem, Tuple>::type; return @@ -740,7 +740,7 @@ namespace nil { template constexpr bool tuple_type_is_any_of(TFunc &&func) { - static_assert(nil::detail::is_tuple::value, "Tuple as argument is expected"); + static_assert(marshalling::detail::is_tuple::value, "Tuple as argument is expected"); return detail::tuple_type_is_any_of_helper::value>::template check( std::forward(func)); } diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/status_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/status_type.hpp index 16d7ea79ba..728cc516e4 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/status_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/status_type.hpp @@ -32,7 +32,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { /// @brief Error statuses. @@ -70,7 +70,7 @@ namespace nil { { public: // Return a short descriptive name for the category - virtual const char *name() const noexcept override final { return "nil::marshalling::status_type"; } + virtual const char *name() const noexcept override final { return "nil::crypto3::marshalling::status_type"; } // Return what each enum means in text virtual std::string message(int c) const override final { @@ -106,21 +106,21 @@ namespace nil { namespace std { - template <> struct is_error_code_enum : true_type + template <> struct is_error_code_enum : true_type { }; } -inline std::error_code make_error_code(nil::marshalling::status_type e) +inline std::error_code make_error_code(nil::crypto3::marshalling::status_type e) { - static nil::marshalling::status_type_category category; + static nil::crypto3::marshalling::status_type_category category; return {static_cast(e), category}; } #if defined(CRYPTO3_MARSHALLING_THROWS) #define THROW_IF_ERROR_STATUS(status, message) \ - if (nil::marshalling::status_type::success != status) { \ + if (nil::crypto3::marshalling::status_type::success != status) { \ std::stringstream os; os << "While performing operation " << std::string(message) \ << " marshalling error status received: " << make_error_code(status) \ << " @" << __FILE__ << ":" << __LINE__ << std::endl; \ @@ -130,7 +130,7 @@ inline std::error_code make_error_code(nil::marshalling::status_type e) #else #define THROW_IF_ERROR_STATUS(status, message) \ - BOOST_VERIFY_MSG(nil::marshalling::status_type::success == status, message) + BOOST_VERIFY_MSG(nil::crypto3::marshalling::status_type::success == status, message) #endif #endif // MARSHALLING_STATUS_TYPE_HPP diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/type_traits.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/type_traits.hpp index 9bf9278b41..5ea84bb432 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/type_traits.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/type_traits.hpp @@ -34,15 +34,15 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { BOOST_TTI_HAS_TYPE(tag) /// @brief Compile time check function of whether a provided type is any - /// variant of nil::marshalling::types::array_list. + /// variant of nil::crypto3::marshalling::types::array_list. /// @tparam T Any type. /// @return true in case provided type is any variant of @ref array_list - /// @related nil::marshalling::types::array_list + /// @related nil::crypto3::marshalling::types::array_list template struct is_array_list { @@ -57,10 +57,10 @@ namespace nil { }; /// @brief Compile time check function of whether a provided type is any - /// variant of nil::marshalling::types::bitfield. + /// variant of nil::crypto3::marshalling::types::bitfield. /// @tparam T Any type. /// @return true in case provided type is any variant of @ref bitfield - /// @related nil::marshalling::types::bitfield + /// @related nil::crypto3::marshalling::types::bitfield template struct is_bitfield { static const bool value = has_type_tag struct is_bitmask_value { static const bool value = has_type_tag struct is_bundle { static const bool value = has_type_tag struct is_enumeration { static const bool value = has_type_tag struct is_float_value { static const bool value = has_type_tag struct is_integral { static const bool value = has_type_tag struct is_no_value { static const bool value = has_type_tag struct is_optional { static const bool value = has_type_tag struct is_string { static const bool value = has_type_tag struct is_variant { static const bool value = has_type_tag - struct is_container ::value + struct is_container ::value || is_float_value::value>::type> { static const bool value = false; }; @@ -273,4 +273,4 @@ namespace nil { } // namespace marshalling } // namespace nil -#endif // MARSHALLING_TYPE_TRAITS_HPP \ No newline at end of file +#endif // MARSHALLING_TYPE_TRAITS_HPP diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_refresher.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_refresher.hpp index 328b79345b..752b513e5e 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_refresher.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_refresher.hpp @@ -26,7 +26,7 @@ #ifndef MARSHALLING_CUSTOM_REFRESHER_HPP #define MARSHALLING_CUSTOM_REFRESHER_HPP -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_validator.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_validator.hpp index 6ef8ef0d31..42aa036ab3 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_validator.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_validator.hpp @@ -26,7 +26,7 @@ #ifndef MARSHALLING_CUSTOM_VALIDATOR_HPP #define MARSHALLING_CUSTOM_VALIDATOR_HPP -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_value_reader.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_value_reader.hpp index 05617d5997..f4623e5af5 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_value_reader.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/custom_value_reader.hpp @@ -28,7 +28,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/default_value_initializer.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/default_value_initializer.hpp index f95dfa95da..61bbf1cc64 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/default_value_initializer.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/default_value_initializer.hpp @@ -28,7 +28,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/empty_serialization.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/empty_serialization.hpp index 87e86f6242..ad16985faa 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/empty_serialization.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/empty_serialization.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/exists_between_versions.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/exists_between_versions.hpp index aefdae7f4c..b9b9c28afb 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/exists_between_versions.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/exists_between_versions.hpp @@ -34,7 +34,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fail_on_invalid.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fail_on_invalid.hpp index afe660e66f..cfa4a62698 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fail_on_invalid.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fail_on_invalid.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_bit_length.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_bit_length.hpp index 0b83f08120..ba2e37ab88 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_bit_length.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_bit_length.hpp @@ -34,7 +34,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_length.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_length.hpp index 86f7b5ddfa..a21a0fd5e8 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_length.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/fixed_length.hpp @@ -33,7 +33,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ignore_invalid.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ignore_invalid.hpp index cae39bf6b9..1b8128ebcc 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ignore_invalid.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ignore_invalid.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/invalid_by_default.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/invalid_by_default.hpp index 469fd77dee..02945b7497 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/invalid_by_default.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/invalid_by_default.hpp @@ -26,7 +26,7 @@ #ifndef MARSHALLING_INVALID_BY_DEFAULT_HPP #define MARSHALLING_INVALID_BY_DEFAULT_HPP -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/num_value_multi_range_validator.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/num_value_multi_range_validator.hpp index a70cc1eb8d..deeb5ea09b 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/num_value_multi_range_validator.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/num_value_multi_range_validator.hpp @@ -30,7 +30,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { @@ -39,7 +39,7 @@ namespace nil { class num_value_multi_range_validator : public TBase { using base_impl_type = TBase; - static_assert(nil::detail::is_tuple::value, "TRanges must be a tuple"); + static_assert(marshalling::detail::is_tuple::value, "TRanges must be a tuple"); public: using value_type = typename base_impl_type::value_type; @@ -79,7 +79,7 @@ namespace nil { template bool operator()(bool val) const { static_cast(val); - static_assert(nil::detail::is_tuple::value, + static_assert(marshalling::detail::is_tuple::value, "TRange must be a tuple"); static_assert(std::tuple_size::value == 2, "Tuple with 2 elements is expected"); using MinVal = typename std::tuple_element<0, TRange>::type; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_fixed_ser_length_field_prefix.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_fixed_ser_length_field_prefix.hpp index 2269d8058a..ab8ef5c3fe 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_fixed_ser_length_field_prefix.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_fixed_ser_length_field_prefix.hpp @@ -32,7 +32,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_length_forcing.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_length_forcing.hpp index e796f5128b..a59c3c7e1c 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_length_forcing.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_length_forcing.hpp @@ -33,7 +33,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { @@ -96,7 +96,7 @@ namespace nil { using IterTag = typename std::iterator_traits::iterator_category; static_assert(std::is_base_of::value, "Only random access iterator for reading is supported with " - "nil::marshalling::option::SequenceElemLengthForcingEnabled option"); + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option"); if (forced_ == cleared) { return base_impl_type::read_element(elem, iter, len); @@ -120,7 +120,7 @@ namespace nil { using IterTag = typename std::iterator_traits::iterator_category; static_assert(std::is_base_of::value, "Only random access iterator for reading is supported with " - "nil::marshalling::option::SequenceElemLengthForcingEnabled option"); + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option"); if (forced_ == cleared) { return base_impl_type::read_element_no_status(elem, iter); diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_ser_length_field_prefix.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_ser_length_field_prefix.hpp index e25f8445a6..336aaceafb 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_ser_length_field_prefix.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_elem_ser_length_field_prefix.hpp @@ -32,7 +32,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_fixed_size.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_fixed_size.hpp index 1273ef22d0..aac579cb59 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_fixed_size.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_fixed_size.hpp @@ -32,7 +32,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_length_forcing.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_length_forcing.hpp index cb8441a6bd..ce16587683 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_length_forcing.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_length_forcing.hpp @@ -32,7 +32,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_ser_length_field_prefix.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_ser_length_field_prefix.hpp index 955b33c282..553f8f472b 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_ser_length_field_prefix.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_ser_length_field_prefix.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_field_prefix.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_field_prefix.hpp index 9caa6459b7..1ec3741a52 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_field_prefix.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_field_prefix.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_forcing.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_forcing.hpp index f7af28cb45..3b2167b8de 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_forcing.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_size_forcing.hpp @@ -31,7 +31,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_termination_field_suffix.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_termination_field_suffix.hpp index 3f0e7c0cfc..1f29e0677b 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_termination_field_suffix.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_termination_field_suffix.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { @@ -80,7 +80,7 @@ namespace nil { using IterTag = typename std::iterator_traits::iterator_category; static_assert(std::is_base_of::value, "Only random access iterator for reading is supported with " - "nil::marshalling::option::sequence_termination_field_suffix option"); + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option"); using elem_tag = typename std::conditional::value diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_trailing_field_suffix.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_trailing_field_suffix.hpp index 3d01ad3cd2..9a41449d17 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_trailing_field_suffix.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/sequence_trailing_field_suffix.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ser_offset.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ser_offset.hpp index 5255ea9e41..2f29f096e9 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ser_offset.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/ser_offset.hpp @@ -29,7 +29,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/var_length.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/var_length.hpp index e8c137c74b..854ce45561 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/var_length.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/var_length.hpp @@ -36,7 +36,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { @@ -236,14 +236,14 @@ namespace nil { static void add_byte_to_serialized_value(std::uint8_t byte, std::size_t byteCount, unsigned_serialized_type &val, - nil::marshalling::endian::big_endian) { + nil::crypto3::marshalling::endian::big_endian) { static_cast(byteCount); add_byte_to_serialized_value_big_endian(byte, val); } static void add_byte_to_serialized_value(std::uint8_t byte, std::size_t byteCount, unsigned_serialized_type &val, - nil::marshalling::endian::little_endian) { + nil::crypto3::marshalling::endian::little_endian) { add_byte_to_serialized_value_little_endian(byte, byteCount, val); } @@ -291,14 +291,14 @@ namespace nil { static std::uint8_t remove_byte_from_serialized_value(unsigned_serialized_type &val, std::size_t byteCount, std::size_t min_length, bool &lastByte, - nil::marshalling::endian::big_endian) { + nil::crypto3::marshalling::endian::big_endian) { return remove_byte_from_serialized_value_big_endian(val, byteCount, min_length, lastByte); } static std::uint8_t remove_byte_from_serialized_value(unsigned_serialized_type &val, std::size_t byteCount, std::size_t min_length, bool &lastByte, - nil::marshalling::endian::little_endian) { + nil::crypto3::marshalling::endian::little_endian) { return remove_byte_from_serialized_value_little_endian(val, byteCount, min_length, lastByte); } diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/version_storage.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/version_storage.hpp index 4667fec30d..da34f6a11e 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/version_storage.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/adapter/version_storage.hpp @@ -26,7 +26,7 @@ #ifndef MARSHALLING_VERSION_STORAGE_HPP #define MARSHALLING_VERSION_STORAGE_HPP -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace adapter { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list.hpp index d05aaf2769..441f5cb561 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list.hpp @@ -37,35 +37,35 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { /// @brief field_type that represents a sequential collection of fields. /// @details By default uses /// std::vector, - /// for internal storage, unless nil::marshalling::option::fixed_size_storage option is used, - /// which forces usage of nil::marshalling::container::static_vector instead. + /// for internal storage, unless nil::crypto3::marshalling::option::fixed_size_storage option is used, + /// which forces usage of nil::crypto3::marshalling::container::static_vector instead. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam TElement Element of the collection, can be either basic integral value - /// (such as std::uint8_t) or any other field from nil::marshalling::types namespace.@n + /// (such as std::uint8_t) or any other field from nil::crypto3::marshalling::types namespace.@n /// For example: /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using RawDataSeqField = - /// nil::marshalling::types::array_list< + /// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// std::uint8_t /// >; /// using CollectionOfBundlesField = - /// nil::marshalling::types::array_list< + /// nil::crypto3::marshalling::types::array_list< /// MyFieldBase, /// std::types::bundle< /// MyFieldBase, /// std::tuple< - /// nil::marshalling::types::integral - /// nil::marshalling::types::integral - /// nil::marshalling::types::integral + /// nil::crypto3::marshalling::types::integral + /// nil::crypto3::marshalling::types::integral + /// nil::crypto3::marshalling::types::integral /// > /// > /// >; @@ -73,29 +73,29 @@ namespace nil { /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field.@n /// Supported options are: - /// @li @ref nil::marshalling::option::fixed_size_storage - /// @li @ref nil::marshalling::option::custom_storage_type - /// @li @ref nil::marshalling::option::sequence_size_field_prefix - /// @li @ref nil::marshalling::option::sequence_ser_length_field_prefix - /// @li @ref nil::marshalling::option::sequence_elem_ser_length_field_prefix - /// @li @ref nil::marshalling::option::sequence_elem_fixed_ser_length_field_prefix - /// @li @ref nil::marshalling::option::sequence_size_forcing_enabled - /// @li @ref nil::marshalling::option::sequence_length_forcing_enabled - /// @li @ref nil::marshalling::option::sequence_fixed_size - /// @li @ref nil::marshalling::option::sequence_termination_field_suffix - /// @li @ref nil::marshalling::option::sequence_trailing_field_suffix - /// @li @ref nil::marshalling::option::default_value_initializer - /// @li @ref nil::marshalling::option::contents_validator - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::fail_on_invalid - /// @li @ref nil::marshalling::option::ignore_invalid - /// @li @ref nil::marshalling::option::orig_data_view (valid only if TElement is integral type + /// @li @ref nil::crypto3::marshalling::option::fixed_size_storage + /// @li @ref nil::crypto3::marshalling::option::custom_storage_type + /// @li @ref nil::crypto3::marshalling::option::sequence_size_field_prefix + /// @li @ref nil::crypto3::marshalling::option::sequence_ser_length_field_prefix + /// @li @ref nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix + /// @li @ref nil::crypto3::marshalling::option::sequence_elem_fixed_ser_length_field_prefix + /// @li @ref nil::crypto3::marshalling::option::sequence_size_forcing_enabled + /// @li @ref nil::crypto3::marshalling::option::sequence_length_forcing_enabled + /// @li @ref nil::crypto3::marshalling::option::sequence_fixed_size + /// @li @ref nil::crypto3::marshalling::option::sequence_termination_field_suffix + /// @li @ref nil::crypto3::marshalling::option::sequence_trailing_field_suffix + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer + /// @li @ref nil::crypto3::marshalling::option::contents_validator + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::fail_on_invalid + /// @li @ref nil::crypto3::marshalling::option::ignore_invalid + /// @li @ref nil::crypto3::marshalling::option::orig_data_view (valid only if TElement is integral type /// of 1 byte size. - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/array_list.hpp template class array_list : private detail::array_list_base_type { @@ -116,10 +116,10 @@ namespace nil { tag::array_list>::type; /// @brief Type of underlying value. - /// @details If nil::marshalling::option::fixed_size_storage option is NOT used, the + /// @details If nil::crypto3::marshalling::option::fixed_size_storage option is NOT used, the /// value_type is std::vector, otherwise it becomes - /// nil::marshalling::container::static_vector, where TSize is a size - /// provided to nil::marshalling::option::fixed_size_storage option. + /// nil::crypto3::marshalling::container::static_vector, where TSize is a size + /// provided to nil::crypto3::marshalling::option::fixed_size_storage option. using value_type = typename base_impl_type::value_type; /// @brief Type of the element. @@ -174,10 +174,10 @@ namespace nil { /// @brief Read field value from input data sequence /// @details By default, the read operation will try to consume all the /// data available, unless size limiting option (such as - /// nil::marshalling::option::sequence_size_field_prefix, - /// nil::marshalling::option::sequence_fixed_size, - /// nil::marshalling::option::sequence_size_forcing_enabled, - /// nil::marshalling::option::sequence_length_forcing_enabled) is used. + /// nil::crypto3::marshalling::option::sequence_size_field_prefix, + /// nil::crypto3::marshalling::option::sequence_fixed_size, + /// nil::crypto3::marshalling::option::sequence_size_forcing_enabled, + /// nil::crypto3::marshalling::option::sequence_length_forcing_enabled) is used. /// @param[in, out] iter Iterator to read the data. /// @param[in] len Number of bytes available for reading. /// @return Status of read operation. @@ -199,7 +199,7 @@ namespace nil { /// @brief Write current field value to output data sequence /// @details By default, the write operation will write all the - /// elements the field contains. If nil::marshalling::option::sequence_fixed_size option + /// elements the field contains. If nil::crypto3::marshalling::option::sequence_fixed_size option /// is used, the number of elements, that is going to be written, is /// exactly as the option specifies. If underlying vector storage /// doesn't contain enough data, the default constructed elements will @@ -226,7 +226,7 @@ namespace nil { /// @brief Check validity of the field value. /// @details The collection is valid if all the elements are valid. In case - /// nil::marshalling::option::contents_validator option is used, the validator, + /// nil::crypto3::marshalling::option::contents_validator option is used, the validator, /// it provides, is invoked IN ADDITION to the validation of the elements. /// @return true in case the field's value is valid, false otherwise. bool valid() const { @@ -252,7 +252,7 @@ namespace nil { /// @brief Force number of elements that must be read in the next read() /// invocation. - /// @details Exists only if nil::marshalling::option::sequence_size_forcing_enabled option has been + /// @details Exists only if nil::crypto3::marshalling::option::sequence_size_forcing_enabled option has been /// used. /// @param[in] count Number of elements to read during following read operation. void force_read_elem_count(std::size_t count) { @@ -261,14 +261,14 @@ namespace nil { /// @brief Clear forcing of the number of elements that must be read in the next read() /// invocation. - /// @details Exists only if nil::marshalling::option::sequence_size_forcing_enabled option has been + /// @details Exists only if nil::crypto3::marshalling::option::sequence_size_forcing_enabled option has been /// used. void clear_read_elem_count() { return base_impl_type::clear_read_elem_count(); } /// @brief Force available length for the next read() invocation. - /// @details Exists only if @ref nil::marshalling::option::sequence_length_forcing_enabled option has been + /// @details Exists only if @ref nil::crypto3::marshalling::option::sequence_length_forcing_enabled option has been /// used. /// @param[in] count Number of elements to read during following read operation. void force_read_length(std::size_t count) { @@ -277,7 +277,7 @@ namespace nil { /// @brief Clear forcing of the available length in the next read() /// invocation. - /// @details Exists only if @ref nil::marshalling::option::sequence_length_forcing_enabled option has been + /// @details Exists only if @ref nil::crypto3::marshalling::option::sequence_length_forcing_enabled option has been /// used. void clear_read_length_forcing() { return base_impl_type::clear_read_length_forcing(); @@ -286,7 +286,7 @@ namespace nil { /// @brief Force serialization length of a single element. /// @details The function can be used to force a serialization length of a /// single element within the array_list. - /// Exists only if @ref nil::marshalling::option::SequenceElemLengthForcingEnabled option has been + /// Exists only if @ref nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option has been /// used. /// @param[in] count Number of elements to read during following read operation. void force_read_elem_length(std::size_t count) { @@ -294,7 +294,7 @@ namespace nil { } /// @brief Clear forcing the serialization length of the single element. - /// @details Exists only if nil::marshalling::option::SequenceElemLengthForcingEnabled option has been + /// @details Exists only if nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option has been /// used. void clear_read_elem_length_forcing() { return base_impl_type::clear_read_elem_length_forcing(); @@ -306,7 +306,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -324,34 +324,34 @@ namespace nil { private: static_assert( !parsed_options_type::has_ser_offset, - "nil::marshalling::option::num_value_ser_offset option is not applicable to array_list field"); + "nil::crypto3::marshalling::option::num_value_ser_offset option is not applicable to array_list field"); static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to array_list field"); + "nil::crypto3::marshalling::option::fixed_length option is not applicable to array_list field"); static_assert( !parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to array_list field"); + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to array_list field"); static_assert(!parsed_options_type::has_var_length_limits, - "nil::marshalling::option::var_length option is not applicable to array_list field"); + "nil::crypto3::marshalling::option::var_length option is not applicable to array_list field"); static_assert( !parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio_type option is not applicable to array_list field"); + "nil::crypto3::marshalling::option::scaling_ratio_type option is not applicable to array_list field"); static_assert(!parsed_options_type::has_units, - "nil::marshalling::option::Units option is not applicable to array_list field"); + "nil::crypto3::marshalling::option::Units option is not applicable to array_list field"); static_assert(!parsed_options_type::has_multi_range_validation, - "nil::marshalling::option::valid_num_value_range (or similar) option is not applicable " + "nil::crypto3::marshalling::option::valid_num_value_range (or similar) option is not applicable " "to array_list field"); static_assert( (!parsed_options_type::has_orig_data_view) || (std::is_integral::value && (sizeof(TElement) == sizeof(std::uint8_t))), - "Usage of nil::marshalling::option::orig_data_view option is allowed only for raw binary data " + "Usage of nil::crypto3::marshalling::option::orig_data_view option is allowed only for raw binary data " "(std::uint8_t) types."); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "array_list field"); static_assert( !parsed_options_type::has_invalid_by_default, - "nil::marshalling::option::invalid_by_default option is not applicable to array_list field"); + "nil::crypto3::marshalling::option::invalid_by_default option is not applicable to array_list field"); }; /// @brief Equivalence comparison operator. @@ -389,18 +389,18 @@ namespace nil { return !(field1 != field2); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::array_list type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::array_list type /// in order to have access to its internal types. - /// @related nil::marshalling::types::array_list + /// @related nil::crypto3::marshalling::types::array_list template inline array_list & to_field_base(array_list &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::array_list type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::array_list type /// in order to have access to its internal types. - /// @related nil::marshalling::types::array_list + /// @related nil::crypto3::marshalling::types::array_list template inline const array_list & to_field_base(const array_list &field) { @@ -412,19 +412,19 @@ namespace nil { using standard_array_list = array_list< TFieldBase, TElement, - nil::marshalling::option::size_t_sequence_size_field_prefix>; + nil::crypto3::marshalling::option::size_t_sequence_size_field_prefix>; // Very often we just need an array list of std::size_t, so here's another shortcut. template using standard_size_t_array_list = array_list< TFieldBase, - nil::marshalling::types::integral, - nil::marshalling::option::size_t_sequence_size_field_prefix>; + nil::crypto3::marshalling::types::integral, + nil::crypto3::marshalling::option::size_t_sequence_size_field_prefix>; // Helper functions to convert to/from an arraylist. template typename std::enable_if< - nil::detail::is_range::value, + marshalling::detail::is_range::value, standard_array_list>::type fill_standard_array_list( const Range& input_range, diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/basic_type.hpp index 8f43d3d0b1..7ac6dcdac3 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/basic_type.hpp @@ -39,7 +39,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/behaviour.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/behaviour.hpp index 40e9f1bca5..df8c6ebe78 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/behaviour.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/behaviour.hpp @@ -37,7 +37,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -48,7 +48,7 @@ namespace nil { template<> struct array_list_orig_data_view_storage_type { template - using type = nil::marshalling::container::array_view; + using type = nil::crypto3::marshalling::container::array_view; }; template<> @@ -63,7 +63,7 @@ namespace nil { template<> struct array_list_sequence_fixed_size_use_fixed_size_storage_type { template - using type = nil::marshalling::container::static_vector; + using type = nil::crypto3::marshalling::container::static_vector; }; template<> @@ -80,7 +80,7 @@ namespace nil { template<> struct array_list_fixed_size_storage_type { template - using type = nil::marshalling::container::static_vector; + using type = nil::crypto3::marshalling::container::static_vector; }; template<> diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/type_traits.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/type_traits.hpp index 585579b0f0..fef351f9dd 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/type_traits.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/array_list/type_traits.hpp @@ -38,7 +38,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -70,12 +70,12 @@ namespace nil { template struct array_list_max_length_retrieve_helper< - nil::marshalling::container::static_vector> { + nil::crypto3::marshalling::container::static_vector> { static const std::size_t value = TSize; }; template - struct array_list_max_length_retrieve_helper> { + struct array_list_max_length_retrieve_helper> { static const std::size_t value = TSize - 1; }; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield.hpp index 84cdc53019..8d6346a8e7 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield.hpp @@ -33,7 +33,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { @@ -54,57 +54,57 @@ namespace nil { /// Value4 /// }; /// - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using MyField = - /// nil::marshalling::types::bitfield< + /// nil::crypto3::marshalling::types::bitfield< /// MyFieldBase, /// std::tuple< - /// nil::marshalling::types::enumeration< + /// nil::crypto3::marshalling::types::enumeration< /// MyFieldBase, /// MyEnumType, - /// nil::marshalling::option::fixed_bit_length<2> + /// nil::crypto3::marshalling::option::fixed_bit_length<2> /// >, - /// nil::marshalling::types::integral< + /// nil::crypto3::marshalling::types::integral< /// MyFieldBase, /// std::uint8_t, - /// nil::marshalling::option::fixed_bit_length<6> + /// nil::crypto3::marshalling::option::fixed_bit_length<6> /// > /// > /// >; /// @endcode /// Note, that bitfield members fields specify their length in bits using - /// nil::marshalling::option::fixed_bit_length option. + /// nil::crypto3::marshalling::option::fixed_bit_length option. /// Also note, that all bitfield member's lengths in bits combined create /// a round number of bytes, i.e all the bits must sum up to 8, 16, 24, 32, ... /// bits. /// /// Refer to @ref sec_field_tutorial_bitfield for tutorial and usage examples. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam TMembers All member fields bundled together in /// std::tuple. /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field.@n /// Supported options are: - /// @li @ref nil::marshalling::option::contents_validator - All field members may specify + /// @li @ref nil::crypto3::marshalling::option::contents_validator - All field members may specify /// their independent validators. The bitfield field considered to /// be valid if all the field members are valid. This option though, /// provides an ability to add extra validation logic that can /// observe value of more than one bitfield member. For example, /// protocol specifies that if one specific member has value X, than /// other member is NOT allowed to have value Y. - /// @li @ref nil::marshalling::option::contents_refresher - The default refreshing + /// @li @ref nil::crypto3::marshalling::option::contents_refresher - The default refreshing /// behaviour is to call the @b refresh() member function of every /// member field. This option provides an ability to set a custom /// "refreshing" logic. - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::version_storage + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::version_storage /// @pre TMember is a variant of std::tuple, that contains other fields. /// @pre Every field member specifies its length in bits using - /// nil::marshalling::option::fixed_bit_length option. - /// @extends nil::marshalling::field_type + /// nil::crypto3::marshalling::option::fixed_bit_length option. + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/bitfield.hpp /// @see @ref MARSHALLING_FIELD_MEMBERS_ACCESS() /// @see @ref MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE() @@ -148,7 +148,7 @@ namespace nil { /// @brief Retrieve number of bits specified member field consumes. /// @tparam TIdx Index of the member field. - /// @return Number of bits, specified with nil::marshalling::option::fixed_bit_length option + /// @return Number of bits, specified with nil::crypto3::marshalling::option::fixed_bit_length option /// used with the requested member. template static constexpr std::size_t member_bit_length() { @@ -243,7 +243,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -261,70 +261,70 @@ namespace nil { private: static_assert( !parsed_options_type::has_ser_offset, - "nil::marshalling::option::num_value_ser_offset option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::num_value_ser_offset option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::fixed_length option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_var_length_limits, - "nil::marshalling::option::var_length option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::var_length option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "bitfield field"); static_assert( !parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::sequence_size_forcing_enabled option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::sequence_size_forcing_enabled option is not applicable to bitfield field"); static_assert( !parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::SequenceLengthorcingEnabled option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::SequenceLengthorcingEnabled option is not applicable to bitfield field"); static_assert( !parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable " "to bitfield field"); static_assert( !parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "bitfield field"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "bitfield field"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "bitfield field"); static_assert(!parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "bitfield field"); static_assert(!parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "bitfield field"); static_assert( !parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to bitfield field"); static_assert( !parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to bitfield field"); static_assert( !parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio_type option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::scaling_ratio_type option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_units, - "nil::marshalling::option::Units option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::Units option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to bitfield field"); static_assert(!parsed_options_type::has_multi_range_validation, - "nil::marshalling::option::valid_num_value_range (or similar) option is not applicable " + "nil::crypto3::marshalling::option::valid_num_value_range (or similar) option is not applicable " "to bitfield field"); static_assert(!parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable " "to bitfield field"); static_assert( !parsed_options_type::has_invalid_by_default, - "nil::marshalling::option::invalid_by_default option is not applicable to bitfield field"); + "nil::crypto3::marshalling::option::invalid_by_default option is not applicable to bitfield field"); }; /// @brief Equality comparison operator. @@ -360,18 +360,18 @@ namespace nil { return field1.value() < field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::bitfield type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::bitfield type /// in order to have access to its internal types. - /// @related nil::marshalling::types::bitfield + /// @related nil::crypto3::marshalling::types::bitfield template inline bitfield & to_field_base(bitfield &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::bitfield type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::bitfield type /// in order to have access to its internal types. - /// @related nil::marshalling::types::bitfield + /// @related nil::crypto3::marshalling::types::bitfield template inline const bitfield & to_field_base(const bitfield &field) { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/basic_type.hpp index f6b09860de..8b19ecfc00 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/basic_type.hpp @@ -41,7 +41,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -50,7 +50,7 @@ namespace nil { class basic_bitfield : public TFieldBase { using base_impl_type = TFieldBase; - static_assert(::nil::detail::is_tuple::value, + static_assert(marshalling::detail::is_tuple::value, "TMembers is expected to be a tuple of BitfieldMember<...>"); static_assert(1U < std::tuple_size::value, diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/type_traits.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/type_traits.hpp index 3492a3651c..1f136ac757 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/type_traits.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitfield/type_traits.hpp @@ -39,7 +39,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value.hpp index 58e6520f89..ad963ad499 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value.hpp @@ -35,50 +35,50 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { /// @brief Bitmask value field. /// @details Quite often communication protocols specify bitmask values, where /// any bit has a specific meaning. Although such masks are can be handled - /// as unsigned integer values using nil::marshalling::types::integral field type, - /// using nil::marshalling::types::Bitmask may be a bit more convenient. + /// as unsigned integer values using nil::crypto3::marshalling::types::integral field type, + /// using nil::crypto3::marshalling::types::Bitmask may be a bit more convenient. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field. If no option is provided, the underlying type is assumed /// to be "unsigned", which is usually 4 bytes long. To redefined the length - /// of the bitmask field, use nil::marshalling::option::fixed_length option. + /// of the bitmask field, use nil::crypto3::marshalling::option::fixed_length option. /// For example: /// @code - /// using MyFieldBase = nil::marshalling::field_type; - /// using MyField =nil::marshalling::types::enumeration; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; + /// using MyField =nil::crypto3::marshalling::types::enumeration; /// @endcode /// The serialized value of the field in the example above will consume /// sizeof(unsigned) bytes, because the underlying type chosen to be "unsigned" /// by default. Example below specifies simple bitmask value field with /// 2 bytes serialization length: /// @code - /// using MyFieldBase = nil::marshalling::field_type; - /// using MyField =nil::marshalling::types::enumeration >; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; + /// using MyField =nil::crypto3::marshalling::types::enumeration >; /// @endcode /// Supported options are: - /// @li @ref nil::marshalling::option::fixed_length - /// @li @ref nil::marshalling::option::fixed_bit_length - /// @li @ref nil::marshalling::option::default_value_initializer or - /// nil::marshalling::option::default_num_value. - /// @li @ref nil::marshalling::option::contents_validator or - /// nil::marshalling::option::bitmask_reserved_bits. - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::fail_on_invalid - /// @li @ref nil::marshalling::option::ignore_invalid - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::fixed_length + /// @li @ref nil::crypto3::marshalling::option::fixed_bit_length + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer or + /// nil::crypto3::marshalling::option::default_num_value. + /// @li @ref nil::crypto3::marshalling::option::contents_validator or + /// nil::crypto3::marshalling::option::bitmask_reserved_bits. + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::fail_on_invalid + /// @li @ref nil::crypto3::marshalling::option::ignore_invalid + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/bitmask_value.hpp /// @see MARSHALLING_BITMASK_BITS() /// @see MARSHALLING_BITMASK_BITS_ACCESS() @@ -113,7 +113,7 @@ namespace nil { /// @brief Type of underlying integral value. /// @details Unsigned integral type, which depends on the length of the - /// mask determined by the nil::marshalling::option::fixed_length option. + /// mask determined by the nil::crypto3::marshalling::option::fixed_length option. using value_type = typename integral_type::value_type; /// @brief Default constructor. @@ -264,7 +264,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return intValue_.get_version(); } @@ -282,70 +282,70 @@ namespace nil { private: static_assert( !parsed_options_type::has_ser_offset, - "nil::marshalling::option::num_value_ser_offset option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::num_value_ser_offset option is not applicable to bitmask_value field"); static_assert(!parsed_options_type::has_var_length_limits, - "nil::marshalling::option::var_length option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::var_length option is not applicable to bitmask_value field"); static_assert(!parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "bitmask_value field"); static_assert(!parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::sequence_size_forcing_enabled option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_forcing_enabled option is not applicable to " "bitmask_value field"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::sequence_length_forcing_enabled option is not applicable to " + "nil::crypto3::marshalling::option::sequence_length_forcing_enabled option is not applicable to " "bitmask_value field"); static_assert( !parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to bitmask_value field"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "bitmask_value field"); static_assert(!parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to " "bitmask_value field"); static_assert(!parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "bitmask_value field"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "bitmask_value field"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "bitmask_value field"); static_assert(!parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "bitmask_value field"); static_assert(!parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "bitmask_value field"); static_assert( !parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to bitmask_value field"); static_assert( !parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to bitmask_value field"); static_assert( !parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio_type option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::scaling_ratio_type option is not applicable to bitmask_value field"); static_assert(!parsed_options_type::has_units, - "nil::marshalling::option::Units option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::Units option is not applicable to bitmask_value field"); static_assert( !parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to bitmask_value field"); static_assert( !parsed_options_type::has_multi_range_validation, - "nil::marshalling::option::valid_num_value_range (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::valid_num_value_range (or similar) option is not applicable to " "bitmask_value field"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "bitmask_value field"); static_assert( !parsed_options_type::has_invalid_by_default, - "nil::marshalling::option::invalid_by_default option is not applicable to bitmask_value field"); + "nil::crypto3::marshalling::option::invalid_by_default option is not applicable to bitmask_value field"); integral_type intValue_; }; @@ -385,25 +385,25 @@ namespace nil { return field1.value() < field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::bitmask_value type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::bitmask_value type /// in order to have access to its internal types. - /// @related nil::marshalling::types::bitmask_value + /// @related nil::crypto3::marshalling::types::bitmask_value template inline bitmask_value & to_field_base(bitmask_value &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::bitmask_value type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::bitmask_value type /// in order to have access to its internal types. - /// @related nil::marshalling::types::bitmask_value + /// @related nil::crypto3::marshalling::types::bitmask_value template inline const bitmask_value & to_field_base(const bitmask_value &field) { return field; } -/// @brief Provide names for bits in nil::marshalling::types::bitmask_value field. +/// @brief Provide names for bits in nil::crypto3::marshalling::types::bitmask_value field. /// @details Defines BitIdx enum with all the provided values prefixed with /// "BitIdx_". For example usage of /// @code @@ -444,15 +444,15 @@ namespace nil { /// The macro MARSHALLING_BITMASK_BITS() should be used inside definition of the /// bitmask field to provide names for the bits for external use: /// @code -/// struct MyField : public nil::marshalling::types::bitmask_value<...> +/// struct MyField : public nil::crypto3::marshalling::types::bitmask_value<...> /// { /// MARSHALLING_BITMASK_BITS(first, second, third, fourth); /// } /// @endcode -/// @related nil::marshalling::types::bitmask_value +/// @related nil::crypto3::marshalling::types::bitmask_value #define MARSHALLING_BITMASK_BITS(...) MARSHALLING_DEFINE_ENUM(BitIdx, __VA_ARGS__) -/// @brief Generate access functions for bits in nil::marshalling::types::bitmask_value field. +/// @brief Generate access functions for bits in nil::crypto3::marshalling::types::bitmask_value field. /// @details The @ref MARSHALLING_BITMASK_BITS() macro defines @b BitIdx enum to /// be able to access internal bits. However, an ability to provide /// values to the enumeration values using @b =val suffixes doesn't @@ -461,7 +461,7 @@ namespace nil { /// listed in the parameters list, @b getBitValue_*() and @b set_bit_value_*() /// functions will be generated. For example, having the following definition /// @code -/// struct MyField : public nil::marshalling::types::bitmask_value<...> +/// struct MyField : public nil::crypto3::marshalling::types::bitmask_value<...> /// { /// ... /// MARSHALLING_BITMASK_BITS_ACCESS(first, third, fourth); @@ -469,7 +469,7 @@ namespace nil { /// @endcode /// is equivalent to having following functions defined: /// @code -/// struct MyField : public nil::marshalling::types::bitmask_value<...> +/// struct MyField : public nil::crypto3::marshalling::types::bitmask_value<...> /// { /// ... /// bool getBitValue_first() const { @@ -502,14 +502,14 @@ namespace nil { /// @ref MARSHALLING_BITMASK_BITS(). It means that MARSHALLING_BITMASK_BITS_ACCESS() /// macro can NOT be used without @ref MARSHALLING_BITMASK_BITS(). /// @code -/// struct MyField : public nil::marshalling::types::bitmask_value<...> +/// struct MyField : public nil::crypto3::marshalling::types::bitmask_value<...> /// { /// MARSHALLING_BITMASK_BITS(first, third=2, fourth); /// MARSHALLING_BITMASK_BITS_ACCESS(first, third, fourth); /// } /// @endcode /// @pre Must be used together with @ref MARSHALLING_BITMASK_BITS() -/// @related nil::marshalling::types::bitmask_value +/// @related nil::crypto3::marshalling::types::bitmask_value /// @warning Some compilers, such as @b clang or early versions of @b g++ /// may have problems compiling code generated by this macro even /// though it uses valid C++11 constructs in attempt to automatically identify the @@ -518,23 +518,23 @@ namespace nil { /// @ref MARSHALLING_BITMASK_BITS_ACCESS_NOTEMPLATE() macro instead. In /// case this macro needs to reside inside a @b template class, then /// there is a need to define inner @b Base type, which specifies -/// exact type of the @ref nil::marshalling::types::bitmask_value class. For example: +/// exact type of the @ref nil::crypto3::marshalling::types::bitmask_value class. For example: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// template /// class MyField : public -/// nil::marshalling::types::bitmask_value< +/// nil::crypto3::marshalling::types::bitmask_value< /// MyFieldBase, -/// nil::marshalling::types::fixed_length<1>, -/// nil::marshalling::types::bitmask_reserved_bits<0xf2, 0>, +/// nil::crypto3::marshalling::types::fixed_length<1>, +/// nil::crypto3::marshalling::types::bitmask_reserved_bits<0xf2, 0>, /// TExtraOptions... /// > /// { /// // Duplicate definition of the base class /// using Base = -/// nil::marshalling::types::bitmask_value< +/// nil::crypto3::marshalling::types::bitmask_value< /// MyFieldBase, -/// nil::marshalling::types::fixed_length<1>, +/// nil::crypto3::marshalling::types::fixed_length<1>, /// smarshalling::types::bitmask_reserved_bits<0xf2, 0>, /// TExtraOptions... /// >; @@ -545,10 +545,10 @@ namespace nil { /// @endcode #define MARSHALLING_BITMASK_BITS_ACCESS(...) \ MARSHALLING_AS_BITMASK_FUNC { \ - return nil::marshalling::types::to_field_base(*this); \ + return nil::crypto3::marshalling::types::to_field_base(*this); \ } \ MARSHALLING_AS_BITMASK_CONST_FUNC { \ - return nil::marshalling::types::to_field_base(*this); \ + return nil::crypto3::marshalling::types::to_field_base(*this); \ } \ MARSHALLING_DO_BIT_ACC_FUNC(asBitmask(), __VA_ARGS__) @@ -561,7 +561,7 @@ namespace nil { /// compilation fails and the class it is being used in is @b NOT a /// template one, please use @ref MARSHALLING_BITMASK_BITS_ACCESS_NOTEMPLATE() /// instead. -/// @related nil::marshalling::types::bitmask_value +/// @related nil::crypto3::marshalling::types::bitmask_value #define MARSHALLING_BITMASK_BITS_ACCESS_NOTEMPLATE(...) MARSHALLING_DO_BIT_ACC_FUNC((*this), __VA_ARGS__) /// @brief Combine usage of @ref MARSHALLING_BITMASK_BITS() and @ref MARSHALLING_BITMASK_BITS_ACCESS(). @@ -571,14 +571,14 @@ namespace nil { /// @ref MARSHALLING_BITMASK_BITS() and @ref MARSHALLING_BITMASK_BITS_ACCESS() with the /// same bit names. For example /// @code -/// struct MyField : public nil::marshalling::types::bitmask_value<...> +/// struct MyField : public nil::crypto3::marshalling::types::bitmask_value<...> /// { /// MARSHALLING_BITMASK_BITS_SEQ(first, second, third, fourth); /// } /// @endcode /// is equivalent to having /// @code -/// struct MyField : public nil::marshalling::types::bitmask_value<...> +/// struct MyField : public nil::crypto3::marshalling::types::bitmask_value<...> /// { /// enum BitIdx /// { @@ -599,7 +599,7 @@ namespace nil { /// void set_bit_value_fourth(bool value) {...} /// }; /// @endcode -/// @related nil::marshalling::types::bitmask_value +/// @related nil::crypto3::marshalling::types::bitmask_value /// @warning Some compilers, such as @b clang or early versions of @b g++ /// may have problems compiling code generated by this macro even /// though it uses valid C++11 constructs in attempt to automatically identify the @@ -608,23 +608,23 @@ namespace nil { /// @ref MARSHALLING_BITMASK_BITS_SEQ_NOTEMPLATE() macro instead. In /// case this macro needs to reside inside a @b template class, then /// there is a need to define inner @b Base type, which specifies -/// exact type of the @ref nil::marshalling::types::bitmask_value class. For example: +/// exact type of the @ref nil::crypto3::marshalling::types::bitmask_value class. For example: /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// template /// class MyField : public -/// nil::marshalling::types::bitmask_value< +/// nil::crypto3::marshalling::types::bitmask_value< /// MyFieldBase, -/// nil::marshalling::types::fixed_length<1>, -/// nil::marshalling::types::bitmask_reserved_bits<0xf0, 0>, +/// nil::crypto3::marshalling::types::fixed_length<1>, +/// nil::crypto3::marshalling::types::bitmask_reserved_bits<0xf0, 0>, /// TExtraOptions... /// > /// { /// // Duplicate definition of the base class /// using Base = -/// nil::marshalling::types::bitmask_value< +/// nil::crypto3::marshalling::types::bitmask_value< /// MyFieldBase, -/// nil::marshalling::types::fixed_length<1>, +/// nil::crypto3::marshalling::types::fixed_length<1>, /// scomms::types::bitmask_reserved_bits<0xf0, 0>, /// TExtraOptions... /// >; @@ -645,7 +645,7 @@ namespace nil { /// compilation fails and the class it is being used in is @b NOT a /// template one, please use @ref MARSHALLING_BITMASK_BITS_SEQ_NOTEMPLATE() /// instead. -/// @related nil::marshalling::types::bitmask_value +/// @related nil::crypto3::marshalling::types::bitmask_value #define MARSHALLING_BITMASK_BITS_SEQ_NOTEMPLATE(...) \ MARSHALLING_BITMASK_BITS(__VA_ARGS__) \ MARSHALLING_BITMASK_BITS_ACCESS_NOTEMPLATE(__VA_ARGS__) diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value/behaviour.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value/behaviour.hpp index d237284208..053c93f66e 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value/behaviour.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bitmask_value/behaviour.hpp @@ -28,7 +28,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle.hpp index 1ccc23bc72..676aa3ed57 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle.hpp @@ -35,57 +35,57 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { /// @brief Bundles multiple fields into a single field. /// @details The class wraps nicely multiple fields and provides /// expected single field API functions, such as length(), read(), write(), - /// valid(). It may be useful when a collection (nil::marshalling::types::array_list) of + /// valid(). It may be useful when a collection (nil::crypto3::marshalling::types::array_list) of /// complex fields is required. /// /// Refer to @ref sec_field_tutorial_bundle for tutorial and usage examples. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam TMembers All wrapped fields bundled together in /// std::tuple. /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field.@n /// Supported options are: - /// @li @ref nil::marshalling::option::default_value_initializer - All wrapped fields may + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer - All wrapped fields may /// specify their independent default value initializers. It is /// also possible to provide initializer for the bundle field which /// will set appropriate values to the fields based on some /// internal logic. - /// @li @ref nil::marshalling::option::contents_validator - All wrapped fields may specify + /// @li @ref nil::crypto3::marshalling::option::contents_validator - All wrapped fields may specify /// their independent validators. The bundle field considered to /// be valid if all the wrapped fields are valid. This option though, /// provides an ability to add extra validation logic that can /// observe value of more than one wrapped fields. For example, /// protocol specifies that if one specific field has value X, than /// other field is NOT allowed to have value Y. - /// @li @ref nil::marshalling::option::contents_refresher - The default refreshing + /// @li @ref nil::crypto3::marshalling::option::contents_refresher - The default refreshing /// behaviour is to call the @b refresh() member function of every /// member field. This option provides an ability to set a custom /// "refreshing" logic. - /// @li @ref nil::marshalling::option::custom_value_reader - It may be required to implement + /// @li @ref nil::crypto3::marshalling::option::custom_value_reader - It may be required to implement /// custom reading functionality instead of default behaviour of /// invoking read() member function of every member field. It is possible - /// to provide cusom reader functionality using nil::marshalling::option::custom_value_reader + /// to provide cusom reader functionality using nil::crypto3::marshalling::option::custom_value_reader /// option. - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/bundle.hpp /// @see @ref MARSHALLING_FIELD_MEMBERS_ACCESS() /// @see @ref MARSHALLING_FIELD_MEMBERS_ACCESS_NOTEMPLATE() template class bundle : private detail::adapt_basic_field_type, TOptions...> { using base_impl_type = detail::adapt_basic_field_type, TOptions...>; - static_assert(nil::detail::is_tuple::value, + static_assert(marshalling::detail::is_tuple::value, "TMembers is expected to be a tuple of std::tuple<...>"); static_assert(1U <= std::tuple_size::value, @@ -489,7 +489,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -507,63 +507,63 @@ namespace nil { private: static_assert( !parsed_options_type::has_ser_offset, - "nil::marshalling::option::num_value_ser_offset option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::num_value_ser_offset option is not applicable to bundle field"); static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::fixed_length option is not applicable to bundle field"); static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to bundle field"); static_assert(!parsed_options_type::has_var_length_limits, - "nil::marshalling::option::var_length option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::var_length option is not applicable to bundle field"); static_assert(!parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "bundle field"); static_assert( !parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::sequence_size_forcing_enabled option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::sequence_size_forcing_enabled option is not applicable to bundle field"); static_assert( !parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::sequence_length_forcing_enabled option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::sequence_length_forcing_enabled option is not applicable to bundle field"); static_assert(!parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to bundle field"); static_assert(!parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable " "to bundle field"); static_assert( !parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to bundle field"); static_assert(!parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "bundle field"); static_assert(!parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not " "applicable to bundle field"); static_assert(!parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not " "applicable to bundle field"); static_assert(!parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "bundle field"); static_assert(!parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "bundle field"); static_assert(!parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to bundle field"); static_assert(!parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to bundle field"); static_assert(!parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio_type option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::scaling_ratio_type option is not applicable to bundle field"); static_assert(!parsed_options_type::has_units, - "nil::marshalling::option::Units option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::Units option is not applicable to bundle field"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to bundle field"); static_assert(!parsed_options_type::has_multi_range_validation, - "nil::marshalling::option::valid_num_value_range (or similar) option is not applicable " + "nil::crypto3::marshalling::option::valid_num_value_range (or similar) option is not applicable " "to bundle field"); static_assert(!parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable " "to bundle field"); static_assert(!parsed_options_type::has_invalid_by_default, - "nil::marshalling::option::invalid_by_default option is not applicable to bundle field"); + "nil::crypto3::marshalling::option::invalid_by_default option is not applicable to bundle field"); }; /// @brief Equality comparison operator. @@ -628,18 +628,18 @@ namespace nil { return field1.value() >= field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::bundle type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::bundle type /// in order to have access to its internal types. - /// @related nil::marshalling::types::bundle + /// @related nil::crypto3::marshalling::types::bundle template inline bundle & to_field_base(bundle &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::bundle type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::bundle type /// in order to have access to its internal types. - /// @related nil::marshalling::types::bundle + /// @related nil::crypto3::marshalling::types::bundle template inline const bundle & to_field_base(const bundle &field) { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle/basic_type.hpp index cf7c1538b2..225205f6c2 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/bundle/basic_type.hpp @@ -37,7 +37,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -407,7 +407,7 @@ namespace nil { return write_no_status_helper(iter); } - static_assert(nil::detail::is_tuple::value, + static_assert(marshalling::detail::is_tuple::value, "value_type must be tuple"); value_type members_; }; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/adapt_basic_field.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/adapt_basic_field.hpp index 313594661d..fd82c9fcf8 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/adapt_basic_field.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/adapt_basic_field.hpp @@ -54,7 +54,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/common_funcs.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/common_funcs.hpp index 28f835faec..9ded428173 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/common_funcs.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/common_funcs.hpp @@ -32,7 +32,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/options_parser.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/options_parser.hpp index ad1737854f..e6fe801f57 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/options_parser.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/detail/options_parser.hpp @@ -31,7 +31,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -79,7 +79,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_custom_value_reader = true; @@ -87,14 +87,14 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_custom_read = true; }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_ser_offset = true; @@ -102,7 +102,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_fixed_length_limit = true; @@ -111,7 +111,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_fixed_bit_length_limit = true; @@ -119,7 +119,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_var_length_limits = true; @@ -128,28 +128,28 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_sequence_size_forcing = true; }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_sequence_length_forcing = true; }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_sequence_elem_length_forcing = true; }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_sequence_fixed_size = true; @@ -157,14 +157,14 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_sequence_fixed_size_use_fixed_size_storage = true; }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_sequence_size_field_prefix = true; @@ -173,7 +173,7 @@ namespace nil { template class options_parser< - nil::marshalling::option::sequence_ser_length_field_prefix, + nil::crypto3::marshalling::option::sequence_ser_length_field_prefix, TOptions...> : public options_parser { public: static const bool has_sequence_ser_length_field_prefix = true; @@ -184,7 +184,7 @@ namespace nil { template class options_parser< - nil::marshalling::option::sequence_elem_ser_length_field_prefix, + nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix, TOptions...> : public options_parser { public: static const bool has_sequence_elem_ser_length_field_prefix = true; @@ -195,7 +195,7 @@ namespace nil { template class options_parser< - nil::marshalling::option::sequence_elem_fixed_ser_length_field_prefix, + nil::crypto3::marshalling::option::sequence_elem_fixed_ser_length_field_prefix, TOptions...> : public options_parser { public: static const bool has_sequence_elem_fixed_ser_length_field_prefix = true; @@ -205,7 +205,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_sequence_trailing_field_suffix = true; @@ -213,7 +213,7 @@ namespace nil { }; template - class options_parser, + class options_parser, TOptions...> : public options_parser { public: static const bool has_sequence_termination_field_suffix = true; @@ -221,7 +221,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_default_value_initializer = true; @@ -229,7 +229,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_custom_validator = true; @@ -237,7 +237,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_contents_refresher = true; @@ -245,14 +245,14 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_custom_refresh = true; }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_fail_on_invalid = true; @@ -260,21 +260,21 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_ignore_invalid = true; }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_invalid_by_default = true; }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_fixed_size_storage = true; @@ -282,7 +282,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_custom_storage_type = true; @@ -290,7 +290,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_scaling_ratio = true; @@ -298,7 +298,7 @@ namespace nil { }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_units = true; @@ -307,14 +307,14 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_orig_data_view = true; }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_empty_serialization = true; @@ -346,7 +346,7 @@ namespace nil { TBase::has_multi_range_validation>::template type; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { using base_impl_type = options_parser; @@ -355,7 +355,7 @@ namespace nil { static_assert( !base_impl_type::has_multi_range_validation, "Sorry gcc-4.7 fails to compile valid C++11 code that allows multiple usage" - "of nil::marshalling::option::valid_num_value_range options. Either use it only once or" + "of nil::crypto3::marshalling::option::valid_num_value_range options. Either use it only once or" "upgrade your compiler."); #endif using multi_range_validation_ranges @@ -364,7 +364,7 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { using base_impl_type = options_parser; @@ -374,7 +374,7 @@ namespace nil { }; template - class options_parser, + class options_parser, TOptions...> : public options_parser { using base_impl_type = options_parser; @@ -383,7 +383,7 @@ namespace nil { static_assert( !base_impl_type::has_multi_range_validation, "Sorry gcc-4.7 fails to compile valid C++11 code that allows multiple usage" - "of nil::marshalling::option::valid_num_value_range options. Either use it only once or" + "of nil::crypto3::marshalling::option::valid_num_value_range options. Either use it only once or" "upgrade your compiler."); #endif using multi_range_validation_ranges @@ -392,14 +392,14 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_custom_version_update = true; }; template - class options_parser, TOptions...> + class options_parser, TOptions...> : public options_parser { public: static const bool has_versions_range = true; @@ -408,14 +408,14 @@ namespace nil { }; template - class options_parser + class options_parser : public options_parser { public: static const bool has_version_storage = true; }; template - class options_parser + class options_parser : public options_parser { }; template diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration.hpp index 93c6254585..0108fba783 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration.hpp @@ -24,7 +24,7 @@ //---------------------------------------------------------------------------// /// @file -/// Contains definition of nil::marshalling::types::enumeration +/// Contains definition of nil::crypto3::marshalling::types::enumeration #ifndef MARSHALLING_ENUM_VALUE_HPP #define MARSHALLING_ENUM_VALUE_HPP @@ -37,17 +37,17 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { /// @brief Enumerator value field. /// @details Sometimes dealing with enum values is much more convenient that - /// using integral values. nil::marshalling::types::enumeration is very similar to - /// nil::marshalling::types::integral, but receives underlying enum type in its + /// using integral values. nil::crypto3::marshalling::types::enumeration is very similar to + /// nil::crypto3::marshalling::types::integral, but receives underlying enum type in its /// template parameters instead of integral one. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam TEnum Enderlying enum type, can be either unscoped or scoped (enum class). /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field. If no option is provided, the field's value is serialized as is, @@ -60,34 +60,34 @@ namespace nil { /// Value2, /// Value3 /// } - /// using MyFieldBase = nil::marshalling::field_type; - /// using MyField =nil::marshalling::types::enumeration; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; + /// using MyField =nil::crypto3::marshalling::types::enumeration; /// @endcode /// The serialized value of the field in the example above will consume /// 2 bytes, because the underlying type of MyEnum is /// defined to be std::uint16_t. The value is serialized using big endian - /// notation because base field class receives nil::marshalling::option::BigEndian option.@n + /// notation because base field class receives nil::crypto3::marshalling::option::BigEndian option.@n /// Supported options are: - /// @li @ref nil::marshalling::option::fixed_length - /// @li @ref nil::marshalling::option::fixed_bit_length - /// @li @ref nil::marshalling::option::var_length - /// @li @ref nil::marshalling::num_value_ser_offset - /// @li @ref nil::marshalling::option::default_value_initializer or - /// nil::marshalling::option::default_num_value. - /// @li @ref nil::marshalling::option::contents_validator - /// @li @ref nil::marshalling::option::valid_num_value_range, @ref nil::marshalling::option::valid_num_value, - /// @ref nil::marshalling::option::valid_big_unsigned_num_value_range, @ref - /// nil::marshalling::option::valid_big_unsigned_num_value_range - /// @li @ref nil::marshalling::option::valid_ranges_clear - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::fail_on_invalid - /// @li @ref nil::marshalling::option::ignore_invalid - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::invalid_by_default - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::fixed_length + /// @li @ref nil::crypto3::marshalling::option::fixed_bit_length + /// @li @ref nil::crypto3::marshalling::option::var_length + /// @li @ref nil::crypto3::marshalling::num_value_ser_offset + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer or + /// nil::crypto3::marshalling::option::default_num_value. + /// @li @ref nil::crypto3::marshalling::option::contents_validator + /// @li @ref nil::crypto3::marshalling::option::valid_num_value_range, @ref nil::crypto3::marshalling::option::valid_num_value, + /// @ref nil::crypto3::marshalling::option::valid_big_unsigned_num_value_range, @ref + /// nil::crypto3::marshalling::option::valid_big_unsigned_num_value_range + /// @li @ref nil::crypto3::marshalling::option::valid_ranges_clear + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::fail_on_invalid + /// @li @ref nil::crypto3::marshalling::option::ignore_invalid + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::invalid_by_default + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/enumeration.hpp template class enumeration @@ -214,7 +214,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -231,57 +231,57 @@ namespace nil { private: static_assert(!parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "enumeration field"); static_assert(!parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::sequence_size_forcing_enabled option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_forcing_enabled option is not applicable to " "enumeration field"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::sequence_length_forcing_enabled option is not applicable to " + "nil::crypto3::marshalling::option::sequence_length_forcing_enabled option is not applicable to " "enumeration field"); static_assert( !parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to enumeration field"); + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to enumeration field"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "enumeration field"); static_assert(!parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to " "enumeration field"); static_assert(!parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "enumeration field"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "enumeration field"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "enumeration field"); static_assert(!parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "enumeration field"); static_assert(!parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "enumeration field"); static_assert( !parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to enumeration field"); + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to enumeration field"); static_assert( !parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to enumeration field"); + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to enumeration field"); static_assert( !parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio_type option is not applicable to enumeration field"); + "nil::crypto3::marshalling::option::scaling_ratio_type option is not applicable to enumeration field"); static_assert(!parsed_options_type::has_units, - "nil::marshalling::option::Units option is not applicable to enumeration field"); + "nil::crypto3::marshalling::option::Units option is not applicable to enumeration field"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to enumeration field"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to enumeration field"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "enumeration field"); }; @@ -320,18 +320,18 @@ namespace nil { return field1.value() < field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::enumeration type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::enumeration type /// in order to have access to its internal types. - /// @related nil::marshalling::types::enumeration + /// @related nil::crypto3::marshalling::types::enumeration template inline enumeration & to_field_base(enumeration &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::enumeration type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::enumeration type /// in order to have access to its internal types. - /// @related nil::marshalling::types::enumeration + /// @related nil::crypto3::marshalling::types::enumeration template inline const enumeration & to_field_base(const enumeration &field) { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration/basic_type.hpp index f5d5e50b3f..dd64f4601f 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/enumeration/basic_type.hpp @@ -32,7 +32,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value.hpp index d2a49f1218..89fbe34a17 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value.hpp @@ -33,7 +33,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { @@ -42,36 +42,36 @@ namespace nil { /// serialized as is (consumes 4 bytes for float, and 8 bytes for double), /// using big or little endian. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam T Basic underlying floating point type, must be either float or double. /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field. If no option is provided The field's value is serialized as is. /// @code - /// using MyFieldBase = nil::marshalling::field_type; - /// using MyField =nil::marshalling::types::float_value; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; + /// using MyField =nil::crypto3::marshalling::types::float_value; /// @endcode /// In the example above it will /// consume 4 bytes (because sizeof(float) == 4) and will /// be serialized using big endian notation.@n /// Supported options are: - /// @li @ref nil::marshalling::option::default_value_initializer or @ref - /// nil::marshalling::option::default_num_value. - /// @li @ref nil::marshalling::option::contents_validator - /// @li @ref nil::marshalling::option::valid_num_value_range, @ref nil::marshalling::option::valid_num_value, - /// @ref nil::marshalling::option::valid_big_unsigned_num_value_range, @ref - /// nil::marshalling::option::valid_big_unsigned_num_value_range - /// @li @ref nil::marshalling::option::valid_ranges_clear - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::fail_on_invalid - /// @li @ref nil::marshalling::option::ignore_invalid - /// @li @b nil::marshalling::option::Units* - all variants of value units, see + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer or @ref + /// nil::crypto3::marshalling::option::default_num_value. + /// @li @ref nil::crypto3::marshalling::option::contents_validator + /// @li @ref nil::crypto3::marshalling::option::valid_num_value_range, @ref nil::crypto3::marshalling::option::valid_num_value, + /// @ref nil::crypto3::marshalling::option::valid_big_unsigned_num_value_range, @ref + /// nil::crypto3::marshalling::option::valid_big_unsigned_num_value_range + /// @li @ref nil::crypto3::marshalling::option::valid_ranges_clear + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::fail_on_invalid + /// @li @ref nil::crypto3::marshalling::option::ignore_invalid + /// @li @b nil::crypto3::marshalling::option::Units* - all variants of value units, see /// @ref sec_field_tutorial_integral_units for details. - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::invalid_by_default - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::invalid_by_default + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/float_value.hpp template class float_value : private detail::adapt_basic_field_type, TOptions...> { @@ -187,7 +187,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -204,54 +204,54 @@ namespace nil { private: static_assert(!parsed_options_type::has_var_length_limits, - "nil::marshalling::option::var_length option is not applicable to float_value field"); + "nil::crypto3::marshalling::option::var_length option is not applicable to float_value field"); static_assert(!parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "float_value field"); static_assert(!parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::sequence_size_forcing_enabled option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_forcing_enabled option is not applicable to " "float_value field"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::sequence_length_forcing_enabled option is not applicable to " + "nil::crypto3::marshalling::option::sequence_length_forcing_enabled option is not applicable to " "float_value field"); static_assert( !parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to float_value field"); + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to float_value field"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "float_value field"); static_assert(!parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to " "float_value field"); static_assert(!parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "float_value field"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "float_value field"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "float_value field"); static_assert(!parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "float_value field"); static_assert(!parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "float_value field"); static_assert( !parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to float_value field"); + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to float_value field"); static_assert( !parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to float_value field"); + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to float_value field"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to float_value field"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to float_value field"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "float_value field"); }; @@ -288,18 +288,18 @@ namespace nil { return field1.value() < field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::float_value type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::float_value type /// in order to have access to its internal types. - /// @related nil::marshalling::types::float_value + /// @related nil::crypto3::marshalling::types::float_value template inline float_value & to_field_base(float_value &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::float_value type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::float_value type /// in order to have access to its internal types. - /// @related nil::marshalling::types::float_value + /// @related nil::crypto3::marshalling::types::float_value template inline const float_value & to_field_base(const float_value &field) { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value/basic_type.hpp index aa4fcff00d..e43e4dd44c 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/float_value/basic_type.hpp @@ -32,7 +32,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral.hpp index a38e72808c..eece863411 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral.hpp @@ -36,47 +36,47 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { /// @brief field_type that represent integral value. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam T Basic underlying integral type. /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field. If no option is provided The field's value is serialized as is. /// @code - /// using MyFieldBase = nil::marshalling::field_type; - /// using MyField = nil::marshalling::types::integral; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; + /// using MyField = nil::crypto3::marshalling::types::integral; /// @endcode /// In the example above it will /// consume 2 bytes (because sizeof(std::uint16_t) == 2) and will /// be serialized using big endian notation.@n /// Supported options are: - /// @li @ref nil::marshalling::option::fixed_length - /// @li @ref nil::marshalling::option::fixed_bit_length - /// @li @ref nil::marshalling::option::var_length - /// @li @ref nil::marshalling::option::num_value_ser_offset - /// @li @ref nil::marshalling::option::default_value_initializer or - /// nil::marshalling::option::default_num_value. - /// @li @ref nil::marshalling::option::contents_validator - /// @li @ref nil::marshalling::option::valid_num_value_range, @ref nil::marshalling::option::valid_num_value, - /// @ref nil::marshalling::option::valid_big_unsigned_num_value_range, @ref - /// nil::marshalling::option::valid_big_unsigned_num_value_range - /// @li @ref nil::marshalling::option::valid_ranges_clear - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::fail_on_invalid - /// @li @ref nil::marshalling::option::ignore_invalid - /// @li @ref nil::marshalling::option::scaling_ratio - /// @li @b nil::marshalling::option::Units* - all variants of value units, see + /// @li @ref nil::crypto3::marshalling::option::fixed_length + /// @li @ref nil::crypto3::marshalling::option::fixed_bit_length + /// @li @ref nil::crypto3::marshalling::option::var_length + /// @li @ref nil::crypto3::marshalling::option::num_value_ser_offset + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer or + /// nil::crypto3::marshalling::option::default_num_value. + /// @li @ref nil::crypto3::marshalling::option::contents_validator + /// @li @ref nil::crypto3::marshalling::option::valid_num_value_range, @ref nil::crypto3::marshalling::option::valid_num_value, + /// @ref nil::crypto3::marshalling::option::valid_big_unsigned_num_value_range, @ref + /// nil::crypto3::marshalling::option::valid_big_unsigned_num_value_range + /// @li @ref nil::crypto3::marshalling::option::valid_ranges_clear + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::fail_on_invalid + /// @li @ref nil::crypto3::marshalling::option::ignore_invalid + /// @li @ref nil::crypto3::marshalling::option::scaling_ratio + /// @li @b nil::crypto3::marshalling::option::Units* - all variants of value units, see /// @ref sec_field_tutorial_integral_units for details. - /// @li nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::invalid_by_default - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::invalid_by_default + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/integral.hpp template class integral : private detail::adapt_basic_field_type, TOptions...> { @@ -117,9 +117,9 @@ namespace nil { integral &operator=(const integral &) = default; /// @brief Scales value according to ratio specified in provided - /// nil::marshalling::option::scaling_ratio option. - /// @details If nil::marshalling::option::scaling_ratio option wasn't used, then - /// nil::marshalling::option::scaling_ratio<1,1> is assumed. + /// nil::crypto3::marshalling::option::scaling_ratio option. + /// @details If nil::crypto3::marshalling::option::scaling_ratio option wasn't used, then + /// nil::crypto3::marshalling::option::scaling_ratio<1,1> is assumed. /// @tparam TRet Return type for the scaled value. /// @return "(value() * Scaling_Num) / Scaling_Denom" when all values are /// casted to TRet type. @@ -236,7 +236,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -340,52 +340,52 @@ namespace nil { } static_assert(!parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "integral field"); static_assert( !parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::sequence_size_forcing_enabled option is not applicable to integral field"); + "nil::crypto3::marshalling::option::sequence_size_forcing_enabled option is not applicable to integral field"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::sequence_length_forcing_enabled option is not applicable to " + "nil::crypto3::marshalling::option::sequence_length_forcing_enabled option is not applicable to " "integral field"); static_assert( !parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to integral field"); + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to integral field"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "integral field"); static_assert( !parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to integral field"); + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to integral field"); static_assert(!parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "integral field"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "integral field"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "integral field"); static_assert(!parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "integral field"); static_assert(!parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "integral field"); static_assert( !parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to integral field"); + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to integral field"); static_assert( !parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to integral field"); + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to integral field"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to integral field"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to integral field"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "integral field"); }; @@ -422,17 +422,17 @@ namespace nil { return field1.value() < field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::integral type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::integral type /// in order to have access to its internal types. - /// @related nil::marshalling::types::integral + /// @related nil::crypto3::marshalling::types::integral template inline integral &to_field_base(integral &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::integral type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::integral type /// in order to have access to its internal types. - /// @related nil::marshalling::types::integral + /// @related nil::crypto3::marshalling::types::integral template inline const integral & to_field_base(const integral &field) { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral/basic_type.hpp index b5ef57ffa5..8e03d1439e 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/integral/basic_type.hpp @@ -30,7 +30,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value.hpp index c45cb7803b..a501d11508 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value.hpp @@ -37,15 +37,15 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { /// @brief Dummy field with "do-nothing" read/write operations. /// @details Can be used with other classes that require field types. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. - /// @extends nil::marshalling::field_type + /// nil::crypto3::marshalling::field_type. + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/no_value.hpp template class no_value : private detail::adapt_basic_field_type> { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value/basic_type.hpp index 7d294e46d4..6c9bfe7ef0 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/no_value/basic_type.hpp @@ -30,7 +30,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional.hpp index 48c4542bc1..d0cea911da 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional.hpp @@ -34,7 +34,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { @@ -45,16 +45,16 @@ namespace nil { /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field.@n /// Supported options are: - /// @li @ref nil::marshalling::option::default_value_initializer, @ref - /// nil::marshalling::option::default_optional_mode, - /// @ref nil::marshalling::option::optional_missing_by_default, or @ref - /// nil::marshalling::option::optional_exists_by_default. - /// @li @ref nil::marshalling::option::contents_validator. - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer, @ref + /// nil::crypto3::marshalling::option::default_optional_mode, + /// @ref nil::crypto3::marshalling::option::optional_missing_by_default, or @ref + /// nil::crypto3::marshalling::option::optional_exists_by_default. + /// @li @ref nil::crypto3::marshalling::option::contents_validator. + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/optional.hpp template class optional : private detail::adapt_basic_field_type, TOptions...> { @@ -224,7 +224,7 @@ namespace nil { /// @brief Read field value from input data sequence /// @details If field is marked as missing (mode is optional_mode::missing), - /// function returns nil::marshalling::ErrorStatus::Success without advancing iterator.@n + /// function returns nil::crypto3::marshalling::ErrorStatus::Success without advancing iterator.@n /// If field is marked as existing (mode is optional_mode::exists) the /// read() member function of the wrapped field object is invoked.@n /// If field is marked to be tentative (mode is optional_mode::tentative), @@ -232,7 +232,7 @@ namespace nil { /// value of the "len" parameter is greater than 0, i.e. there are /// still bytes available for reading, and field itself is marked as /// existing.@n Otherwise, field is marked as missing and - /// nil::marshalling::ErrorStatus::Success is returned. + /// nil::crypto3::marshalling::ErrorStatus::Success is returned. /// @param[in, out] iter Iterator to read the data. /// @param[in] len Number of bytes available for reading. /// @return Status of read operation. @@ -254,13 +254,13 @@ namespace nil { /// @brief Write current field value to output data sequence /// @details If field is marked as missing (mode is optional_mode::missing), - /// function returns nil::marshalling::ErrorStatus::Success without advancing iterator.@n + /// function returns nil::crypto3::marshalling::ErrorStatus::Success without advancing iterator.@n /// If field is marked as existing (mode is optional_mode::exists) the /// write() member function of the wrapped field object is invoked.@n /// If field is marked to be tentative (mode is optional_mode::tentative), /// the call redirected to wrapped field's write() member function if /// value of the "len" parameter is greater than 0, i.e. there is - /// space available for writing.@n Otherwise, nil::marshalling::ErrorStatus::Success + /// space available for writing.@n Otherwise, nil::crypto3::marshalling::ErrorStatus::Success /// is returned. /// @param[in, out] iter Iterator to write the data. /// @param[in] len Maximal number of bytes that can be written. @@ -287,7 +287,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -305,7 +305,7 @@ namespace nil { private: static_assert( !parsed_options_type::has_invalid_by_default, - "nil::marshalling::option::invalid_by_default option is not applicable to optional field"); + "nil::crypto3::marshalling::option::invalid_by_default option is not applicable to optional field"); }; /// @brief Equality comparison operator. @@ -384,17 +384,17 @@ namespace nil { return field2 <= field1; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::optional type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::optional type /// in order to have access to its internal types. - /// @related nil::marshalling::types::optional + /// @related nil::crypto3::marshalling::types::optional template inline optional &to_field_base(optional &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::optional type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::optional type /// in order to have access to its internal types. - /// @related nil::marshalling::types::optional + /// @related nil::crypto3::marshalling::types::optional template inline const optional &to_field_base(const optional &field) { return field; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional/basic_type.hpp index 8063481b44..f1f7215193 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional/basic_type.hpp @@ -31,18 +31,18 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { template - class basic_optional : public nil::marshalling::field_type< - nil::marshalling::option::endian, - nil::marshalling::option::version_type> { - using base_impl_type = nil::marshalling::field_type< - nil::marshalling::option::endian, - nil::marshalling::option::version_type>; + class basic_optional : public nil::crypto3::marshalling::field_type< + nil::crypto3::marshalling::option::endian, + nil::crypto3::marshalling::option::version_type> { + using base_impl_type = nil::crypto3::marshalling::field_type< + nil::crypto3::marshalling::option::endian, + nil::crypto3::marshalling::option::version_type>; public: using field_type = TField; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional_mode.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional_mode.hpp index ba0e2941bd..5c597f1524 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional_mode.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/optional_mode.hpp @@ -24,16 +24,16 @@ //---------------------------------------------------------------------------// /// @file nil/marshalling/types/optional_mode.hpp -/// Contains definition of the mode used for nil::marshalling::types::optional fields. +/// Contains definition of the mode used for nil::crypto3::marshalling::types::optional fields. #ifndef MARSHALLING_OPTIONAL_MODE_HPP #define MARSHALLING_OPTIONAL_MODE_HPP -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { - /// @brief Mode to be used by nil::marshalling::types::optional + /// @brief Mode to be used by nil::crypto3::marshalling::types::optional /// @headerfile nil/marshalling/types/optional_mode.hpp enum class optional_mode { tentative, ///< The field existence is tentative, i.e. If there is enough bytes diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string.hpp index a83edbd0ac..ace63140c1 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string.hpp @@ -35,41 +35,41 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { /// @brief field_type that represents a string. /// @details By default uses /// std::string, - /// for internal storage, unless nil::marshalling::option::fixed_size_storage option is used, - /// which forces usage of nil::marshalling::container::static_string instead. + /// for internal storage, unless nil::crypto3::marshalling::option::fixed_size_storage option is used, + /// which forces usage of nil::crypto3::marshalling::container::static_string instead. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field.@n /// Supported options are: - /// @li @ref nil::marshalling::option::fixed_size_storage - /// @li @ref nil::marshalling::option::custom_storage_type - /// @li @ref nil::marshalling::option::sequence_size_field_prefix - /// @li @ref nil::marshalling::option::sequence_ser_length_field_prefix - /// @li @ref nil::marshalling::option::sequence_size_forcing_enabled - /// @li @ref nil::marshalling::option::sequence_length_forcing_enabled - /// @li @ref nil::marshalling::option::sequence_fixed_size - /// @li @ref nil::marshalling::option::sequence_termination_field_suffix - /// @li @ref nil::marshalling::option::sequence_trailing_field_suffix - /// @li @ref nil::marshalling::option::default_value_initializer - /// @li @ref nil::marshalling::option::contents_validator - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::fail_on_invalid - /// @li @ref nil::marshalling::option::ignore_invalid - /// @li @ref nil::marshalling::option::orig_data_view - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::invalid_by_default - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::fixed_size_storage + /// @li @ref nil::crypto3::marshalling::option::custom_storage_type + /// @li @ref nil::crypto3::marshalling::option::sequence_size_field_prefix + /// @li @ref nil::crypto3::marshalling::option::sequence_ser_length_field_prefix + /// @li @ref nil::crypto3::marshalling::option::sequence_size_forcing_enabled + /// @li @ref nil::crypto3::marshalling::option::sequence_length_forcing_enabled + /// @li @ref nil::crypto3::marshalling::option::sequence_fixed_size + /// @li @ref nil::crypto3::marshalling::option::sequence_termination_field_suffix + /// @li @ref nil::crypto3::marshalling::option::sequence_trailing_field_suffix + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer + /// @li @ref nil::crypto3::marshalling::option::contents_validator + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::fail_on_invalid + /// @li @ref nil::crypto3::marshalling::option::ignore_invalid + /// @li @ref nil::crypto3::marshalling::option::orig_data_view + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::invalid_by_default + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/string.hpp template class string : private detail::string_base_type { @@ -89,10 +89,10 @@ namespace nil { using tag = tag::string; /// @brief Type of underlying value. - /// @details If nil::marshalling::option::fixed_size_storage option is NOT used, the + /// @details If nil::crypto3::marshalling::option::fixed_size_storage option is NOT used, the /// value_type is std::string, otherwise it becomes - /// nil::marshalling::container::static_string, where TSize is a size - /// provided to nil::marshalling::option::fixed_size_storage option. + /// nil::crypto3::marshalling::container::static_string, where TSize is a size + /// provided to nil::crypto3::marshalling::option::fixed_size_storage option. using value_type = typename base_impl_type::value_type; /// @brief Default constructor @@ -129,10 +129,10 @@ namespace nil { /// @brief Read field value from input data sequence /// @details By default, the read operation will try to consume all the /// data available, unless size limiting option (such as - /// nil::marshalling::option::sequence_size_field_prefix, - /// nil::marshalling::option::sequence_fixed_size, - /// nil::marshalling::option::sequence_size_forcing_enabled, - /// nil::marshalling::option::sequence_length_forcing_enabled) is used. + /// nil::crypto3::marshalling::option::sequence_size_field_prefix, + /// nil::crypto3::marshalling::option::sequence_fixed_size, + /// nil::crypto3::marshalling::option::sequence_size_forcing_enabled, + /// nil::crypto3::marshalling::option::sequence_length_forcing_enabled) is used. /// @param[in, out] iter Iterator to read the data. /// @param[in] len Number of bytes available for reading. /// @return Status of read operation. @@ -191,7 +191,7 @@ namespace nil { /// @brief Write current field value to output data sequence /// @details By default, the write operation will write all the - /// characters the field contains. If nil::marshalling::option::sequence_fixed_size option + /// characters the field contains. If nil::crypto3::marshalling::option::sequence_fixed_size option /// is used, the number of characters, that is going to be written, is /// exactly as the option specifies. If underlying string storage /// doesn't contain enough data, the '\0' characters will @@ -228,7 +228,7 @@ namespace nil { /// @brief Force number of characters that must be read in the next read() /// invocation. - /// @details Exists only if nil::marshalling::option::sequence_size_forcing_enabled option has been + /// @details Exists only if nil::crypto3::marshalling::option::sequence_size_forcing_enabled option has been /// used. /// @param[in] count Number of elements to read during following read operation. void force_read_elem_count(std::size_t count) { @@ -237,14 +237,14 @@ namespace nil { /// @brief Clear forcing of the number of characters that must be read in /// the next read() invocation. - /// @details Exists only if nil::marshalling::option::sequence_size_forcing_enabled option has been + /// @details Exists only if nil::crypto3::marshalling::option::sequence_size_forcing_enabled option has been /// used. void clear_read_elem_count() { base_impl_type::clear_read_elem_count(); } /// @brief Force available length for the next read() invocation. - /// @details Exists only if @ref nil::marshalling::option::sequence_length_forcing_enabled option has been + /// @details Exists only if @ref nil::crypto3::marshalling::option::sequence_length_forcing_enabled option has been /// used. /// @param[in] count Number of elements to read during following read operation. void force_read_length(std::size_t count) { @@ -253,7 +253,7 @@ namespace nil { /// @brief Clear forcing of the available length in the next read() /// invocation. - /// @details Exists only if @ref nil::marshalling::option::sequence_length_forcing_enabled option has been + /// @details Exists only if @ref nil::crypto3::marshalling::option::sequence_length_forcing_enabled option has been /// used. void clear_read_length_forcing() { return base_impl_type::clear_read_length_forcing(); @@ -265,7 +265,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -325,28 +325,28 @@ namespace nil { static_assert( !parsed_options_type::has_ser_offset, - "nil::marshalling::option::num_value_ser_offset option is not applicable to string field"); + "nil::crypto3::marshalling::option::num_value_ser_offset option is not applicable to string field"); static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to string field"); + "nil::crypto3::marshalling::option::fixed_length option is not applicable to string field"); static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to string field"); + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to string field"); static_assert(!parsed_options_type::has_var_length_limits, - "nil::marshalling::option::var_length option is not applicable to string field"); + "nil::crypto3::marshalling::option::var_length option is not applicable to string field"); static_assert(!parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio_type option is not applicable to string field"); + "nil::crypto3::marshalling::option::scaling_ratio_type option is not applicable to string field"); static_assert(!parsed_options_type::has_units, - "nil::marshalling::option::Units option is not applicable to string field"); + "nil::crypto3::marshalling::option::Units option is not applicable to string field"); static_assert(!parsed_options_type::has_multi_range_validation, - "nil::marshalling::option::valid_num_value_range (or similar) option is not applicable " + "nil::crypto3::marshalling::option::valid_num_value_range (or similar) option is not applicable " "to string field"); static_assert(!parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not " "applicable to string field"); static_assert(!parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not " "applicable to string field"); static_assert(!parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable " "to string field"); }; @@ -384,17 +384,17 @@ namespace nil { return field1.value() < field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::string type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::string type /// in order to have access to its internal types. - /// @related nil::marshalling::types::string + /// @related nil::crypto3::marshalling::types::string template inline string &to_field_base(string &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::string type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::string type /// in order to have access to its internal types. - /// @related nil::marshalling::types::string + /// @related nil::crypto3::marshalling::types::string template inline const string &to_field_base(const string &field) { return field; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/basic_type.hpp index 87815e7bfc..ba13ad7734 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/basic_type.hpp @@ -39,7 +39,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/behaviour.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/behaviour.hpp index 4601d71f57..bbe02dc1fc 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/behaviour.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/behaviour.hpp @@ -38,7 +38,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -48,7 +48,7 @@ namespace nil { template<> struct string_orig_data_view_storage_type { - using type = nil::marshalling::container::string_view; + using type = nil::crypto3::marshalling::container::string_view; }; template<> @@ -62,7 +62,7 @@ namespace nil { template<> struct string_fixed_size_use_fixed_size_storage_type { template - using type = nil::marshalling::container::static_string; + using type = nil::crypto3::marshalling::container::static_string; }; template<> @@ -77,7 +77,7 @@ namespace nil { template<> struct string_fixed_size_storage_type { template - using type = nil::marshalling::container::static_string; + using type = nil::crypto3::marshalling::container::static_string; }; template<> diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/type_traits.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/type_traits.hpp index 4491253b95..526b433547 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/type_traits.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/string/type_traits.hpp @@ -39,7 +39,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -50,7 +50,7 @@ namespace nil { }; template - struct string_max_length_retrieve_helper> { + struct string_max_length_retrieve_helper> { static const std::size_t value = TSize - 1; }; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/tag.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/tag.hpp index 07bb457102..81cb9660cb 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/tag.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/tag.hpp @@ -26,7 +26,7 @@ #ifndef MARSHALLING_TAG_HPP #define MARSHALLING_TAG_HPP -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace tag { diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant.hpp index 90a4eb25f5..4fbe3b0d26 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant.hpp @@ -37,7 +37,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { @@ -53,7 +53,7 @@ namespace nil { /// /// Refer to @ref sec_field_tutorial_variant for tutorial and usage examples. /// @tparam TFieldBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam TMembers All supported field types bundled together in /// std::tuple. /// This parameter is used to determine the size of the contained buffer @@ -61,35 +61,35 @@ namespace nil { /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field.@n /// Supported options are: - /// @li @ref nil::marshalling::option::default_value_initializer - All wrapped fields may + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer - All wrapped fields may /// specify their independent default value initializers. It is /// also possible to provide initializer for the variant field which /// will set appropriate values to the fields based on some /// internal logic. - /// @li @ref nil::marshalling::option::contents_validator - All wrapped fields may specify + /// @li @ref nil::crypto3::marshalling::option::contents_validator - All wrapped fields may specify /// their independent validators. The bundle field considered to /// be valid if all the wrapped fields are valid. This option though, /// provides an ability to add extra validation logic that can /// observe value of more than one wrapped fields. For example, /// protocol specifies that if one specific field has value X, than /// other field is NOT allowed to have value Y. - /// @li @ref nil::marshalling::option::contents_refresher - The default @b refresh() + /// @li @ref nil::crypto3::marshalling::option::contents_refresher - The default @b refresh() /// behavior is to call @b refresh() member function of the contained /// field (if such exists). This option allows specifying the custom /// refreshing behaviour. - /// @li @ref nil::marshalling::option::custom_value_reader - It may be required to implement + /// @li @ref nil::crypto3::marshalling::option::custom_value_reader - It may be required to implement /// custom reading functionality instead of default behaviour of /// invoking read() member function of every member field. It is possible - /// to provide cusom reader functionality using nil::marshalling::option::custom_value_reader + /// to provide cusom reader functionality using nil::crypto3::marshalling::option::custom_value_reader /// option. - /// @li @ref nil::marshalling::option::default_variant_index - By default the variant field + /// @li @ref nil::crypto3::marshalling::option::default_variant_index - By default the variant field /// doesn't have any valid contents. This option may be used to specify /// the index of the default member field. - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/variant.hpp /// @see MARSHALLING_VARIANT_MEMBERS_ACCESS() /// @see MARSHALLING_VARIANT_MEMBERS_ACCESS_NOTEMPLATE() @@ -98,7 +98,7 @@ namespace nil { using base_impl_type = detail::adapt_basic_field_type, TOptions...>; - static_assert(nil::detail::is_tuple::value, + static_assert(marshalling::detail::is_tuple::value, "TMembers is expected to be a tuple of std::tuple<...>"); static_assert(1U < std::tuple_size::value, "Number of members is expected to be at least 2."); @@ -173,7 +173,7 @@ namespace nil { /// @brief Read field value from input data sequence /// @details Invokes read() member function over every possible field - /// in order of definition until nil::marshalling::ErrorStatus::Success is returned. + /// in order of definition until nil::crypto3::marshalling::ErrorStatus::Success is returned. /// @param[in, out] iter Iterator to read the data. /// @param[in] size Number of bytes available for reading. /// @return Status of read operation. @@ -190,7 +190,7 @@ namespace nil { /// @brief Write current field value to output data sequence /// @details Invokes write() member function of the contained field if such /// exists. If the variant field doesn't contain any valid field, the - /// function doesn't advance the iterator, but returns nil::marshalling::ErrorStatus::Success. + /// function doesn't advance the iterator, but returns nil::crypto3::marshalling::ErrorStatus::Success. /// @param[in, out] iter Iterator to write the data. /// @param[in] size Maximal number of bytes that can be written. /// @return Status of write operation. @@ -356,7 +356,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -374,66 +374,66 @@ namespace nil { private: static_assert( !parsed_options_type::has_ser_offset, - "nil::marshalling::option::num_value_ser_offset option is not applicable to variant field"); + "nil::crypto3::marshalling::option::num_value_ser_offset option is not applicable to variant field"); static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to variant field"); + "nil::crypto3::marshalling::option::fixed_length option is not applicable to variant field"); static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to variant field"); + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to variant field"); static_assert(!parsed_options_type::has_var_length_limits, - "nil::marshalling::option::var_length option is not applicable to variant field"); + "nil::crypto3::marshalling::option::var_length option is not applicable to variant field"); static_assert(!parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "variant field"); static_assert( !parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::sequence_size_forcing_enabled option is not applicable to variant field"); + "nil::crypto3::marshalling::option::sequence_size_forcing_enabled option is not applicable to variant field"); static_assert( !parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::sequence_length_forcing_enabled option is not applicable to variant field"); + "nil::crypto3::marshalling::option::sequence_length_forcing_enabled option is not applicable to variant field"); static_assert( !parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to variant field"); + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to variant field"); static_assert(!parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable " "to variant field"); static_assert( !parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to variant field"); + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to variant field"); static_assert(!parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "variant field"); static_assert(!parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not " "applicable to variant field"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_fixed_ser_length_field_prefix option is not applicable " + "nil::crypto3::marshalling::option::sequence_elem_fixed_ser_length_field_prefix option is not applicable " "to variant field"); static_assert(!parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "variant field"); static_assert(!parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "variant field"); static_assert(!parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to variant field"); + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to variant field"); static_assert( !parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to variant field"); + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to variant field"); static_assert(!parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio_type option is not applicable to variant field"); + "nil::crypto3::marshalling::option::scaling_ratio_type option is not applicable to variant field"); static_assert(!parsed_options_type::has_units, - "nil::marshalling::option::Units option is not applicable to variant field"); + "nil::crypto3::marshalling::option::Units option is not applicable to variant field"); static_assert(!parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to variant field"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to variant field"); static_assert(!parsed_options_type::has_multi_range_validation, - "nil::marshalling::option::valid_num_value_range (or similar) option is not applicable " + "nil::crypto3::marshalling::option::valid_num_value_range (or similar) option is not applicable " "to variant field"); static_assert(!parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable " "to variant field"); static_assert(!parsed_options_type::has_invalid_by_default, - "nil::marshalling::option::invalid_by_default option is not applicable to variant field"); + "nil::crypto3::marshalling::option::invalid_by_default option is not applicable to variant field"); }; namespace detail { @@ -501,18 +501,18 @@ namespace nil { return field1.value() != field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::variant type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::variant type /// in order to have access to its internal types. - /// @related nil::marshalling::types::variant + /// @related nil::crypto3::marshalling::types::variant template inline variant & to_field_base(variant &field) { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::variant type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::variant type /// in order to have access to its internal types. - /// @related nil::marshalling::types::variant + /// @related nil::crypto3::marshalling::types::variant template inline const variant & to_field_base(const variant &field) { @@ -520,19 +520,19 @@ namespace nil { } /// @brief Add convenience access enum and functions to the members of -/// @ref nil::marshalling::types::variant field. -/// @details All the possible field types the @ref nil::marshalling::types::variant field +/// @ref nil::crypto3::marshalling::types::variant field. +/// @details All the possible field types the @ref nil::crypto3::marshalling::types::variant field /// can contain are bundled in /// std::tuple /// and provided as a template parameter to the definition of the -/// nil::marshalling::types::variant field. +/// nil::crypto3::marshalling::types::variant field. /// @code -/// using MyFieldBase = nil::marshalling::field_type; +/// using MyFieldBase = nil::crypto3::marshalling::field_type; /// using ... Field1; /// using ... Field2; /// using ... Field3; /// using MyField = -/// nil::marshalling::types::variant< +/// nil::crypto3::marshalling::types::variant< /// MyFieldBase, /// std::tuple /// >; @@ -544,10 +544,10 @@ namespace nil { /// However, it would be convenient to provide names and easier access to /// all the poisble variants. The MARSHALLING_VARIANT_MEMBERS_ACCESS() macro does exactly /// that when used inside the field class definition. Just inherit from -/// the nil::marshalling::types::variant class and use the macro inside with the names for the +/// the nil::crypto3::marshalling::types::variant class and use the macro inside with the names for the /// member fields: /// @code -/// class MyField : public nil::marshalling::types::variant<...> +/// class MyField : public nil::crypto3::marshalling::types::variant<...> /// { /// public: /// MARSHALLING_FIELD_MEMBERS_ACCESS(member1, member2, member3); @@ -556,7 +556,7 @@ namespace nil { /// It would be equivalent to having the following types and functions /// definitions: /// @code -/// class MyField : public nil::marshalling::types::variant<...> +/// class MyField : public nil::crypto3::marshalling::types::variant<...> /// { /// public: /// // Access indices for member fields @@ -634,7 +634,7 @@ namespace nil { /// /// See @ref sec_field_tutorial_variant for more examples and details /// @param[in] ... List of member fields' names. -/// @related nil::marshalling::types::variant +/// @related nil::crypto3::marshalling::types::variant /// @warning Some compilers, such as @b clang or early versions of @b g++ /// may have problems compiling code generated by this macro even /// though it uses valid C++11 constructs in attempt to automatically identify the @@ -643,11 +643,11 @@ namespace nil { /// MARSHALLING_VARIANT_MEMBERS_ACCESS_NOTEMPLATE() macro instead. In /// case this macro needs to reside inside a @b template class, then /// there is a need to define inner @b Base type, which specifies -/// exact type of the @ref nil::marshalling::types::variant class. For example: +/// exact type of the @ref nil::crypto3::marshalling::types::variant class. For example: /// @code /// template /// class MyField : public -/// nil::marshalling::types::variant< +/// nil::crypto3::marshalling::types::variant< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -655,7 +655,7 @@ namespace nil { /// { /// // Duplicate the base class definition /// using Base = -/// nil::marshalling::types::variant< +/// nil::crypto3::marshalling::types::variant< /// MyFieldBase, /// std::tuple, /// TExtraOptions... @@ -667,14 +667,14 @@ namespace nil { #define MARSHALLING_VARIANT_MEMBERS_ACCESS(...) \ MARSHALLING_EXPAND(MARSHALLING_DEFINE_FIELD_ENUM(__VA_ARGS__)) \ MARSHALLING_AS_VARIANT_FUNC { \ - auto &var = nil::marshalling::types::to_field_base(*this); \ + auto &var = nil::crypto3::marshalling::types::to_field_base(*this); \ using Var = typename std::decay::type; \ static_assert(std::tuple_size::value == FieldIdx_numOfValues, \ "Invalid number of names for variant field"); \ return var; \ } \ MARSHALLING_AS_VARIANT_CONST_FUNC { \ - auto &var = nil::marshalling::types::to_field_base(*this); \ + auto &var = nil::crypto3::marshalling::types::to_field_base(*this); \ using Var = typename std::decay::type; \ static_assert(std::tuple_size::value == FieldIdx_numOfValues, \ "Invalid number of names for variant field"); \ @@ -691,7 +691,7 @@ namespace nil { /// compilation fails and the class it is being used in is @b NOT a /// template one, please use @ref MARSHALLING_VARIANT_MEMBERS_ACCESS_NOTEMPLATE() /// instead. -/// @related nil::marshalling::types::variant +/// @related nil::crypto3::marshalling::types::variant #define MARSHALLING_VARIANT_MEMBERS_ACCESS_NOTEMPLATE(...) \ MARSHALLING_EXPAND(MARSHALLING_DEFINE_FIELD_ENUM(__VA_ARGS__)) \ MARSHALLING_DO_VARIANT_MEM_ACC_FUNC_NOTEMPLATE(__VA_ARGS__) diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant/basic_type.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant/basic_type.hpp index 413b7ed644..f9569fce5d 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant/basic_type.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/types/variant/basic_type.hpp @@ -35,7 +35,7 @@ #include #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace types { namespace detail { @@ -577,7 +577,7 @@ namespace nil { std::size_t memIdx_ = members_count; static const std::size_t members_count = std::tuple_size::value; - static_assert(nil::detail::is_tuple::value, + static_assert(marshalling::detail::is_tuple::value, "value_type must be tuple"); static_assert(0U < members_count, "value_type must be non-empty tuple"); }; diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/units.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/units.hpp index d78f878c43..e7f7dffdfd 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/units.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/units.hpp @@ -34,7 +34,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace units { namespace detail { @@ -209,7 +209,7 @@ namespace nil { template TRet get_time(const TField &field) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::Time>(), + nil::crypto3::marshalling::traits::units::Time>(), "The field is expected to contain \"time\" units."); return units_value_converter::get_value(field); } @@ -217,7 +217,7 @@ namespace nil { template void set_time(TField &field, TVal &&val) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::Time>(), + nil::crypto3::marshalling::traits::units::Time>(), "The field is expected to contain \"time\" units."); units_value_converter::set_value(field, std::forward(val)); } @@ -225,7 +225,7 @@ namespace nil { template TRet get_distance(const TField &field) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::distance>(), + nil::crypto3::marshalling::traits::units::distance>(), "The field is expected to contain \"distance\" units."); return units_value_converter::get_value(field); } @@ -233,7 +233,7 @@ namespace nil { template void set_distance(TField &field, TVal &&val) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::distance>(), + nil::crypto3::marshalling::traits::units::distance>(), "The field is expected to contain \"distance\" units."); units_value_converter::set_value(field, std::forward(val)); } @@ -241,7 +241,7 @@ namespace nil { template TRet get_speed(const TField &field) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::speed>(), + nil::crypto3::marshalling::traits::units::speed>(), "The field is expected to contain \"speed\" units."); return units_value_converter::get_value(field); } @@ -249,7 +249,7 @@ namespace nil { template void set_speed(TField &field, TVal &&val) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::speed>(), + nil::crypto3::marshalling::traits::units::speed>(), "The field is expected to contain \"speed\" units."); units_value_converter::set_value(field, std::forward(val)); } @@ -257,7 +257,7 @@ namespace nil { template TRet get_frequency(const TField &field) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::frequency>(), + nil::crypto3::marshalling::traits::units::frequency>(), "The field is expected to contain \"frequency\" units."); return units_value_converter::get_value(field); } @@ -265,7 +265,7 @@ namespace nil { template void set_frequency(TField &field, TVal &&val) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::frequency>(), + nil::crypto3::marshalling::traits::units::frequency>(), "The field is expected to contain \"frequency\" units."); units_value_converter::set_value(field, std::forward(val)); } @@ -280,14 +280,14 @@ namespace nil { template static TRet get_value(const TField &field) { using field_type = typename std::decay::type; - static_assert(detail::has_expected_units(), + static_assert(detail::has_expected_units(), "The field is expected to contain \"angle\" units."); using tag = typename std::conditional< std::is_same::value, same_units_tag, typename ::std::conditional< - std::is_same::value, + std::is_same::value, degrees_to_radians_tag, radians_to_degrees_tag>::type>::type; @@ -297,7 +297,7 @@ namespace nil { template static void set_value(TField &field, TVal &&val) { using field_type = typename std::decay::type; - static_assert(detail::has_expected_units(), + static_assert(detail::has_expected_units(), "The field is expected to contain \"angle\" units."); using tag = typename std::conditional< @@ -305,7 +305,7 @@ namespace nil { same_units_tag, typename ::std::conditional< std::is_same::value, + typename nil::crypto3::marshalling::traits::units::radians_ratio>::value, radians_to_degrees_tag, degrees_to_radians_tag>::type>::type; @@ -326,7 +326,7 @@ namespace nil { static TRet get_value_internal(const TField &field, degrees_to_radians_tag) { using field_type = typename std::decay::type; static_assert(std::is_same::value, + nil::crypto3::marshalling::traits::units::degrees_ratio>::value, "The field is expected to contain degrees."); return PI::value * units_value_converter::get_value(field); @@ -336,7 +336,7 @@ namespace nil { static TRet get_value_internal(const TField &field, radians_to_degrees_tag) { using field_type = typename std::decay::type; static_assert(std::is_same::value, + nil::crypto3::marshalling::traits::units::radians_ratio>::value, "The field is expected to contain radians."); return units_value_converter::get_value(field) / PI::value; @@ -351,7 +351,7 @@ namespace nil { static void set_value_internal(TField &field, TVal &&val, degrees_to_radians_tag) { using field_type = typename std::decay::type; static_assert(std::is_same::value, + nil::crypto3::marshalling::traits::units::radians_ratio>::value, "The field is expected to contain radians."); using value_type = typename std::decay::type; @@ -365,7 +365,7 @@ namespace nil { static void set_value_internal(TField &field, TVal &&val, radians_to_degrees_tag) { using field_type = typename std::decay::type; static_assert(std::is_same::value, + nil::crypto3::marshalling::traits::units::degrees_ratio>::value, "The field is expected to contain degrees."); using value_type = typename std::decay::type; @@ -390,7 +390,7 @@ namespace nil { template TRet get_current(const TField &field) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::current>(), + nil::crypto3::marshalling::traits::units::current>(), "The field is expected to contain \"current\" units."); return units_value_converter::get_value(field); } @@ -398,7 +398,7 @@ namespace nil { template void set_current(TField &field, TVal &&val) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::current>(), + nil::crypto3::marshalling::traits::units::current>(), "The field is expected to contain \"current\" units."); units_value_converter::set_value(field, std::forward(val)); } @@ -406,7 +406,7 @@ namespace nil { template TRet get_voltage(const TField &field) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::voltage>(), + nil::crypto3::marshalling::traits::units::voltage>(), "The field is expected to contain \"voltage\" units."); return units_value_converter::get_value(field); } @@ -414,7 +414,7 @@ namespace nil { template void set_voltage(TField &field, TVal &&val) { static_assert(detail::has_expected_units::type, - nil::marshalling::traits::units::voltage>(), + nil::crypto3::marshalling::traits::units::voltage>(), "The field is expected to contain \"voltage\" units."); units_value_converter::set_value(field, std::forward(val)); } @@ -427,13 +427,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_nanoseconds(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing nanoseconds value. @@ -441,14 +441,14 @@ namespace nil { /// provided nanoseconds into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_nanoseconds(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as microseconds. @@ -457,13 +457,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_microseconds(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing microseconds value. @@ -471,14 +471,14 @@ namespace nil { /// provided microseconds into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_microseconds(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as milliseconds. @@ -487,13 +487,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_milliseconds(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing milliseconds value. @@ -501,14 +501,14 @@ namespace nil { /// provided milliseconds into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_milliseconds(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as seconds. @@ -517,13 +517,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_seconds(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing seconds value. @@ -531,14 +531,14 @@ namespace nil { /// provided seconds into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_seconds(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as minutes. @@ -547,13 +547,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_minutes(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing minutes value. @@ -561,14 +561,14 @@ namespace nil { /// provided minutes into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_minutes(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as hours. @@ -577,13 +577,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_hours(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing hours value. @@ -591,14 +591,14 @@ namespace nil { /// provided hours into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_hours(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as days. @@ -607,13 +607,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_days(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing days value. @@ -621,14 +621,14 @@ namespace nil { /// provided days into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_days(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as weeks. @@ -637,13 +637,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template TRet get_weeks(const TField &field) { - return detail::get_time(field); + return detail::get_time(field); } /// @brief Update field's value accordingly, while providing weeks value. @@ -651,14 +651,14 @@ namespace nil { /// provided weeks into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any time value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliseconds, - /// nil::marshalling::option::UnitsSeconds, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliseconds, + /// nil::crypto3::marshalling::option::UnitsSeconds, etc... template void set_weeks(TField &field, TVal &&val) { - detail::set_time(field, std::forward(val)); + detail::set_time(field, std::forward(val)); } /// @brief Retrieve field's value as nanometers. @@ -667,13 +667,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template TRet get_nanometers(const TField &field) { - return detail::get_distance(field); + return detail::get_distance(field); } /// @brief Update field's value accordingly, while providing nanometers value. @@ -681,14 +681,14 @@ namespace nil { /// provided nanometers into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template void set_nanometers(TField &field, TVal &&val) { - detail::set_distance(field, std::forward(val)); + detail::set_distance(field, std::forward(val)); } /// @brief Retrieve field's value as micrometers. @@ -697,13 +697,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template TRet get_micrometers(const TField &field) { - return detail::get_distance(field); + return detail::get_distance(field); } /// @brief Update field's value accordingly, while providing micrometers value. @@ -711,14 +711,14 @@ namespace nil { /// provided micrometers into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template void set_micrometers(TField &field, TVal &&val) { - detail::set_distance(field, + detail::set_distance(field, std::forward(val)); } @@ -728,13 +728,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template TRet get_millimeters(const TField &field) { - return detail::get_distance(field); + return detail::get_distance(field); } /// @brief Update field's value accordingly, while providing millimeters value. @@ -742,14 +742,14 @@ namespace nil { /// provided millimeters into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template void set_millimeters(TField &field, TVal &&val) { - detail::set_distance(field, + detail::set_distance(field, std::forward(val)); } @@ -759,13 +759,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template TRet get_centimeters(const TField &field) { - return detail::get_distance(field); + return detail::get_distance(field); } /// @brief Update field's value accordingly, while providing centimeters value. @@ -773,14 +773,14 @@ namespace nil { /// provided centimeters into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template void setCentimeters(TField &field, TVal &&val) { - detail::set_distance(field, + detail::set_distance(field, std::forward(val)); } @@ -790,13 +790,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template TRet getMeters(const TField &field) { - return detail::get_distance(field); + return detail::get_distance(field); } /// @brief Update field's value accordingly, while providing meters value. @@ -804,14 +804,14 @@ namespace nil { /// provided meters into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template void setMeters(TField &field, TVal &&val) { - detail::set_distance(field, std::forward(val)); + detail::set_distance(field, std::forward(val)); } /// @brief Retrieve field's value as kilometers. @@ -820,13 +820,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template TRet getKilometers(const TField &field) { - return detail::get_distance(field); + return detail::get_distance(field); } /// @brief Update field's value accordingly, while providing kilometers value. @@ -834,14 +834,14 @@ namespace nil { /// provided kilometers into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any distance value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimeters, - /// nil::marshalling::option::UnitsMeters, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimeters, + /// nil::crypto3::marshalling::option::UnitsMeters, etc... template void setKilometers(TField &field, TVal &&val) { - detail::set_distance(field, std::forward(val)); + detail::set_distance(field, std::forward(val)); } /// @brief Retrieve field's value as nanometers per second. @@ -850,13 +850,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template TRet getNanometersPerSecond(const TField &field) { - return detail::get_speed(field); + return detail::get_speed(field); } /// @brief Update field's value accordingly, while providing nanometers per second value. @@ -864,14 +864,14 @@ namespace nil { /// provided nm/s into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template void setNanometersPerSecond(TField &field, TVal &&val) { - detail::set_speed( + detail::set_speed( field, std::forward(val)); } @@ -881,13 +881,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template TRet getMicrometersPerSecond(const TField &field) { - return detail::get_speed(field); + return detail::get_speed(field); } /// @brief Update field's value accordingly, while providing micrometers per second value. @@ -895,14 +895,14 @@ namespace nil { /// provided um/s into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template void setMicrometersPerSecond(TField &field, TVal &&val) { - detail::set_speed( + detail::set_speed( field, std::forward(val)); } @@ -912,13 +912,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template TRet getMillimetersPerSecond(const TField &field) { - return detail::get_speed(field); + return detail::get_speed(field); } /// @brief Update field's value accordingly, while providing millimeters per second value. @@ -926,14 +926,14 @@ namespace nil { /// provided mm/s into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template void setMillimetersPerSecond(TField &field, TVal &&val) { - detail::set_speed( + detail::set_speed( field, std::forward(val)); } @@ -943,13 +943,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template TRet getCentimetersPerSecond(const TField &field) { - return detail::get_speed(field); + return detail::get_speed(field); } /// @brief Update field's value accordingly, while providing centimeters per second value. @@ -957,14 +957,14 @@ namespace nil { /// provided cm/s into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template void setCentimetersPerSecond(TField &field, TVal &&val) { - detail::set_speed( + detail::set_speed( field, std::forward(val)); } @@ -974,13 +974,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template TRet getMetersPerSecond(const TField &field) { - return detail::get_speed(field); + return detail::get_speed(field); } /// @brief Update field's value accordingly, while providing meters per second value. @@ -988,14 +988,14 @@ namespace nil { /// provided m/s into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template void setMetersPerSecond(TField &field, TVal &&val) { - detail::set_speed(field, + detail::set_speed(field, std::forward(val)); } @@ -1005,13 +1005,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template TRet getKilometersPerSecond(const TField &field) { - return detail::get_speed(field); + return detail::get_speed(field); } /// @brief Update field's value accordingly, while providing kilometers per second value. @@ -1019,14 +1019,14 @@ namespace nil { /// provided km/s into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template void setKilometersPerSecond(TField &field, TVal &&val) { - detail::set_speed( + detail::set_speed( field, std::forward(val)); } @@ -1036,13 +1036,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template TRet getKilometersPerHour(const TField &field) { - return detail::get_speed(field); + return detail::get_speed(field); } /// @brief Update field's value accordingly, while providing kilometers per hour value. @@ -1050,14 +1050,14 @@ namespace nil { /// provided km/h into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any speed value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillimetersPerSecond, - /// nil::marshalling::option::UnitsMetersPerSecond, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillimetersPerSecond, + /// nil::crypto3::marshalling::option::UnitsMetersPerSecond, etc... template void setKilometersPerHour(TField &field, TVal &&val) { - detail::set_speed(field, + detail::set_speed(field, std::forward(val)); } @@ -1067,13 +1067,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template TRet getHertz(const TField &field) { - return detail::get_frequency(field); + return detail::get_frequency(field); } /// @brief Update field's value accordingly, while providing hertz value. @@ -1081,14 +1081,14 @@ namespace nil { /// provided hertz into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template void setHertz(TField &field, TVal &&val) { - detail::set_frequency(field, std::forward(val)); + detail::set_frequency(field, std::forward(val)); } /// @brief Retrieve field's value as kilohertz. @@ -1097,13 +1097,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template TRet getKilohertz(const TField &field) { - return detail::get_frequency(field); + return detail::get_frequency(field); } /// @brief Update field's value accordingly, while providing kilohertz value. @@ -1111,14 +1111,14 @@ namespace nil { /// provided kilohertz into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template void setKilohertz(TField &field, TVal &&val) { - detail::set_frequency(field, std::forward(val)); + detail::set_frequency(field, std::forward(val)); } /// @brief Retrieve field's value as megahertz. @@ -1127,13 +1127,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template TRet getMegahertz(const TField &field) { - return detail::get_frequency(field); + return detail::get_frequency(field); } /// @brief Update field's value accordingly, while providing megahertz value. @@ -1141,14 +1141,14 @@ namespace nil { /// provided megahertz into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template void setMegahertz(TField &field, TVal &&val) { - detail::set_frequency(field, std::forward(val)); + detail::set_frequency(field, std::forward(val)); } /// @brief Retrieve field's value as gigahertz. @@ -1157,13 +1157,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template TRet getGigahertz(const TField &field) { - return detail::get_frequency(field); + return detail::get_frequency(field); } /// @brief Update field's value accordingly, while providing gigahertz value. @@ -1171,14 +1171,14 @@ namespace nil { /// provided gigahertz into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any frequency value, using - /// any of the relevant options: nil::marshalling::option::UnitsHertz, - /// nil::marshalling::option::UnitsKilohertz, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsHertz, + /// nil::crypto3::marshalling::option::UnitsKilohertz, etc... template void setGigahertz(TField &field, TVal &&val) { - detail::set_frequency(field, std::forward(val)); + detail::set_frequency(field, std::forward(val)); } /// @brief Retrieve field's value as degrees. @@ -1187,13 +1187,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any angle measurement value, using - /// any of the relevant options: nil::marshalling::option::UnitsDegrees or - /// nil::marshalling::option::UnitsRadians + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsDegrees or + /// nil::crypto3::marshalling::option::UnitsRadians template TRet getDegrees(const TField &field) { - return detail::get_angle(field); + return detail::get_angle(field); } /// @brief Update field's value accordingly, while providing degrees value. @@ -1201,14 +1201,14 @@ namespace nil { /// provided degrees into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any angle measurement value, using - /// any of the relevant options: nil::marshalling::option::UnitsDegrees or - /// nil::marshalling::option::UnitsRadians + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsDegrees or + /// nil::crypto3::marshalling::option::UnitsRadians template void setDegrees(TField &field, TVal &&val) { - detail::set_angle(field, std::forward(val)); + detail::set_angle(field, std::forward(val)); } /// @brief Retrieve field's value as radians. @@ -1217,13 +1217,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any angle measurement value, using - /// any of the relevant options: nil::marshalling::option::UnitsDegrees or - /// nil::marshalling::option::UnitsRadians + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsDegrees or + /// nil::crypto3::marshalling::option::UnitsRadians template TRet getRadians(const TField &field) { - return detail::get_angle(field); + return detail::get_angle(field); } /// @brief Update field's value accordingly, while providing radians value. @@ -1231,14 +1231,14 @@ namespace nil { /// provided radians into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any angle measurement value, using - /// any of the relevant options: nil::marshalling::option::UnitsDegrees or - /// nil::marshalling::option::UnitsRadians + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsDegrees or + /// nil::crypto3::marshalling::option::UnitsRadians template void setRadians(TField &field, TVal &&val) { - detail::set_angle(field, std::forward(val)); + detail::set_angle(field, std::forward(val)); } /// @brief Retrieve field's value as nanoamps. @@ -1247,13 +1247,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template TRet getNanoamps(const TField &field) { - return detail::get_current(field); + return detail::get_current(field); } /// @brief Update field's value accordingly, while providing nanoamps value. @@ -1261,14 +1261,14 @@ namespace nil { /// provided nanoamps into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template void setNanoamps(TField &field, TVal &&val) { - detail::set_current(field, std::forward(val)); + detail::set_current(field, std::forward(val)); } /// @brief Retrieve field's value as microamps. @@ -1277,13 +1277,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template TRet getMicroamps(const TField &field) { - return detail::get_current(field); + return detail::get_current(field); } /// @brief Update field's value accordingly, while providing microamps value. @@ -1291,14 +1291,14 @@ namespace nil { /// provided microamps into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template void setMicroamps(TField &field, TVal &&val) { - detail::set_current(field, std::forward(val)); + detail::set_current(field, std::forward(val)); } /// @brief Retrieve field's value as milliamps. @@ -1307,13 +1307,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template TRet getMilliamps(const TField &field) { - return detail::get_current(field); + return detail::get_current(field); } /// @brief Update field's value accordingly, while providing milliamps value. @@ -1321,14 +1321,14 @@ namespace nil { /// provided milliamps into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template void setMilliamps(TField &field, TVal &&val) { - detail::set_current(field, std::forward(val)); + detail::set_current(field, std::forward(val)); } /// @brief Retrieve field's value as amps. @@ -1337,13 +1337,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template TRet getAmps(const TField &field) { - return detail::get_current(field); + return detail::get_current(field); } /// @brief Update field's value accordingly, while providing amps value. @@ -1351,14 +1351,14 @@ namespace nil { /// provided amps into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template void setAmps(TField &field, TVal &&val) { - detail::set_current(field, std::forward(val)); + detail::set_current(field, std::forward(val)); } /// @brief Retrieve field's value as kiloamps. @@ -1367,13 +1367,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template TRet getKiloamps(const TField &field) { - return detail::get_current(field); + return detail::get_current(field); } /// @brief Update field's value accordingly, while providing kiloamps value. @@ -1381,14 +1381,14 @@ namespace nil { /// provided kiloamps into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMilliamps, - /// nil::marshalling::option::UnitsAmps, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMilliamps, + /// nil::crypto3::marshalling::option::UnitsAmps, etc... template void setKiloamps(TField &field, TVal &&val) { - detail::set_current(field, std::forward(val)); + detail::set_current(field, std::forward(val)); } /// @brief Retrieve field's value as nanovolts. @@ -1397,13 +1397,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical current value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template TRet getNanovolts(const TField &field) { - return detail::get_voltage(field); + return detail::get_voltage(field); } /// @brief Update field's value accordingly, while providing nanovolts value. @@ -1411,14 +1411,14 @@ namespace nil { /// provided nanovolts into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template void setNanovolts(TField &field, TVal &&val) { - detail::set_voltage(field, std::forward(val)); + detail::set_voltage(field, std::forward(val)); } /// @brief Retrieve field's value as microvolts. @@ -1427,13 +1427,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template TRet getMicrovolts(const TField &field) { - return detail::get_voltage(field); + return detail::get_voltage(field); } /// @brief Update field's value accordingly, while providing microvolts value. @@ -1441,14 +1441,14 @@ namespace nil { /// provided microvolts into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template void setMicrovolts(TField &field, TVal &&val) { - detail::set_voltage(field, std::forward(val)); + detail::set_voltage(field, std::forward(val)); } /// @brief Retrieve field's value as millivolts. @@ -1457,13 +1457,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template TRet getMillivolts(const TField &field) { - return detail::get_voltage(field); + return detail::get_voltage(field); } /// @brief Update field's value accordingly, while providing millivolts value. @@ -1471,14 +1471,14 @@ namespace nil { /// provided millivolts into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template void setMillivolts(TField &field, TVal &&val) { - detail::set_voltage(field, std::forward(val)); + detail::set_voltage(field, std::forward(val)); } /// @brief Retrieve field's value as volts. @@ -1487,13 +1487,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template TRet getVolts(const TField &field) { - return detail::get_voltage(field); + return detail::get_voltage(field); } /// @brief Update field's value accordingly, while providing volts value. @@ -1501,14 +1501,14 @@ namespace nil { /// provided volts into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template void setVolts(TField &field, TVal &&val) { - detail::set_voltage(field, std::forward(val)); + detail::set_voltage(field, std::forward(val)); } /// @brief Retrieve field's value as kilovolts. @@ -1517,13 +1517,13 @@ namespace nil { /// type. /// @tparam TRet Return type /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template TRet getKilovolts(const TField &field) { - return detail::get_voltage(field); + return detail::get_voltage(field); } /// @brief Update field's value accordingly, while providing kilovolts value. @@ -1531,14 +1531,14 @@ namespace nil { /// provided kilovolts into the units stored by the field and update the /// internal value of the latter accordingly. /// @tparam TField Type of the field, expected to be a field with integral - /// internal value, such as a variant of nil::marshalling::types::integral. + /// internal value, such as a variant of nil::crypto3::marshalling::types::integral. /// @tparam TVal Type of value to assign. /// @pre The @b TField type must be defined containing any electrical voltage value, using - /// any of the relevant options: nil::marshalling::option::UnitsMillivolts, - /// nil::marshalling::option::UnitsVolts, etc... + /// any of the relevant options: nil::crypto3::marshalling::option::UnitsMillivolts, + /// nil::crypto3::marshalling::option::UnitsVolts, etc... template void setKilovolts(TField &field, TVal &&val) { - detail::set_voltage(field, std::forward(val)); + detail::set_voltage(field, std::forward(val)); } } // namespace units } // namespace marshalling diff --git a/crypto3/libs/marshalling/core/include/nil/marshalling/units_types.hpp b/crypto3/libs/marshalling/core/include/nil/marshalling/units_types.hpp index 1494348c46..9a6c7ccdb6 100644 --- a/crypto3/libs/marshalling/core/include/nil/marshalling/units_types.hpp +++ b/crypto3/libs/marshalling/core/include/nil/marshalling/units_types.hpp @@ -34,7 +34,7 @@ #include -namespace nil { +namespace nil::crypto3 { namespace marshalling { namespace traits { namespace units { diff --git a/crypto3/libs/marshalling/core/test/interfaces.cpp b/crypto3/libs/marshalling/core/test/interfaces.cpp index 7675fbe38a..e4c9853274 100644 --- a/crypto3/libs/marshalling/core/test/interfaces.cpp +++ b/crypto3/libs/marshalling/core/test/interfaces.cpp @@ -55,7 +55,7 @@ #include #include -using namespace nil::marshalling; +using namespace nil::crypto3::marshalling; BOOST_AUTO_TEST_SUITE(pack_interfaces_test_suite) @@ -79,28 +79,28 @@ void resize(boost::array &t, size_t count) { } template -typename std::enable_if::value, void>::type repack_2(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_2(TInput in, size_t result_size) { } template -typename std::enable_if::value, void>::type repack_4(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_4(TInput in, size_t result_size) { } template -typename std::enable_if::value, void>::type repack_5(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_5(TInput in, size_t result_size) { } template -typename std::enable_if::value || !nil::detail::has_begin::value, void>::type +typename std::enable_if::value || !detail::has_begin::value, void>::type repack_6(TInput in, size_t result_size) { } template -typename std::enable_if::value, void>::type repack_7(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_7(TInput in, size_t result_size) { } template -typename std::enable_if::value || !nil::detail::has_begin::value, void>::type +typename std::enable_if::value || !detail::has_begin::value, void>::type repack_8(TInput in, size_t result_size) { } @@ -112,7 +112,7 @@ void repack_1(TInput in, size_t result_size) { } template -typename std::enable_if::value, void>::type repack_2(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_2(TInput in, size_t result_size) { status_type status; T result = pack(in.begin(), in.end(), status); BOOST_CHECK(status == status_type::success); @@ -127,7 +127,7 @@ void repack_3(TInput in, size_t result_size) { } template -typename std::enable_if::value, void>::type repack_4(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_4(TInput in, size_t result_size) { status_type status; T result; status = pack(in.begin(), in.end(), result); @@ -135,7 +135,7 @@ typename std::enable_if::value, void>::type repac } template -typename std::enable_if::value, void>::type repack_5(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_5(TInput in, size_t result_size) { status_type status; T result; resize(result, result_size); @@ -145,7 +145,7 @@ typename std::enable_if::value, void>::type repack_5(T } template -typename std::enable_if::value && nil::detail::has_begin::value, void>::type +typename std::enable_if::value && detail::has_begin::value, void>::type repack_6(TInput in, size_t result_size) { status_type status; T result; @@ -156,7 +156,7 @@ typename std::enable_if::value && nil::detail::has_beg } template -typename std::enable_if::value, void>::type repack_7(TInput in, size_t result_size) { +typename std::enable_if::value, void>::type repack_7(TInput in, size_t result_size) { status_type status; T result; resize(result, result_size); @@ -165,7 +165,7 @@ typename std::enable_if::value, void>::type repack_7(T } template -typename std::enable_if::value && nil::detail::has_begin::value, void>::type +typename std::enable_if::value && detail::has_begin::value, void>::type repack_8(TInput in, size_t result_size) { status_type status; T result; diff --git a/crypto3/libs/marshalling/core/test/pack.cpp b/crypto3/libs/marshalling/core/test/pack.cpp index 5d73d97923..3272c743e2 100644 --- a/crypto3/libs/marshalling/core/test/pack.cpp +++ b/crypto3/libs/marshalling/core/test/pack.cpp @@ -50,7 +50,7 @@ #include -using namespace nil::marshalling; +using namespace nil::crypto3::marshalling; BOOST_AUTO_TEST_SUITE(pack_imploder_test_suite) diff --git a/crypto3/libs/marshalling/core/test/processing.cpp b/crypto3/libs/marshalling/core/test/processing.cpp index 025f17b302..b700434ac3 100644 --- a/crypto3/libs/marshalling/core/test/processing.cpp +++ b/crypto3/libs/marshalling/core/test/processing.cpp @@ -39,7 +39,7 @@ #include #include -using namespace nil::marshalling; +using namespace nil::crypto3::marshalling; BOOST_TEST_DONT_PRINT_LOG_VALUE(status_type) diff --git a/crypto3/libs/marshalling/core/test/types.cpp b/crypto3/libs/marshalling/core/test/types.cpp index e9a701c4ca..3b5d7c53b5 100755 --- a/crypto3/libs/marshalling/core/test/types.cpp +++ b/crypto3/libs/marshalling/core/test/types.cpp @@ -60,7 +60,7 @@ #include #include -using namespace nil::marshalling; +using namespace nil::crypto3::marshalling; static_assert(has_member_function_clear::value, "Invalid function presence detection"); static_assert(has_member_function_clear>::value, "Invalid function presence detection"); diff --git a/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/expression.hpp b/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/expression.hpp index 4fde8d1ed0..1ed5f582b6 100644 --- a/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/expression.hpp +++ b/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/expression.hpp @@ -48,15 +48,15 @@ namespace nil { template struct flat_pow_operation { using type = - nil::marshalling::types::bundle< + nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // power - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // type - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // child_index - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > >; }; @@ -65,19 +65,19 @@ namespace nil { template struct flat_binary_arithmetic_operation { using type = - nil::marshalling::types::bundle< + nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // op - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // left_type - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // left_index - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // right_type - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // right_index - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > >; }; @@ -87,67 +87,67 @@ namespace nil { struct expression { using type = - nil::marshalling::types::bundle< + nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::vector> terms - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename term::type >, // std::vector pow_operations - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename flat_pow_operation::type >, // std::vector binary_operations - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename flat_binary_arithmetic_operation::type >, // flat_node_type root_type; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // size_t root_index; - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > >; }; template - typename flat_pow_operation>::type + typename flat_pow_operation>::type fill_power_operation(const math::flat_pow_operation& power_op) { - using TTypeBase = nil::marshalling::field_type; - return typename flat_pow_operation>::type( + using TTypeBase = nil::crypto3::marshalling::field_type; + return typename flat_pow_operation>::type( std::make_tuple( - nil::marshalling::types::integral(power_op.power), - nil::marshalling::types::integral((std::uint8_t)power_op.type), - nil::marshalling::types::integral(power_op.child_index))); + nil::crypto3::marshalling::types::integral(power_op.power), + nil::crypto3::marshalling::types::integral((std::uint8_t)power_op.type), + nil::crypto3::marshalling::types::integral(power_op.child_index))); } template - typename flat_binary_arithmetic_operation>::type + typename flat_binary_arithmetic_operation>::type fill_binary_operation(const math::flat_binary_arithmetic_operation& bin_op) { - using TTypeBase = nil::marshalling::field_type; - return typename flat_binary_arithmetic_operation>::type( + using TTypeBase = nil::crypto3::marshalling::field_type; + return typename flat_binary_arithmetic_operation>::type( std::make_tuple( - nil::marshalling::types::integral((std::uint8_t)bin_op.op), - nil::marshalling::types::integral((std::uint8_t)bin_op.left_type), - nil::marshalling::types::integral(bin_op.left_index), - nil::marshalling::types::integral((std::uint8_t)bin_op.right_type), - nil::marshalling::types::integral(bin_op.right_index))); + nil::crypto3::marshalling::types::integral((std::uint8_t)bin_op.op), + nil::crypto3::marshalling::types::integral((std::uint8_t)bin_op.left_type), + nil::crypto3::marshalling::types::integral(bin_op.left_index), + nil::crypto3::marshalling::types::integral((std::uint8_t)bin_op.right_type), + nil::crypto3::marshalling::types::integral(bin_op.right_index))); } template - typename expression, ExpressionType>::type + typename expression, ExpressionType>::type fill_expression(const ExpressionType &expr) { math::expression_flattener flattener(expr); const auto& flat_expr = flattener.get_result(); - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; // Fill the terms. - nil::marshalling::types::standard_array_list::type> filled_terms; for (const auto &term : flat_expr.terms) { filled_terms.value().push_back( @@ -155,33 +155,33 @@ namespace nil { } // Fill the power operations. - nil::marshalling::types::standard_array_list::type> filled_powers; for (const auto &power : flat_expr.pow_operations) { filled_powers.value().push_back(fill_power_operation(power)); } // Fill the binary operations. - nil::marshalling::types::standard_array_list::type> filled_binary_operations; for (const auto &bin_op : flat_expr.binary_operations) { filled_binary_operations.value().push_back( fill_binary_operation(bin_op)); } - return typename expression, ExpressionType>::type( + return typename expression, ExpressionType>::type( std::make_tuple( filled_terms, filled_powers, filled_binary_operations, - nil::marshalling::types::integral((std::uint8_t)flat_expr.root_type), - nil::marshalling::types::integral(flat_expr.root_index))); + nil::crypto3::marshalling::types::integral((std::uint8_t)flat_expr.root_type), + nil::crypto3::marshalling::types::integral(flat_expr.root_index))); } template math::flat_pow_operation make_power_operation( - const typename flat_pow_operation>::type& filled_power_op) + const typename flat_pow_operation>::type& filled_power_op) { math::flat_pow_operation power_op; power_op.power = std::get<0>(filled_power_op.value()).value(); @@ -192,7 +192,7 @@ namespace nil { template math::flat_binary_arithmetic_operation make_binary_operation( - const typename flat_binary_arithmetic_operation>::type& filled_power_op) + const typename flat_binary_arithmetic_operation>::type& filled_power_op) { math::flat_binary_arithmetic_operation bin_op; bin_op.op = static_cast(std::get<0>(filled_power_op.value()).value()); @@ -205,7 +205,7 @@ namespace nil { template ExpressionType make_expression( - const typename expression, ExpressionType>::type &filled_expr) + const typename expression, ExpressionType>::type &filled_expr) { using ArithmeticOperatorType = typename ExpressionType::binary_arithmetic_operation_type::ArithmeticOperatorType; math::flat_expression flat_expr; diff --git a/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/polynomial.hpp b/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/polynomial.hpp index 323f587498..98b880018f 100644 --- a/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/polynomial.hpp +++ b/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/polynomial.hpp @@ -58,7 +58,7 @@ namespace nil { }; template - typename polynomial, PolynomialType, std::enable_if_t< + typename polynomial, PolynomialType, std::enable_if_t< nil::crypto3::math::is_polynomial::value>>::type fill_polynomial(const PolynomialType &f) { @@ -72,7 +72,7 @@ namespace nil { template PolynomialType make_polynomial( const typename polynomial< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, PolynomialType, std::enable_if_t::value>>::type &filled_polynomial) { auto val = nil::crypto3::marshalling::types::make_field_element_vector< @@ -89,11 +89,11 @@ namespace nil { template struct polynomial::value>> { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // degree - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // values field_element_vector > @@ -101,17 +101,17 @@ namespace nil { }; template - typename polynomial, PolynomialDFSType, std::enable_if_t< + typename polynomial, PolynomialDFSType, std::enable_if_t< nil::crypto3::math::is_polynomial_dfs::value>>::type fill_polynomial(const PolynomialDFSType &f) { - using TTypeBase = nil::marshalling::field_type; - using result_type = typename polynomial, PolynomialDFSType>::type; + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = typename polynomial, PolynomialDFSType>::type; std::vector val; for( auto it=f.begin(); it != f.end(); it++){ val.push_back(*it); } return result_type(std::make_tuple( - nil::marshalling::types::integral(f.degree()), + nil::crypto3::marshalling::types::integral(f.degree()), nil::crypto3::marshalling::types::fill_field_element_vector< typename PolynomialDFSType::value_type, Endianness @@ -121,7 +121,7 @@ namespace nil { template PolynomialDFSType make_polynomial(const typename polynomial< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, PolynomialDFSType, std::enable_if_t::value >>::type &filled_polynomial) @@ -137,15 +137,15 @@ namespace nil { // Polynomial vector marshalling, regardless of the form of the polynomial. /////////////////////////////////////////////// template - using polynomial_vector = nil::marshalling::types::standard_array_list< + using polynomial_vector = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename polynomial::type >; template - polynomial_vector, PolynomialType> + polynomial_vector, PolynomialType> fill_polynomial_vector(const std::vector &f) { - polynomial_vector, PolynomialType> result; + polynomial_vector, PolynomialType> result; for (auto it=f.begin(); it != f.end(); it++) { result.value().push_back(fill_polynomial(*it)); } @@ -154,7 +154,7 @@ namespace nil { template std::vector make_polynomial_vector( - const polynomial_vector, PolynomialType> &filled_polynomial_vector) + const polynomial_vector, PolynomialType> &filled_polynomial_vector) { std::vector result; result.reserve(filled_polynomial_vector.value().size()); diff --git a/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/term.hpp b/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/term.hpp index c6564061e9..8ca022b0c7 100644 --- a/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/term.hpp +++ b/crypto3/libs/marshalling/math/include/nil/crypto3/marshalling/math/types/term.hpp @@ -47,29 +47,29 @@ namespace nil { template struct term { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // assignment_type coeff field_element, // std::vector vars - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename variable::type> > >; }; template - typename term, NonLinearTerm>::type + typename term, NonLinearTerm>::type fill_term(const NonLinearTerm &t) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using result_type = typename term::type; using field_element_marhsalling_type = field_element; using variable_marshalling_type = typename variable::type; - using variable_vector_marshalling_type = nil::marshalling::types::standard_array_list< + using variable_vector_marshalling_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, variable_marshalling_type>; variable_vector_marshalling_type filled_vars; @@ -83,7 +83,7 @@ namespace nil { template NonLinearTerm make_term( - const typename term, NonLinearTerm>::type &filled_term) + const typename term, NonLinearTerm>::type &filled_term) { std::vector vars; auto coeff = std::get<0>(filled_term.value()).value(); diff --git a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/inference.hpp b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/inference.hpp index d12816a72e..d44b85e45d 100644 --- a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/inference.hpp +++ b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/inference.hpp @@ -27,6 +27,8 @@ #define CRYPTO3_MARSHALLING_MULTIPRECISION_INFERENCE_TYPE_TRAITS_HPP #include +#include +#include namespace nil { namespace crypto3 { @@ -35,25 +37,22 @@ namespace nil { template class integral; } // namespace types - } // namespace marshalling - } // namespace crypto3 - namespace marshalling { - - template - class is_compatible; - template - class is_compatible , void> { - using default_endianness = option::big_endian; - public: - template - using type = typename nil::crypto3::marshalling::types::integral, - nil::crypto3::multiprecision::big_uint, TOptions...>; - static const bool value = true; - static const bool fixed_size = true; - }; + template + class is_compatible; - } // namespace marshalling + template + class is_compatible , void> { + using default_endianness = option::big_endian; + public: + template + using type = typename nil::crypto3::marshalling::types::integral, + nil::crypto3::multiprecision::big_uint, TOptions...>; + static const bool value = true; + static const bool fixed_size = true; + }; + } // namespace marshalling + } // namespace crypto3 } // namespace nil -#endif // CRYPTO3_MARSHALLING_MULTIPRECISION_INFERENCE_TYPE_TRAITS_HPP \ No newline at end of file +#endif // CRYPTO3_MARSHALLING_MULTIPRECISION_INFERENCE_TYPE_TRAITS_HPP diff --git a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/processing/integral.hpp b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/processing/integral.hpp index f703b4b52d..367a888d35 100644 --- a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/processing/integral.hpp +++ b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/processing/integral.hpp @@ -38,7 +38,7 @@ namespace nil { namespace crypto3 { namespace marshalling { - namespace processing { + namespace multiprecision::processing { /// @brief Write part of integral value into the output area using big /// endian notation. @@ -217,7 +217,7 @@ namespace nil { /// @brief Same as write_big_endian() template - typename std::enable_if::value, + typename std::enable_if::value, void>::type write_data(T value, TIter &iter) { @@ -226,7 +226,7 @@ namespace nil { /// @brief Same as write_big_endian() template - typename std::enable_if::value, + typename std::enable_if::value, void>::type write_data(T value, TIter &iter) { @@ -235,7 +235,7 @@ namespace nil { /// @brief Same as write_little_endian() template - typename std::enable_if::value, + typename std::enable_if::value, void>::type write_data(T value, TIter &iter) { @@ -244,7 +244,7 @@ namespace nil { /// @brief Same as write_little_endian() template - typename std::enable_if::value, + typename std::enable_if::value, void>::type write_data(T value, TIter &iter) { @@ -253,7 +253,7 @@ namespace nil { /// @brief Same as read_big_endian() template - typename std::enable_if::value, T>::type + typename std::enable_if::value, T>::type read_data(TIter &iter, std::size_t value_size) { return read_big_endian(iter, value_size); @@ -261,7 +261,7 @@ namespace nil { /// @brief Same as read_little_endian() template - typename std::enable_if::value, + typename std::enable_if::value, T>::type read_data(TIter &iter, std::size_t value_size) { @@ -270,7 +270,7 @@ namespace nil { /// @brief Same as read_big_endian() template - typename std::enable_if::value, T>::type + typename std::enable_if::value, T>::type read_data(TIter &iter) { return read_big_endian(iter); @@ -278,7 +278,7 @@ namespace nil { /// @brief Same as read_little_endian() template - typename std::enable_if::value, + typename std::enable_if::value, T>::type read_data(TIter &iter) { diff --git a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/detail/integral/basic_type.hpp b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/detail/integral/basic_type.hpp index 60cab082bd..4a32403ab6 100644 --- a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/detail/integral/basic_type.hpp +++ b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/detail/integral/basic_type.hpp @@ -34,6 +34,7 @@ #include +#include #include namespace nil { @@ -41,16 +42,14 @@ namespace nil { namespace marshalling { namespace types { namespace detail { - template - class basic_integral : public TTypeBase { - using T = nil::crypto3::multiprecision::big_uint; + template + class basic_integral> : public TTypeBase { using base_impl_type = TTypeBase; public: - using value_type = T; + using value_type = nil::crypto3::multiprecision::big_uint; using serialized_type = value_type; basic_integral() = default; @@ -93,11 +92,11 @@ namespace nil { } static constexpr std::size_t min_bit_length() { - return T::Bits; + return value_type::Bits; } static constexpr std::size_t max_bit_length() { - return T::Bits; + return value_type::Bits; } static constexpr serialized_type to_serialized(value_type val) { @@ -109,44 +108,43 @@ namespace nil { } template - nil::marshalling::status_type read(TIter &iter, std::size_t size) { + nil::crypto3::marshalling::status_type read(TIter &iter, std::size_t size) { if (size < (std::is_same::value_type, bool>::value ? bit_length() : length())) { - return nil::marshalling::status_type::not_enough_data; + return nil::crypto3::marshalling::status_type::not_enough_data; } read_no_status(iter); iter += (std::is_same::value_type, bool>::value ? max_bit_length() : max_length()); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } template void read_no_status(TIter &iter) { - value_ = crypto3::marshalling::processing:: + value_ = multiprecision::processing:: read_data(iter); } template - nil::marshalling::status_type write(TIter &iter, std::size_t size) const { + nil::crypto3::marshalling::status_type write(TIter &iter, std::size_t size) const { if (size < (std::is_same::value_type, bool>::value ? bit_length() : length())) { - return nil::marshalling::status_type::buffer_overflow; + return nil::crypto3::marshalling::status_type::buffer_overflow; } write_no_status(iter); iter += (std::is_same::value_type, bool>::value ? max_bit_length() : max_length()); - return nil::marshalling::status_type::success; + return nil::crypto3::marshalling::status_type::success; } template void write_no_status(TIter &iter) const { - crypto3::marshalling::processing::write_data(value_, - iter); + multiprecision::processing:: + write_data(value_, iter); } private: diff --git a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/integral.hpp b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/integral.hpp index 450947ba2b..8fd6ede8ec 100644 --- a/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/integral.hpp +++ b/crypto3/libs/marshalling/multiprecision/include/nil/crypto3/marshalling/multiprecision/types/integral.hpp @@ -52,12 +52,12 @@ namespace nil { /// @brief field_type that represent integral value. /// @tparam TTypeBase Base class for this field, expected to be a variant of - /// nil::marshalling::field_type. + /// nil::crypto3::marshalling::field_type. /// @tparam T Basic underlying integral type. /// @tparam TOptions Zero or more options that modify/refine default behaviour /// of the field. If no option is provided The field's value is serialized as is. /// @code - /// using MyFieldBase = nil::marshalling::field_type; + /// using MyFieldBase = nil::crypto3::marshalling::field_type; /// /// constexpr static const std::size_t modulus_bits = 381; /// using modulus_type = nil::crypto3::multiprecision::big_uint; @@ -67,27 +67,27 @@ namespace nil { /// consume ?? bytes (because sizeof(modulus_type) == ??) and will /// be serialized using big endian notation.@n /// Supported options are: - /// @li @ref nil::marshalling::option::var_length - /// @li @ref nil::marshalling::option::num_value_ser_offset - /// @li @ref nil::marshalling::option::default_value_initializer or - /// nil::marshalling::option::default_num_value. - /// @li @ref nil::marshalling::option::contents_validator - /// @li @ref nil::marshalling::option::valid_num_value_range, @ref - /// nil::marshalling::option::ValidNumValue, - /// @ref nil::marshalling::option::ValidBigUnsignedNumValueRange, @ref - /// nil::marshalling::option::ValidBigUnsignedNumValue - /// @li @ref nil::marshalling::option::valid_ranges_clear - /// @li @ref nil::marshalling::option::contents_refresher - /// @li @ref nil::marshalling::option::has_custom_read - /// @li @ref nil::marshalling::option::has_custom_refresh - /// @li @ref nil::marshalling::option::fail_on_invalid - /// @li @ref nil::marshalling::option::ignore_invalid - /// @li @b nil::marshalling::option::Units* - all variants of value units, see + /// @li @ref nil::crypto3::marshalling::option::var_length + /// @li @ref nil::crypto3::marshalling::option::num_value_ser_offset + /// @li @ref nil::crypto3::marshalling::option::default_value_initializer or + /// nil::crypto3::marshalling::option::default_num_value. + /// @li @ref nil::crypto3::marshalling::option::contents_validator + /// @li @ref nil::crypto3::marshalling::option::valid_num_value_range, @ref + /// nil::crypto3::marshalling::option::ValidNumValue, + /// @ref nil::crypto3::marshalling::option::ValidBigUnsignedNumValueRange, @ref + /// nil::crypto3::marshalling::option::ValidBigUnsignedNumValue + /// @li @ref nil::crypto3::marshalling::option::valid_ranges_clear + /// @li @ref nil::crypto3::marshalling::option::contents_refresher + /// @li @ref nil::crypto3::marshalling::option::has_custom_read + /// @li @ref nil::crypto3::marshalling::option::has_custom_refresh + /// @li @ref nil::crypto3::marshalling::option::fail_on_invalid + /// @li @ref nil::crypto3::marshalling::option::ignore_invalid + /// @li @b nil::crypto3::marshalling::option::Units* - all variants of value units, see /// @ref sec_field_tutorial_integral_units for details. - /// @li nil::marshalling::option::empty_serialization - /// @li @ref nil::marshalling::option::invalid_by_default - /// @li @ref nil::marshalling::option::version_storage - /// @extends nil::marshalling::field_type + /// @li nil::crypto3::marshalling::option::empty_serialization + /// @li @ref nil::crypto3::marshalling::option::invalid_by_default + /// @li @ref nil::crypto3::marshalling::option::version_storage + /// @extends nil::crypto3::marshalling::field_type /// @headerfile nil/marshalling/types/integral.hpp template class integral; @@ -96,13 +96,12 @@ namespace nil { std::size_t Bits, typename... TOptions> class integral, TOptions...> - : public ::nil::marshalling::types::detail::adapt_basic_field_type< - crypto3::marshalling::types::detail::basic_integral, - TOptions...> { + : public detail::adapt_basic_field_type< + detail::basic_integral>, TOptions...> + { - using base_impl_type = ::nil::marshalling::types::detail::adapt_basic_field_type< - crypto3::marshalling::types::detail::basic_integral, - TOptions...>; + using base_impl_type = detail::adapt_basic_field_type< + detail::basic_integral>, TOptions...>; public: /// @brief endian_type used for serialization. @@ -112,10 +111,10 @@ namespace nil { using version_type = typename base_impl_type::version_type; /// @brief All the options provided to this class bundled into struct. - using parsed_options_type = ::nil::marshalling::types::detail::options_parser; + using parsed_options_type = ::nil::crypto3::marshalling::types::detail::options_parser; /// @brief Tag indicating type of the field - using tag = ::nil::marshalling::types::tag::integral; + using tag = ::nil::crypto3::marshalling::types::tag::integral; /// @brief Type of underlying integral value. /// @details Same as template parameter T to this class. @@ -189,7 +188,7 @@ namespace nil { /// @return Status of read operation. /// @post Iterator is advanced. template - nil::marshalling::status_type read(TIter &iter, std::size_t size) { + nil::crypto3::marshalling::status_type read(TIter &iter, std::size_t size) { return base_impl_type::read(iter, size); } @@ -209,7 +208,7 @@ namespace nil { /// @return Status of write operation. /// @post Iterator is advanced. template - nil::marshalling::status_type write(TIter &iter, std::size_t size) const { + nil::crypto3::marshalling::status_type write(TIter &iter, std::size_t size) const { return base_impl_type::write(iter, size); } @@ -229,7 +228,7 @@ namespace nil { } /// @brief Get version of the field. - /// @details Exists only if @ref nil::marshalling::option::version_storage option has been provided. + /// @details Exists only if @ref nil::crypto3::marshalling::option::version_storage option has been provided. version_type get_version() const { return base_impl_type::get_version(); } @@ -248,71 +247,71 @@ namespace nil { // because such an adapter uses pure byte reading, // incompatible with crypto3::multiprecision static_assert(!parsed_options_type::has_fixed_length_limit, - "nil::marshalling::option::fixed_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_length option is not applicable to " "crypto3::integral type"); // because such an adapter uses pure byte reading, // incompatible with crypto3::multiprecision static_assert(!parsed_options_type::has_fixed_bit_length_limit, - "nil::marshalling::option::fixed_bit_length option is not applicable to " + "nil::crypto3::marshalling::option::fixed_bit_length option is not applicable to " "crypto3::integral type"); static_assert(!parsed_options_type::has_scaling_ratio, - "nil::marshalling::option::scaling_ratio option is not applicable to " + "nil::crypto3::marshalling::option::scaling_ratio option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_sequence_elem_length_forcing, - "nil::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemLengthForcingEnabled option is not applicable to " "crypto3::integral type"); static_assert(!parsed_options_type::has_sequence_size_forcing, - "nil::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceSizeForcingEnabled option is not applicable to " "crypto3::integral type"); static_assert(!parsed_options_type::has_sequence_length_forcing, - "nil::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " + "nil::crypto3::marshalling::option::SequenceLengthForcingEnabled option is not applicable to " "crypto3::integral type"); static_assert(!parsed_options_type::has_sequence_fixed_size, - "nil::marshalling::option::sequence_fixed_size option is not applicable to " + "nil::crypto3::marshalling::option::sequence_fixed_size option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_sequence_fixed_size_use_fixed_size_storage, - "nil::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " + "nil::crypto3::marshalling::option::SequenceFixedSizeUseFixedSizeStorage option is not applicable to " "crypto3::integral type"); static_assert(!parsed_options_type::has_sequence_size_field_prefix, - "nil::marshalling::option::sequence_size_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_size_field_prefix option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_sequence_ser_length_field_prefix, - "nil::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_ser_length_field_prefix option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_sequence_elem_ser_length_field_prefix, - "nil::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_elem_ser_length_field_prefix option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_sequence_elem_fixed_ser_length_field_prefix, - "nil::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " + "nil::crypto3::marshalling::option::SequenceElemSerLengthFixedFieldPrefix option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_sequence_trailing_field_suffix, - "nil::marshalling::option::sequence_trailing_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_trailing_field_suffix option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_sequence_termination_field_suffix, - "nil::marshalling::option::sequence_termination_field_suffix option is not applicable to " + "nil::crypto3::marshalling::option::sequence_termination_field_suffix option is not applicable to " "crypto3::integral type"); static_assert(!parsed_options_type::has_fixed_size_storage, - "nil::marshalling::option::fixed_size_storage option is not applicable to " + "nil::crypto3::marshalling::option::fixed_size_storage option is not applicable to " "crypto3::integral type"); static_assert(!parsed_options_type::has_custom_storage_type, - "nil::marshalling::option::custom_storage_type option is not applicable to " + "nil::crypto3::marshalling::option::custom_storage_type option is not applicable to " "crypto3::integral type"); static_assert( !parsed_options_type::has_orig_data_view, - "nil::marshalling::option::orig_data_view option is not applicable to crypto3::integral type"); + "nil::crypto3::marshalling::option::orig_data_view option is not applicable to crypto3::integral type"); static_assert( !parsed_options_type::has_versions_range, - "nil::marshalling::option::exists_between_versions (or similar) option is not applicable to " + "nil::crypto3::marshalling::option::exists_between_versions (or similar) option is not applicable to " "crypto3::integral type"); }; @@ -364,9 +363,9 @@ namespace nil { return field1.value() < field2.value(); } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::integral type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::integral type /// in order to have access to its internal types. - /// @related nil::marshalling::types::integral + /// @related nil::crypto3::marshalling::types::integral template @@ -376,9 +375,9 @@ namespace nil { return field; } - /// @brief Upcast type of the field definition to its parent nil::marshalling::types::integral type + /// @brief Upcast type of the field definition to its parent nil::crypto3::marshalling::types::integral type /// in order to have access to its internal types. - /// @related nil::marshalling::types::integral + /// @related nil::crypto3::marshalling::types::integral template @@ -390,16 +389,16 @@ namespace nil { } template - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - integral, IntegralContainer>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + integral, IntegralContainer>> fill_integral_vector(std::vector integral_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using integral_type = integral; - using integral_vector_type = nil::marshalling::types::standard_array_list< + using integral_vector_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, integral_type>; @@ -414,12 +413,12 @@ namespace nil { template std::vector make_integral_vector( - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - integral, IntegralContainer>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + integral, IntegralContainer>> const& integral_vector) { - std::vector, IntegralContainer>> const& values = + std::vector, IntegralContainer>> const& values = integral_vector.value(); std::size_t size = values.size(); std::vector result; diff --git a/crypto3/libs/marshalling/multiprecision/include/nil/detail/type_traits.hpp b/crypto3/libs/marshalling/multiprecision/include/nil/detail/type_traits.hpp deleted file mode 100644 index 9873546cca..0000000000 --- a/crypto3/libs/marshalling/multiprecision/include/nil/detail/type_traits.hpp +++ /dev/null @@ -1,297 +0,0 @@ -//---------------------------------------------------------------------------// -// Copyright (c) 2018-2021 Mikhail Komarov -// Copyright (c) 2020-2021 Nikita Kaskov -// -// MIT License -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -//---------------------------------------------------------------------------// - -#ifndef NIL_DETAIL_TYPE_TRAITS_HPP -#define NIL_DETAIL_TYPE_TRAITS_HPP - -#include - -#include -#include - -#include -#include - -#define GENERATE_HAS_MEMBER_TYPE(Type) \ - template \ - class HasMemberType_##Type { \ - public: \ - static constexpr bool RESULT = false; \ - }; \ - \ - template \ - class HasMemberType_##Type::value || std::is_union::value>::type> { \ - private: \ - using Yes = char[2]; \ - using No = char[1]; \ - \ - struct Fallback { \ - struct Type { }; \ - }; \ - struct Derived : T, Fallback { }; \ - \ - template \ - static No &test(typename U::Type *); \ - template \ - static Yes &test(U *); \ - \ - public: \ - static constexpr bool RESULT = sizeof(test(nullptr)) == sizeof(Yes); \ - }; \ - \ - template \ - struct has_##Type : public std::integral_constant::RESULT> { }; - -#define GENERATE_HAS_MEMBER(member) \ - template \ - class HasMember_##member { \ - public: \ - static constexpr bool RESULT = false; \ - }; \ - \ - template \ - class HasMember_##member::value || std::is_union::value>::type> { \ - private: \ - using Yes = char[2]; \ - using No = char[1]; \ - \ - struct Fallback { \ - int member; \ - }; \ - struct Derived : T, Fallback { }; \ - \ - template \ - static No &test(decltype(U::member) *); \ - template \ - static Yes &test(U *); \ - \ - public: \ - static constexpr bool RESULT = sizeof(test(nullptr)) == sizeof(Yes); \ - }; \ - \ - template \ - struct has_##member : public std::integral_constant::RESULT> { }; - -#define GENERATE_HAS_MEMBER_FUNCTION(Function, ...) \ - \ - template \ - struct has_##Function { \ - struct Fallback { \ - void Function(##__VA_ARGS__); \ - }; \ - \ - struct Derived : Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -#define GENERATE_HAS_MEMBER_CONST_FUNCTION(Function, ...) \ - \ - template \ - struct has_##Function { \ - struct Fallback { \ - void Function(##__VA_ARGS__) const; \ - }; \ - \ - struct Derived : Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -#define GENERATE_HAS_MEMBER_RETURN_FUNCTION(Function, ReturnType, ...) \ - \ - template \ - struct has_##Function { \ - struct Dummy { \ - typedef void ReturnType; \ - }; \ - typedef typename std::conditional::value, T, Dummy>::type TType; \ - typedef typename TType::ReturnType type; \ - \ - struct Fallback { \ - type Function(##__VA_ARGS__); \ - }; \ - \ - struct Derived : TType, Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -#define GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(Function, ReturnType, ...) \ - \ - template \ - struct has_##Function { \ - struct Dummy { \ - typedef void ReturnType; \ - }; \ - typedef typename std::conditional::value, T, Dummy>::type TType; \ - typedef typename TType::ReturnType type; \ - \ - struct Fallback { \ - type Function(##__VA_ARGS__) const; \ - }; \ - \ - struct Derived : TType, Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -namespace nil { - namespace detail { - - GENERATE_HAS_MEMBER_TYPE(iterator) - GENERATE_HAS_MEMBER_TYPE(const_iterator) - - GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(begin, const_iterator) - GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(end, const_iterator) - - template - struct is_iterator { - static char test(...); - - template::difference_type, - typename = typename std::iterator_traits::pointer, - typename = typename std::iterator_traits::reference, - typename = typename std::iterator_traits::value_type, - typename = typename std::iterator_traits::iterator_category> - static long test(U &&); - - constexpr static bool value = std::is_same())), long>::value; - }; - - template - struct is_range { - static const bool value = has_begin::value && has_end::value; - }; - - template - struct is_container { - static const bool value - = has_const_iterator::value && has_begin::value && has_end::value; - }; - - /// @brief Check whether provided type is a variant of - /// std::tuple. - /// @tparam TType Type to check. - template - struct is_tuple { - /// @brief By default Value has value false. Will be true for any - /// variant of std::tuple. - static const bool value = false; - }; - - /// @cond SKIP_DOC - template - struct is_tuple> { - static const bool value = true; - }; - /// @endcond - - //---------------------------------------- - - /// @brief Check whether TType type is included in the tuple TTuple - /// @tparam TType Type to check - /// @tparam TTuple Tuple - /// @pre @code IsTuple::value == true @endcode - template - class is_in_tuple { - static_assert(is_tuple::value, "TTuple must be std::tuple"); - - public: - /// @brief By default the value is false, will be set to true if TType - /// is found in TTuple. - static const bool value = false; - }; - - /// @cond SKIP_DOC - template - class is_in_tuple> { - public: - static const bool value - = std::is_same::value || is_in_tuple>::value; - }; - - template - class is_in_tuple> { - public: - static const bool value = false; - }; - - template - struct is_array { - static const bool value = false; - }; - - template - struct is_array> { - static const bool value = true; - }; - - template - struct is_array> { - static const bool value = true; - }; - - /// @endcond - } // namespace detail -} // namespace nil - -#endif // NIL_DETAIL_TYPE_TRAITS_HPP \ No newline at end of file diff --git a/crypto3/libs/marshalling/multiprecision/test/integral.cpp b/crypto3/libs/marshalling/multiprecision/test/integral.cpp index 8ee028bef0..5ea95824a1 100644 --- a/crypto3/libs/marshalling/multiprecision/test/integral.cpp +++ b/crypto3/libs/marshalling/multiprecision/test/integral.cpp @@ -78,7 +78,7 @@ void test_round_trip_fixed_precision_big_endian(T val) { using namespace nil::crypto3::marshalling; std::size_t units_bits = std::is_same_v ? 1 : 8 * sizeof(OutputType); using unit_type = OutputType; - using integral_type = types::integral, T>; + using integral_type = types::integral, T>; std::size_t unitblob_size = integral_type::bit_length() / units_bits + ((integral_type::bit_length() % units_bits) ? 1 : 0); @@ -89,16 +89,16 @@ void test_round_trip_fixed_precision_big_endian(T val) { export_bits(val, cv.begin() + begin_index, units_bits, true); - nil::marshalling::status_type status; - T test_val = nil::marshalling::pack(cv, status); + nil::crypto3::marshalling::status_type status; + T test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(val == test_val); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::vector test_cv = nil::marshalling::pack(val, status); + std::vector test_cv = nil::crypto3::marshalling::pack(val, status); BOOST_CHECK(std::equal(test_cv.begin(), test_cv.end(), cv.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template @@ -106,7 +106,7 @@ void test_round_trip_fixed_precision_little_endian(T val) { using namespace nil::crypto3::marshalling; std::size_t units_bits = std::is_same_v ? 1 : 8 * sizeof(OutputType); using unit_type = OutputType; - using integral_type = types::integral, T>; + using integral_type = types::integral, T>; std::size_t unitblob_size = integral_type::bit_length() / units_bits + ((integral_type::bit_length() % units_bits) ? 1 : 0); @@ -115,22 +115,22 @@ void test_round_trip_fixed_precision_little_endian(T val) { export_bits(val, std::back_inserter(cv), units_bits, false); cv.resize(unitblob_size, 0x00); - nil::marshalling::status_type status; - T test_val = nil::marshalling::pack(cv, status); + nil::crypto3::marshalling::status_type status; + T test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(val == test_val); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::vector test_cv = nil::marshalling::pack(val, status); + std::vector test_cv = nil::crypto3::marshalling::pack(val, status); BOOST_CHECK(std::equal(test_cv.begin(), test_cv.end(), cv.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template void test_round_trip_fixed_precision() { - static_assert(nil::marshalling::is_compatible::value); + static_assert(nil::crypto3::marshalling::is_compatible::value); std::cout << std::hex; std::cerr << std::hex; @@ -150,10 +150,10 @@ void test_round_trip_non_fixed_precision(T val) { std::vector cv; export_bits(val, std::back_inserter(cv), units_bits, - std::is_same::value?true:false); + std::is_same::value?true:false); - nil::marshalling::status_type status; - T test_val = nil::marshalling::pack(cv, status); + nil::crypto3::marshalling::status_type status; + T test_val = nil::crypto3::marshalling::pack(cv, status); // std::cout << std::hex << test_val << '\n' << val << '\n'; @@ -170,25 +170,25 @@ void test_round_trip_non_fixed_precision(T val) { BOOST_CHECK(val == test_val); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::vector test_cv = nil::marshalling::pack(val, status); + std::vector test_cv = nil::crypto3::marshalling::pack(val, status); BOOST_CHECK(std::equal(test_cv.begin(), test_cv.end(), cv.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template void test_round_trip_non_fixed_precision() { - static_assert(nil::marshalling::is_compatible::value); + static_assert(nil::crypto3::marshalling::is_compatible::value); std::cout << std::hex; std::cerr << std::hex; for (unsigned i = 0; i < 1000; ++i) { T val = generate_random(); - test_round_trip_non_fixed_precision(val); - test_round_trip_non_fixed_precision(val); + test_round_trip_non_fixed_precision(val); + test_round_trip_non_fixed_precision(val); } } diff --git a/crypto3/libs/marshalling/multiprecision/test/integral_fixed_size_container.cpp b/crypto3/libs/marshalling/multiprecision/test/integral_fixed_size_container.cpp index c456a4857a..267dfa93a1 100644 --- a/crypto3/libs/marshalling/multiprecision/test/integral_fixed_size_container.cpp +++ b/crypto3/libs/marshalling/multiprecision/test/integral_fixed_size_container.cpp @@ -72,10 +72,10 @@ void test_round_trip_fixed_size_container_fixed_precision_big_endian( using namespace nil::crypto3::marshalling; std::size_t units_bits = std::is_same_v ? 1 : sizeof(OutputType) * 8; using unit_type = OutputType; - using integral_type = types::integral, T>; + using integral_type = types::integral, T>; - using container_type = nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, + using container_type = nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, integral_type>; std::size_t unitblob_size = @@ -94,18 +94,18 @@ void test_round_trip_fixed_size_container_fixed_precision_big_endian( export_bits(val_container[i], cv.begin() + unitblob_size * i + begin_index, units_bits, true); } - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array test_val = - nil::marshalling::pack(cv, status); + nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(std::equal(val_container.begin(), val_container.end(), test_val.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); std::vector test_cv = - nil::marshalling::pack(val_container, status); + nil::crypto3::marshalling::pack(val_container, status); BOOST_CHECK(std::equal(test_cv.begin(), test_cv.end(), cv.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template @@ -114,10 +114,10 @@ void test_round_trip_fixed_size_container_fixed_precision_little_endian( using namespace nil::crypto3::marshalling; std::size_t units_bits = std::is_same_v ? 1 : sizeof(OutputType) * 8; using unit_type = OutputType; - using integral_type = types::integral, T>; + using integral_type = types::integral, T>; - using container_type = nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, + using container_type = nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, integral_type>; std::size_t unitblob_size = @@ -132,18 +132,18 @@ void test_round_trip_fixed_size_container_fixed_precision_little_endian( export_bits(val_container[i], cv.begin() + unitblob_size * i, units_bits, false); } - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::array test_val = - nil::marshalling::pack(cv, status); + nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(std::equal(val_container.begin(), val_container.end(), test_val.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); std::vector test_cv = - nil::marshalling::pack(val_container, status); + nil::crypto3::marshalling::pack(val_container, status); BOOST_CHECK(std::equal(test_cv.begin(), test_cv.end(), cv.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } template diff --git a/crypto3/libs/marshalling/multiprecision/test/integral_non_fixed_size_container.cpp b/crypto3/libs/marshalling/multiprecision/test/integral_non_fixed_size_container.cpp index 47a6aff4ad..0b83121edd 100644 --- a/crypto3/libs/marshalling/multiprecision/test/integral_non_fixed_size_container.cpp +++ b/crypto3/libs/marshalling/multiprecision/test/integral_non_fixed_size_container.cpp @@ -72,17 +72,17 @@ void test_round_trip_non_fixed_size_container_fixed_precision(const Container &v using namespace nil::crypto3::marshalling; using unit_type = OutputType; - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector cv = - nil::marshalling::pack(val_container, status); + nil::crypto3::marshalling::pack(val_container, status); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); - std::vector test_val = nil::marshalling::pack(cv, status); + std::vector test_val = nil::crypto3::marshalling::pack(cv, status); BOOST_CHECK(std::equal(val_container.begin(), val_container.end(), test_val.begin())); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); } @@ -107,53 +107,53 @@ void test_round_trip_non_fixed_size_container_fixed_precision() { BOOST_AUTO_TEST_SUITE(integral_non_fixed_test_suite) BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_1024_be) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_1024_le) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_512_be) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_512_le) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_64_be) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::big_endian, + nil::crypto3::marshalling::option::big_endian, nil::crypto3::multiprecision::big_uint<64>, 128, unsigned char>(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_64_le) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::little_endian, + nil::crypto3::marshalling::option::little_endian, nil::crypto3::multiprecision::big_uint<64>, 128, unsigned char>(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_23_be) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::big_endian, + nil::crypto3::marshalling::option::big_endian, nil::crypto3::multiprecision::big_uint<23>, 128, unsigned char>(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_23_le) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::little_endian, + nil::crypto3::marshalling::option::little_endian, nil::crypto3::multiprecision::big_uint<23>, 128, unsigned char>(); } @@ -164,53 +164,53 @@ BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(integral_non_fixed_test_suite_bits) BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_1024_be_bits) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_1024_le_bits) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_512_be_bits) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_512_le_bits) { - test_round_trip_non_fixed_size_container_fixed_precision(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_64_be_bits) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::big_endian, + nil::crypto3::marshalling::option::big_endian, nil::crypto3::multiprecision::big_uint<64>, 128, bool>(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_64_le_bits) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::little_endian, + nil::crypto3::marshalling::option::little_endian, nil::crypto3::multiprecision::big_uint<64>, 128, bool>(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_23_be_bits) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::big_endian, + nil::crypto3::marshalling::option::big_endian, nil::crypto3::multiprecision::big_uint<23>, 128, bool>(); } BOOST_AUTO_TEST_CASE(integral_non_fixed_big_uint_23_le_bits) { test_round_trip_non_fixed_size_container_fixed_precision< - nil::marshalling::option::little_endian, + nil::crypto3::marshalling::option::little_endian, nil::crypto3::multiprecision::big_uint<23>, 128, bool>(); } diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/accumulation_vector.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/accumulation_vector.hpp index 5384217c31..fafba58737 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/accumulation_vector.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/accumulation_vector.hpp @@ -54,40 +54,40 @@ namespace nil { typename AccumulationVector, typename = typename std::enable_if< std::is_same>::value, + nil::crypto3::container::accumulation_vector>::value, bool>::type, typename... TOptions> - using accumulation_vector = nil::marshalling::types::bundle< + using accumulation_vector = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< curve_element, - sparse_vector>>>; + sparse_vector>>>; template - accumulation_vector, AccumulationVector> + accumulation_vector, AccumulationVector> fill_accumulation_vector(const AccumulationVector &accumulation_vector_inp) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_element_type = curve_element; curve_element_type filled_first = curve_element_type(accumulation_vector_inp.first); - return accumulation_vector, AccumulationVector>( + return accumulation_vector, AccumulationVector>( std::make_tuple( filled_first, - fill_sparse_vector, + fill_sparse_vector, Endianness>(accumulation_vector_inp.rest))); } template AccumulationVector make_accumulation_vector( - const accumulation_vector, AccumulationVector> + const accumulation_vector, AccumulationVector> &filled_accumulation_vector) { return AccumulationVector( std::move(std::get<0>(filled_accumulation_vector.value()).value()), - std::move(make_sparse_vector, + std::move(make_sparse_vector, Endianness>(std::get<1>(filled_accumulation_vector.value())))); } } // namespace types diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/commitment_params.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/commitment_params.hpp index 19b2891c59..1a14098c97 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/commitment_params.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/commitment_params.hpp @@ -46,7 +46,7 @@ namespace nil { namespace marshalling { namespace types { template - using field_element_vector_type = nil::marshalling::types::standard_array_list< + using field_element_vector_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >; @@ -54,12 +54,12 @@ namespace nil { // ******************* Marshalling of commitment params for Basic Fri and KZG. ********************************* // template - nil::marshalling::types::standard_size_t_array_list> + nil::crypto3::marshalling::types::standard_size_t_array_list> fill_integer_vector(const std::vector& integral_vector) { - using TTypeBase = nil::marshalling::field_type; - using integral_type = nil::marshalling::types::integral; - using integral_vector_type = nil::marshalling::types::standard_size_t_array_list; + using TTypeBase = nil::crypto3::marshalling::field_type; + using integral_type = nil::crypto3::marshalling::types::integral; + using integral_vector_type = nil::crypto3::marshalling::types::standard_size_t_array_list; integral_vector_type result; @@ -73,7 +73,7 @@ namespace nil { template std::vector make_integer_vector( - const nil::marshalling::types::standard_size_t_array_list >& filled_vector) + const nil::crypto3::marshalling::types::standard_size_t_array_list >& filled_vector) { std::vector result; result.reserve(filled_vector.value().size()); @@ -87,11 +87,11 @@ namespace nil { // This struct will also be used for the dummy commitment params used in testing. template struct commitment_params{ - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::integral, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral, + nil::crypto3::marshalling::types::integral > >; }; @@ -99,16 +99,16 @@ namespace nil { // Marshalling function for dummy params. template typename commitment_params< - nil::marshalling::field_type, CommitmentSchemeType, + nil::crypto3::marshalling::field_type, CommitmentSchemeType, std::enable_if_t && !nil::crypto3::zk::is_kzg> >::type fill_commitment_params(const typename CommitmentSchemeType::params_type &dummy_params) { - using TTypeBase = typename nil::marshalling::field_type; + using TTypeBase = typename nil::crypto3::marshalling::field_type; using result_type = typename commitment_params::type; return result_type(std::make_tuple( - nil::marshalling::types::integral(0), - nil::marshalling::types::integral(0) + nil::crypto3::marshalling::types::integral(0), + nil::crypto3::marshalling::types::integral(0) )); } @@ -120,9 +120,9 @@ namespace nil { std::enable_if_t> > { using CommitmentParamsType = typename CommitmentSchemeType::params_type; - using integral_type = nil::marshalling::types::integral; + using integral_type = nil::crypto3::marshalling::types::integral; using type = - nil::marshalling::types::bundle< + nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // constexpr static std::size_t lambda; @@ -137,7 +137,7 @@ namespace nil { // For each evaluation_domain we will include the unity root only. field_element_vector_type, // const std::vector step_list; - nil::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_size_t_array_list, // const std::size_t expand_factor; integral_type > @@ -147,14 +147,14 @@ namespace nil { // Marshalling function for FRI params. template typename commitment_params< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, CommitmentSchemeType, std::enable_if_t> >::type fill_commitment_params(const typename CommitmentSchemeType::params_type &fri_params) { using CommitmentParamsType = typename CommitmentSchemeType::params_type; - using TTypeBase = typename nil::marshalling::field_type; + using TTypeBase = typename nil::crypto3::marshalling::field_type; using FieldType = typename CommitmentParamsType::field_type; - using result_type = typename commitment_params, CommitmentSchemeType>::type; + using result_type = typename commitment_params, CommitmentSchemeType>::type; std::vector D_unity_roots; for (const auto& domain : fri_params.D) { @@ -162,19 +162,19 @@ namespace nil { } return result_type(std::make_tuple( - nil::marshalling::types::integral(fri_params.lambda), - nil::marshalling::types::integral(fri_params.m), - nil::marshalling::types::integral(fri_params.use_grinding?fri_params.grinding_parameter:0), - nil::marshalling::types::integral(fri_params.max_degree), + nil::crypto3::marshalling::types::integral(fri_params.lambda), + nil::crypto3::marshalling::types::integral(fri_params.m), + nil::crypto3::marshalling::types::integral(fri_params.use_grinding?fri_params.grinding_parameter:0), + nil::crypto3::marshalling::types::integral(fri_params.max_degree), fill_field_element_vector(D_unity_roots), fill_integer_vector(fri_params.step_list), - nil::marshalling::types::integral(fri_params.expand_factor) + nil::crypto3::marshalling::types::integral(fri_params.expand_factor) )); } template typename CommitmentSchemeType::params_type - make_commitment_params(const typename commitment_params, CommitmentSchemeType, std::enable_if_t>>::type &filled_params) { + make_commitment_params(const typename commitment_params, CommitmentSchemeType, std::enable_if_t>>::type &filled_params) { using CommitmentParamsType = typename CommitmentSchemeType::params_type; std::size_t lambda = std::get<0>(filled_params.value()).value(); @@ -203,42 +203,42 @@ namespace nil { // Define commitment_params marshalling type for KZG. template - struct commitment_params, CommitmentSchemeType, std::enable_if_t>> { + struct commitment_params, CommitmentSchemeType, std::enable_if_t>> { using CommitmentParamsType = typename CommitmentSchemeType::params_type; - using TTypeBase = typename nil::marshalling::field_type; + using TTypeBase = typename nil::crypto3::marshalling::field_type; using type = - nil::marshalling::types::bundle< + nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::vector::value_type> commitment_key; - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - curve_element, typename CommitmentSchemeType::curve_type::template g1_type<>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + curve_element, typename CommitmentSchemeType::curve_type::template g1_type<>> > , // verification_key_type verification_key; - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - curve_element, typename CommitmentSchemeType::curve_type::template g2_type<>>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + curve_element, typename CommitmentSchemeType::curve_type::template g2_type<>>> > >; }; // Marshalling function for KZG params. template - typename commitment_params, CommitmentSchemeType, std::enable_if_t>>::type + typename commitment_params, CommitmentSchemeType, std::enable_if_t>>::type fill_commitment_params(const typename CommitmentSchemeType::params_type &kzg_params) { - using result_type = typename commitment_params, CommitmentSchemeType>::type; + using result_type = typename commitment_params, CommitmentSchemeType>::type; - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - curve_element, typename CommitmentSchemeType::curve_type::template g1_type<>>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + curve_element, typename CommitmentSchemeType::curve_type::template g1_type<>>> filled_commitment = fill_curve_element_vector, Endianness>(kzg_params.commitment_key); - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - curve_element, typename CommitmentSchemeType::curve_type::template g2_type<>>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + curve_element, typename CommitmentSchemeType::curve_type::template g2_type<>>> filled_verification_key = fill_curve_element_vector, Endianness>(kzg_params.verification_key); return result_type(std::make_tuple( @@ -250,7 +250,7 @@ namespace nil { // Marshalling function for KZG params. template typename CommitmentSchemeType::params_type - make_commitment_params(const typename commitment_params, CommitmentSchemeType, std::enable_if_t>>::type &filled_kzg_params) { + make_commitment_params(const typename commitment_params, CommitmentSchemeType, std::enable_if_t>>::type &filled_kzg_params) { return result_type(std::make_tuple( make_curve_element_vector, Endianness>(std::get<0>(filled_kzg_params.value()).value()), make_curve_element_vector, Endianness>(std::get<1>(filled_kzg_params.value()).value()) diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/eval_storage.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/eval_storage.hpp index b84e19a86c..8f42d2e317 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/eval_storage.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/eval_storage.hpp @@ -59,56 +59,56 @@ namespace nil { struct eval_proof; template - using eval_storage = nil::marshalling::types::bundle< + using eval_storage = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // batch_info. // We'll check is it good for current EVM instance // All z-s are placed into plain array - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral >, // evaluation_points_num. - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > > >; template - eval_storage, EvalStorage> + eval_storage, EvalStorage> fill_eval_storage( const EvalStorage &z ){ - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; nil::crypto3::marshalling::types::batch_info_type batch_info; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > filled_batch_info; auto batches = z.get_batches(); for( std::size_t i = 0; i < batches.size(); i++ ){ batch_info[batches[i]] = z.get_batch_size(batches[i]); - filled_batch_info.value().push_back(nil::marshalling::types::integral(batches[i])); - filled_batch_info.value().push_back(nil::marshalling::types::integral(z.get_batch_size(batches[i]))); + filled_batch_info.value().push_back(nil::crypto3::marshalling::types::integral(batches[i])); + filled_batch_info.value().push_back(nil::crypto3::marshalling::types::integral(z.get_batch_size(batches[i]))); } - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > filled_eval_points_num; for( std::size_t i = 0; i < batches.size(); i++ ){ for( std::size_t j = 0; j < z.get_batch_size(batches[i]); j++ ){ filled_eval_points_num.value().push_back( - nil::marshalling::types::integral(z.get_poly_points_number(batches[i], j)) + nil::crypto3::marshalling::types::integral(z.get_poly_points_number(batches[i], j)) ); } } @@ -121,7 +121,7 @@ namespace nil { } } } - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element > filled_z = fill_field_element_vector(z_val); @@ -133,7 +133,7 @@ namespace nil { template EvalStorage make_eval_storage( - const eval_storage, EvalStorage> &filled_storage) + const eval_storage, EvalStorage> &filled_storage) { EvalStorage z; typename nil::crypto3::marshalling::types::batch_info_type batch_info; diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/fri.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/fri.hpp index 667badf265..05e8678b49 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/fri.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/fri.hpp @@ -55,15 +55,15 @@ namespace nil { // fri::merkle_proofs marshalling /////////////////////////////////////////////////// template - using merkle_proof_vector_type = nil::marshalling::types::standard_array_list< + using merkle_proof_vector_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, types::merkle_proof >; template< typename Endianness, typename FRI > - merkle_proof_vector_type, FRI> + merkle_proof_vector_type, FRI> fill_merkle_proof_vector(const std::vector &merkle_proofs) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using filled_type = merkle_proof_vector_type; filled_type filled; @@ -79,7 +79,7 @@ namespace nil { template std::vector - make_merkle_proof_vector(merkle_proof_vector_type, FRI> &filled) { + make_merkle_proof_vector(merkle_proof_vector_type, FRI> &filled) { std::vector merkle_proofs; for( std::size_t i = 0; i < filled.value().size(); i++ ){ merkle_proofs.push_back( @@ -93,15 +93,15 @@ namespace nil { // fri::initial_proof_type marshalling /////////////////////////////////////////////////// template - using fri_initial_proof_type = nil::marshalling::types::bundle< + using fri_initial_proof_type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // polynomials_values_type values; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element>> >, @@ -111,20 +111,20 @@ namespace nil { >; template - fri_initial_proof_type, FRI> + fri_initial_proof_type, FRI> fill_fri_initial_proof( const typename FRI::initial_proof_type &initial_proof ) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using filled_type = fri_initial_proof_type; - using outer_list_type = nil::marshalling::types::standard_array_list< + using outer_list_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element > >; - using inner_list_type = nil::marshalling::types::standard_array_list< + using inner_list_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >; @@ -155,7 +155,7 @@ namespace nil { template typename FRI::initial_proof_type make_fri_initial_proof( - const fri_initial_proof_type, FRI> &filled + const fri_initial_proof_type, FRI> &filled ) { typename FRI::initial_proof_type initial_proof; // polynomials_values_type values; @@ -183,11 +183,11 @@ namespace nil { // fri::round_proof_type marshalling /////////////////////////////////////////////////// template - using fri_round_proof_type = nil::marshalling::types::bundle< + using fri_round_proof_type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::vector> y; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >, @@ -197,11 +197,11 @@ namespace nil { >; template - fri_round_proof_type, FRI> + fri_round_proof_type, FRI> fill_fri_round_proof( const typename FRI::round_proof_type &round_proof ) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using filled_type = fri_round_proof_type; filled_type filled; @@ -224,7 +224,7 @@ namespace nil { template typename FRI::round_proof_type make_fri_round_proof( - const fri_round_proof_type, FRI> &filled + const fri_round_proof_type, FRI> &filled ) { typename FRI::round_proof_type round_proof; // std::vector> y; @@ -255,16 +255,16 @@ namespace nil { // fri::query_proof_type marshalling /////////////////////////////////////////////////// template - using fri_query_proof_type = nil::marshalling::types::bundle< + using fri_query_proof_type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::map initial_proof; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fri_initial_proof_type >, // std::vector round_proofs; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fri_round_proof_type > @@ -272,11 +272,11 @@ namespace nil { >; template - fri_query_proof_type, FRI> + fri_query_proof_type, FRI> fill_fri_query_proof( const typename FRI::query_proof_type &query_proof ) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using filled_type = fri_query_proof_type; filled_type filled; @@ -299,7 +299,7 @@ namespace nil { template typename FRI::query_proof_type make_fri_query_proof( - const fri_query_proof_type, FRI> &filled, + const fri_query_proof_type, FRI> &filled, const batch_info_type &batch_info, const std::vector &step_list) { @@ -339,27 +339,27 @@ namespace nil { // fri::proof_type marshalling /////////////////////////////////////////////////// template struct fri_proof { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // step_list.size() merkle roots // Fixed size. It's Ok - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_node_value::type >, // step_list. // We'll check is it good for current EVM instance - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral >, // Polynomials' values for initial proofs // Fixed size // lambda * polynomials_num * m - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >, @@ -367,21 +367,21 @@ namespace nil { // Polynomials' values for round proofs // Fixed size // lambda * \sum_rounds{m^{r_i}} - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >, // Merkle proofs for initial proofs // Fixed size lambda * batches_num - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_proof >, // Merkle proofs for round proofs // Fixed size lambda * |step_list| - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_proof >, @@ -391,7 +391,7 @@ namespace nil { typename polynomial::type, // proof of work. - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > >; }; @@ -399,12 +399,12 @@ namespace nil { using batch_info_type = std::map;// batch_id->batch_size template - typename fri_proof, FRI>::type + typename fri_proof, FRI>::type fill_fri_proof(const typename FRI::proof_type &proof, const batch_info_type &batch_info, const typename FRI::params_type& params) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; // merkle roots - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_node_value::type > filled_fri_roots; for( size_t i = 0; i < proof.fri_roots.size(); i++){ @@ -439,7 +439,7 @@ namespace nil { } } } - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element > filled_initial_val = fill_field_element_vector(initial_val); @@ -456,22 +456,22 @@ namespace nil { } } } - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element > filled_round_val = fill_field_element_vector(round_val); // step_list - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > filled_step_list; for (const auto& step : params.step_list) { - filled_step_list.value().push_back(nil::marshalling::types::integral(step)); + filled_step_list.value().push_back(nil::crypto3::marshalling::types::integral(step)); } // initial merkle proofs - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_proof > filled_initial_merkle_proofs; @@ -486,7 +486,7 @@ namespace nil { } // round merkle proofs - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_proof > filled_round_merkle_proofs; @@ -504,11 +504,11 @@ namespace nil { ); // proof_of_work - return typename fri_proof, FRI>::type( + return typename fri_proof, FRI>::type( std::tuple( filled_fri_roots, filled_step_list, filled_initial_val, filled_round_val, filled_initial_merkle_proofs, filled_round_merkle_proofs, filled_final_polynomial, - nil::marshalling::types::integral( + nil::crypto3::marshalling::types::integral( proof.proof_of_work) ) ); @@ -517,7 +517,7 @@ namespace nil { template typename FRI::proof_type make_fri_proof( - const typename fri_proof, FRI>::type &filled_proof, + const typename fri_proof, FRI>::type &filled_proof, const batch_info_type &batch_info) { typename FRI::proof_type proof; @@ -620,16 +620,16 @@ namespace nil { } template - using initial_proofs_batch_type = nil::marshalling::types::standard_array_list< + using initial_proofs_batch_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::bundle< + nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral >, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fri_initial_proof_type > @@ -638,18 +638,18 @@ namespace nil { >; template - initial_proofs_batch_type, FRI> + initial_proofs_batch_type, FRI> fill_initial_proofs_batch(const typename FRI::initial_proofs_batch_type &initial_proofs_batch) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using filled_type = initial_proofs_batch_type; - using bundle_type = nil::marshalling::types::bundle< + using bundle_type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral >, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fri_initial_proof_type > @@ -659,17 +659,17 @@ namespace nil { filled_type filled; for (const auto &inital_proof : initial_proofs_batch.initial_proofs) { - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > filled_step_list; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fri_initial_proof_type > filled_initial_proofs; for (const auto &[step_list, proof] : inital_proof) { filled_step_list.value().push_back( - nil::marshalling::types::integral(step_list)); + nil::crypto3::marshalling::types::integral(step_list)); filled_initial_proofs.value().push_back(fill_fri_initial_proof( proof)); } @@ -682,7 +682,7 @@ namespace nil { template typename FRI::initial_proofs_batch_type make_initial_proofs_batch( - const initial_proofs_batch_type, FRI> &filled) + const initial_proofs_batch_type, FRI> &filled) { typename FRI::initial_proofs_batch_type initial_proofs_batch; for (const auto &batch : filled.value()) { @@ -699,24 +699,24 @@ namespace nil { } template - using round_proofs_batch_type = nil::marshalling::types::standard_array_list< + using round_proofs_batch_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fri_round_proof_type > >; template - round_proofs_batch_type, FRI> + round_proofs_batch_type, FRI> fill_round_proofs_batch(const typename FRI::round_proofs_batch_type &round_proofs_batch) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using filled_type = round_proofs_batch_type; filled_type filled; for (const auto &round_proof_vector : round_proofs_batch.round_proofs) { - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fri_round_proof_type > filled_round_proof_vector; @@ -732,7 +732,7 @@ namespace nil { template typename FRI::round_proofs_batch_type make_round_proofs_batch( - const round_proofs_batch_type, FRI> &filled) + const round_proofs_batch_type, FRI> &filled) { typename FRI::round_proofs_batch_type round_proofs_batch; for (const auto &round_proof_vector : filled.value()) { @@ -746,10 +746,10 @@ namespace nil { } template - using commitments_part_of_proof_type = nil::marshalling::types::bundle< + using commitments_part_of_proof_type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_node_value::type >, @@ -758,16 +758,16 @@ namespace nil { >; template - commitments_part_of_proof_type, FRI> + commitments_part_of_proof_type, FRI> fill_commitments_part_of_proof( const typename FRI::commitments_part_of_proof &commitments_part_of_proof ) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using filled_type = commitments_part_of_proof_type; filled_type filled; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename types::merkle_node_value::type > filled_fri_roots; @@ -786,7 +786,7 @@ namespace nil { template typename FRI::commitments_part_of_proof make_commitments_part_of_proof( - const commitments_part_of_proof_type, FRI> &filled + const commitments_part_of_proof_type, FRI> &filled ) { typename FRI::commitments_part_of_proof commitments_part_of_proof; for (const auto &fri_root : std::get<0>(filled.value()).value()) { diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/kzg.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/kzg.hpp index b54055643d..1800dde8d7 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/kzg.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/kzg.hpp @@ -53,28 +53,28 @@ namespace nil { * */ template struct commitment>> { - using type = nil::marshalling::types::array_list< + using type = nil::crypto3::marshalling::types::array_list< TTypeBase, - nil::marshalling::types::integral, - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::types::integral, + nil::crypto3::marshalling::option::sequence_size_field_prefix> >; }; template - typename commitment, KZGScheme, std::enable_if_t>>::type + typename commitment, KZGScheme, std::enable_if_t>>::type fill_commitment(typename KZGScheme::commitment_type commitment) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using result_type = typename nil::crypto3::marshalling::types::commitment::type; result_type result; for( auto it = commitment.begin(); it != commitment.end(); it++ ){ - result.value().push_back(nil::marshalling::types::integral(*it)); + result.value().push_back(nil::crypto3::marshalling::types::integral(*it)); } return result; } template typename KZGScheme::commitment_type - make_commitment(typename commitment, KZGScheme, std::enable_if_t>>::type const& filled_commitment) { + make_commitment(typename commitment, KZGScheme, std::enable_if_t>>::type const& filled_commitment) { typename KZGScheme::commitment_type result; for( std::size_t i = 0; i < filled_commitment.value().size(); i++ ){ result.push_back(filled_commitment.value()[i].value()); @@ -86,7 +86,7 @@ namespace nil { template struct eval_proof > > { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< eval_storage, @@ -97,9 +97,9 @@ namespace nil { }; template - typename eval_proof, KZGScheme, std::enable_if_t>>::type + typename eval_proof, KZGScheme, std::enable_if_t>>::type fill_eval_proof( const typename KZGScheme::proof_type &proof, typename KZGScheme::params_type const& params) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; nil::crypto3::marshalling::types::batch_info_type batch_info = proof.z.get_batch_info(); @@ -117,7 +117,7 @@ namespace nil { template typename KZGScheme::proof_type - make_eval_proof(const typename eval_proof, KZGScheme, std::enable_if_t>>::type &filled_proof) { + make_eval_proof(const typename eval_proof, KZGScheme, std::enable_if_t>>::type &filled_proof) { typename KZGScheme::proof_type proof; proof.z = make_eval_storage(std::get<0>(filled_proof.value())); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/lpc.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/lpc.hpp index cdd28022ce..4ee96db76c 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/lpc.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/lpc.hpp @@ -70,7 +70,7 @@ namespace nil { template typename commitment< - nil::marshalling::field_type, LPCScheme, + nil::crypto3::marshalling::field_type, LPCScheme, std::enable_if_t> >::type fill_commitment(typename LPCScheme::commitment_type commitment) { @@ -80,7 +80,7 @@ namespace nil { template typename LPCScheme::commitment_type make_commitment(typename commitment< - nil::marshalling::field_type, LPCScheme, + nil::crypto3::marshalling::field_type, LPCScheme, std::enable_if_t> >::type const& filled_commitment) { return make_merkle_node_value( filled_commitment ); @@ -89,12 +89,12 @@ namespace nil { // * LPCScheme is like lpc_commitment_scheme template struct commitment_preprocessed_data>> { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_size_t_array_list, - nil::marshalling::types::standard_size_t_array_list, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element > @@ -104,26 +104,26 @@ namespace nil { template typename commitment_preprocessed_data< - nil::marshalling::field_type, LPCScheme, + nil::crypto3::marshalling::field_type, LPCScheme, std::enable_if_t> >::type fill_commitment_preprocessed_data(const typename LPCScheme::preprocessed_data_type& lpc_data){ - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using field_marshalling_type = field_element; using result_type = typename commitment_preprocessed_data< - nil::marshalling::field_type, LPCScheme + nil::crypto3::marshalling::field_type, LPCScheme >::type; - nil::marshalling::types::standard_size_t_array_list filled_map_ids; - nil::marshalling::types::standard_size_t_array_list filled_sizes; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list filled_map_ids; + nil::crypto3::marshalling::types::standard_size_t_array_list filled_sizes; + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element > filled_values; for (const auto&[k, v]: lpc_data) { - filled_map_ids.value().push_back(nil::marshalling::types::integral(k)); - filled_sizes.value().push_back(nil::marshalling::types::integral(v.size())); + filled_map_ids.value().push_back(nil::crypto3::marshalling::types::integral(k)); + filled_sizes.value().push_back(nil::crypto3::marshalling::types::integral(v.size())); for (std::size_t i = 0; i < v.size(); i++) { filled_values.value().push_back(field_marshalling_type((v[i]))); } @@ -141,7 +141,7 @@ namespace nil { template typename LPCScheme::preprocessed_data_type make_commitment_preprocessed_data(typename commitment_preprocessed_data< - nil::marshalling::field_type, LPCScheme, + nil::crypto3::marshalling::field_type, LPCScheme, std::enable_if_t> >::type const& filled_commitment_preprocessed_data ) { @@ -177,7 +177,7 @@ namespace nil { // FOR LPC only because of basic_fri field template struct eval_proof> > { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // Evaluation points storage z @@ -190,9 +190,9 @@ namespace nil { }; template - typename eval_proof, LPCScheme,std::enable_if_t>>::type + typename eval_proof, LPCScheme,std::enable_if_t>>::type fill_eval_proof( const typename LPCScheme::proof_type &proof, const typename LPCScheme::fri_type::params_type& fri_params){ - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; nil::crypto3::marshalling::types::batch_info_type batch_info = proof.z.get_batch_info(); @@ -210,7 +210,7 @@ namespace nil { template typename LPCScheme::proof_type make_eval_proof( const typename eval_proof< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, LPCScheme, std::enable_if_t> >::type &filled_proof @@ -255,12 +255,12 @@ namespace nil { // changes the state of the 'lpc_commitment_scheme' class. template struct commitment_scheme_state> > { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::map _trees; - nil::marshalling::types::standard_size_t_array_list< TTypeBase >, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list< TTypeBase >, + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename precommitment_type::type >, @@ -271,10 +271,10 @@ namespace nil { field_element, //std::map _batch_fixed; - nil::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_size_t_array_list, // Next value was supposed to be a vector of bool, but our marshalling core // does not allow us to create an array_list of bools. - nil::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_size_t_array_list, // preprocessed_data_type _fixed_polys_values; typename commitment_preprocessed_data< TTypeBase, LPCScheme, @@ -287,19 +287,19 @@ namespace nil { }; template - typename commitment_scheme_state, LPCScheme, + typename commitment_scheme_state, LPCScheme, std::enable_if_t>>::type fill_commitment_scheme(const LPCScheme &scheme) { - using TTypeBase = nil::marshalling::field_type; - using result_type = typename commitment_scheme_state, LPCScheme>::type; + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = typename commitment_scheme_state, LPCScheme>::type; // std::map _trees; - nil::marshalling::types::standard_size_t_array_list filled_trees_keys; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list filled_trees_keys; + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename precommitment_type::type> filled_trees_values; for (const auto&[key, value]: scheme.get_trees()) { - filled_trees_keys.value().push_back(nil::marshalling::types::integral(key)); + filled_trees_keys.value().push_back(nil::crypto3::marshalling::types::integral(key)); // Precommitment for LPC is a merkle tree. We may want to abstract away this part into a separate // fill_precommitment function. filled_trees_values.value().push_back( @@ -307,14 +307,14 @@ namespace nil { } //std::map _batch_fixed; - nil::marshalling::types::standard_size_t_array_list filled_batch_fixed_keys; - nil::marshalling::types::standard_size_t_array_list filled_batch_fixed_values; + nil::crypto3::marshalling::types::standard_size_t_array_list filled_batch_fixed_keys; + nil::crypto3::marshalling::types::standard_size_t_array_list filled_batch_fixed_values; for (const auto&[key, value]: scheme.get_batch_fixed()) { filled_batch_fixed_keys.value().push_back( - nil::marshalling::types::integral(key)); + nil::crypto3::marshalling::types::integral(key)); // Here we convert the value, that is a 'bool' into size_t, which is not good. filled_batch_fixed_values.value().push_back( - nil::marshalling::types::integral(value)); + nil::crypto3::marshalling::types::integral(value)); } return result_type(std::make_tuple( @@ -331,10 +331,10 @@ namespace nil { } template - outcome::result + outcome::result make_commitment_scheme( typename commitment_scheme_state< - nil::marshalling::field_type, LPCScheme, + nil::crypto3::marshalling::field_type, LPCScheme, std::enable_if_t>>::type& filled_commitment_scheme ) { std::map trees; @@ -342,7 +342,7 @@ namespace nil { const auto& filled_tree_values = std::get<1>(filled_commitment_scheme.value()).value(); if (filled_tree_keys.size() != filled_tree_values.size()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } for (std::size_t i = 0; i < filled_tree_keys.size(); i++) { @@ -359,7 +359,7 @@ namespace nil { const auto& batch_fixed_keys = std::get<4>(filled_commitment_scheme.value()).value(); const auto& batch_fixed_values = std::get<5>(filled_commitment_scheme.value()).value(); if (batch_fixed_keys.size() != batch_fixed_values.size()) { - return nil::marshalling::status_type::invalid_msg_data; + return nil::crypto3::marshalling::status_type::invalid_msg_data; } @@ -381,7 +381,7 @@ namespace nil { } template - using initial_fri_proof_type = nil::marshalling::types::bundle< + using initial_fri_proof_type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // typename basic_fri::round_proofs_batch_type fri_round_proof; @@ -396,9 +396,9 @@ namespace nil { >; template - initial_fri_proof_type, LPCScheme> + initial_fri_proof_type, LPCScheme> fill_initial_fri_proof(const typename LPCScheme::fri_proof_type &proof) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; nil::crypto3::marshalling::types::round_proofs_batch_type< TTypeBase, @@ -414,14 +414,14 @@ namespace nil { fill_commitments_part_of_proof( proof.fri_commitments_proof_part); - return initial_fri_proof_type, LPCScheme>( + return initial_fri_proof_type, LPCScheme>( std::make_tuple(filled_round_proofs_batch, filled_commitments_part_of_proof)); } template typename LPCScheme::fri_proof_type make_initial_fri_proof( - const initial_fri_proof_type, LPCScheme> &filled_proof) + const initial_fri_proof_type, LPCScheme> &filled_proof) { typename LPCScheme::fri_proof_type proof; @@ -437,7 +437,7 @@ namespace nil { } template - using inital_eval_proof = nil::marshalling::types::bundle< + using inital_eval_proof = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // eval_storage_type z; @@ -448,7 +448,7 @@ namespace nil { >; template - inital_eval_proof, LPCScheme> + inital_eval_proof, LPCScheme> fill_initial_eval_proof( const typename LPCScheme::lpc_proof_type &intial_proof ){ @@ -456,12 +456,12 @@ namespace nil { intial_proof.z); initial_proofs_batch_type< - nil::marshalling::field_type, typename LPCScheme::basic_fri> filled_fri_proof = + nil::crypto3::marshalling::field_type, typename LPCScheme::basic_fri> filled_fri_proof = fill_initial_proofs_batch( intial_proof.initial_fri_proofs ); - return inital_eval_proof, LPCScheme>( + return inital_eval_proof, LPCScheme>( std::tuple(filled_z, filled_fri_proof) ); } @@ -469,7 +469,7 @@ namespace nil { template typename LPCScheme::lpc_proof_type make_initial_eval_proof( - const inital_eval_proof, LPCScheme> &filled_proof) + const inital_eval_proof, LPCScheme> &filled_proof) { typename LPCScheme::lpc_proof_type proof; @@ -483,36 +483,36 @@ namespace nil { } template - using aggregated_proof = nil::marshalling::types::bundle< + using aggregated_proof = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // fri_proof_type fri_proof; initial_fri_proof_type, // std::vector initial_proofs_per_prover; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, inital_eval_proof >, // typename LPCParams::grinding_type::output_type proof_of_work; - nil::marshalling::types::integral< + nil::crypto3::marshalling::types::integral< TTypeBase, typename LPCScheme::params_type::grinding_type::output_type> > >; template - aggregated_proof, LPCScheme> + aggregated_proof, LPCScheme> fill_aggregated_proof( const typename LPCScheme::aggregated_proof_type &proof, const typename LPCScheme::fri_type::params_type &fri_params ){ - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; initial_fri_proof_type filled_fri_proof = fill_initial_fri_proof( proof.fri_proof ); - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, inital_eval_proof > filled_initial_proofs; @@ -524,11 +524,11 @@ namespace nil { ); } - return aggregated_proof, LPCScheme>( + return aggregated_proof, LPCScheme>( std::make_tuple( filled_fri_proof, filled_initial_proofs, - nil::marshalling::types::integral< + nil::crypto3::marshalling::types::integral< TTypeBase, typename LPCScheme::params_type::grinding_type::output_type>( proof.proof_of_work) ) @@ -538,7 +538,7 @@ namespace nil { template typename LPCScheme::aggregated_proof_type make_aggregated_proof( - const aggregated_proof, LPCScheme> &filled_proof + const aggregated_proof, LPCScheme> &filled_proof ) { typename LPCScheme::aggregated_proof_type proof; diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/polys_evaluator.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/polys_evaluator.hpp index 84f8bc8764..dcbefc5615 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/polys_evaluator.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/commitments/polys_evaluator.hpp @@ -50,24 +50,24 @@ namespace nil { // * PolysEvaluator is like lpc_commitment_scheme template - using polys_evaluator = nil::marshalling::types::bundle< + using polys_evaluator = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::map> _polys; - nil::marshalling::types::standard_size_t_array_list, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, polynomial_vector >, // std::map _locked; - nil::marshalling::types::standard_size_t_array_list, - nil::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_size_t_array_list, // std::map>> _points; - nil::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_size_t_array_list, // Next structure is a vector of vector of vector of field values. - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element_vector > @@ -78,25 +78,25 @@ namespace nil { >; // this one closes the bundle template - polys_evaluator, PolysEvaluator> + polys_evaluator, PolysEvaluator> fill_polys_evaluator(const PolysEvaluator& evaluator) { - using nil::marshalling::types::fill_size_t; - using nil::marshalling::types::fill_std_map; - using nil::marshalling::types::standard_array_list; - using nil::marshalling::types::fill_standard_array_list; + using nil::crypto3::marshalling::types::fill_size_t; + using nil::crypto3::marshalling::types::fill_std_map; + using nil::crypto3::marshalling::types::standard_array_list; + using nil::crypto3::marshalling::types::fill_standard_array_list; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using polynomial_type = typename PolysEvaluator::polynomial_type; using value_type = typename polynomial_type::value_type; - using size_t_marshalling_type = nil::marshalling::types::integral; + using size_t_marshalling_type = nil::crypto3::marshalling::types::integral; using polynomial_vector_marshalling_type = polynomial_vector; - using field_element_vector_type = field_element_vector>; + using field_element_vector_type = field_element_vector>; using array_of_field_element_vector_type = standard_array_list; - using result_type = polys_evaluator, PolysEvaluator>; + using result_type = polys_evaluator, PolysEvaluator>; auto [filled_polys_keys, filled_polys_values] = fill_std_map< TTypeBase, @@ -146,25 +146,25 @@ namespace nil { template PolysEvaluator make_polys_evaluator( - const polys_evaluator, PolysEvaluator>& filled_polys_evaluator) + const polys_evaluator, PolysEvaluator>& filled_polys_evaluator) { - using nil::marshalling::types::make_size_t; - using nil::marshalling::types::make_std_map; - using nil::marshalling::types::standard_array_list; - using nil::marshalling::types::make_standard_array_list; + using nil::crypto3::marshalling::types::make_size_t; + using nil::crypto3::marshalling::types::make_std_map; + using nil::crypto3::marshalling::types::standard_array_list; + using nil::crypto3::marshalling::types::make_standard_array_list; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using polynomial_type = typename PolysEvaluator::polynomial_type; using value_type = typename polynomial_type::value_type; - using size_t_marshalling_type = nil::marshalling::types::integral; + using size_t_marshalling_type = nil::crypto3::marshalling::types::integral; using polynomial_vector_marshalling_type = polynomial_vector; - using field_element_vector_type = field_element_vector>; + using field_element_vector_type = field_element_vector>; using array_of_field_element_vector_type = standard_array_list; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using polynomial_type = typename PolysEvaluator::polynomial_type; using value_type = typename polynomial_type::value_type; diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/fast_knowledge_commitment.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/fast_knowledge_commitment.hpp index 78b44857c4..8adfaebe8f 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/fast_knowledge_commitment.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/fast_knowledge_commitment.hpp @@ -60,7 +60,7 @@ namespace nil { bool>::type, typename... TOptions> using fast_knowledge_commitment = - nil::marshalling::types::bundle, @@ -68,19 +68,19 @@ namespace nil { fast_curve_element>>; template - fast_knowledge_commitment, KnowledgeCommitment> + fast_knowledge_commitment, KnowledgeCommitment> fill_fast_knowledge_commitment(const typename KnowledgeCommitment::value_type &kc) { auto filled_g = fill_fast_curve_element(kc.g); auto filled_h = fill_fast_curve_element(kc.h); - return fast_knowledge_commitment, KnowledgeCommitment>( + return fast_knowledge_commitment, KnowledgeCommitment>( std::make_tuple(filled_g, filled_h)); } template typename KnowledgeCommitment::value_type - make_fast_knowledge_commitment(const fast_knowledge_commitment, + make_fast_knowledge_commitment(const fast_knowledge_commitment, KnowledgeCommitment> &filled_kc) { return typename KnowledgeCommitment::value_type(std::move(make_fast_curve_element(std::get<0>(filled_kc.value()))), @@ -88,17 +88,17 @@ namespace nil { } template - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - fast_knowledge_commitment, KnowledgeCommitment>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + fast_knowledge_commitment, KnowledgeCommitment>> fill_fast_knowledge_commitment_vector( const std::vector &kc_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using kc_element_type = fast_knowledge_commitment; - using kc_element_vector_type = nil::marshalling::types::standard_array_list< + using kc_element_vector_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, kc_element_type>; @@ -113,14 +113,14 @@ namespace nil { template std::vector make_fast_knowledge_commitment_vector( - const nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - fast_knowledge_commitment, KnowledgeCommitment>> + const nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + fast_knowledge_commitment, KnowledgeCommitment>> &filled_kc_vector) { std::vector result; const std::vector< - fast_knowledge_commitment, KnowledgeCommitment>> &values = + fast_knowledge_commitment, KnowledgeCommitment>> &values = filled_kc_vector.value(); std::size_t size = values.size(); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/knowledge_commitment.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/knowledge_commitment.hpp index 3c8fdca5f6..9d3ebe4150 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/knowledge_commitment.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/knowledge_commitment.hpp @@ -59,7 +59,7 @@ namespace nil { bool>::type, typename... TOptions> using knowledge_commitment = - nil::marshalling::types::bundle, @@ -67,24 +67,24 @@ namespace nil { curve_element>>; template - knowledge_commitment, KnowledgeCommitment> + knowledge_commitment, KnowledgeCommitment> fill_knowledge_commitment(const typename KnowledgeCommitment::value_type &kc) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_type1_element_type = curve_element; using curve_type2_element_type = curve_element; curve_type1_element_type filled_g = curve_type1_element_type(kc.g); curve_type2_element_type filled_h = curve_type2_element_type(kc.h); - return knowledge_commitment, KnowledgeCommitment>( + return knowledge_commitment, KnowledgeCommitment>( std::make_tuple(filled_g, filled_h)); } template typename KnowledgeCommitment::value_type make_knowledge_commitment( - const knowledge_commitment, KnowledgeCommitment> &filled_kc) + const knowledge_commitment, KnowledgeCommitment> &filled_kc) { return typename KnowledgeCommitment::value_type( std::move(std::get<0>(filled_kc.value()).value()), @@ -92,17 +92,17 @@ namespace nil { } template - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - knowledge_commitment, KnowledgeCommitment>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + knowledge_commitment, KnowledgeCommitment>> fill_knowledge_commitment_vector( const std::vector &kc_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using kc_element_type = knowledge_commitment; - using kc_element_vector_type = nil::marshalling::types::standard_array_list< + using kc_element_vector_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, kc_element_type>; @@ -117,13 +117,13 @@ namespace nil { template std::vector make_knowledge_commitment_vector( - const nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - knowledge_commitment, KnowledgeCommitment>> + const nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + knowledge_commitment, KnowledgeCommitment>> &filled_kc_vector) { const std::vector< - knowledge_commitment, KnowledgeCommitment>> &values = + knowledge_commitment, KnowledgeCommitment>> &values = filled_kc_vector.value(); std::size_t size = values.size(); std::vector result; diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/common_data.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/common_data.hpp index f4ab6e9979..82ac12ed79 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/common_data.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/common_data.hpp @@ -51,7 +51,7 @@ namespace nil { namespace types { // ******************* placeholder common data ********************************* // template - using placeholder_common_data = nil::marshalling::types::bundle< + using placeholder_common_data = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // typename CommonDataType::public_commitments_type commitments; @@ -59,44 +59,44 @@ namespace nil { typename commitment::type, // 1.std::array, ParamsType::arithmetization_params::TotalColumns> columns_rotations; - nil::marshalling::types::array_list , - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::types::array_list , + nil::crypto3::marshalling::option::sequence_size_field_prefix> >, - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::option::sequence_size_field_prefix> >, // 2. std::size_t witness_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 3. std::size_t public_input_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 4. std::size_t constant_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 5. std::size_t selector_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 6. std::size_t usable_rows_amount; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 7. std::size_t rows_amount; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 8. std::size_t max_gates_degree; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 9. std::size_t permutation_parts - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 10. std::size_t lookup_parts - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 11. std::size_t max_quotient_chunks - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // 12. permuted_columns // global indices of permuted columns - nil::marshalling::types::array_list , - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::types::array_list , + nil::crypto3::marshalling::option::sequence_size_field_prefix> >, // 13. verification_key.constraint_system_with_params_hash - nil::marshalling::types::array_list , - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::types::array_list , + nil::crypto3::marshalling::option::sequence_size_field_prefix> >, // 14. commitment_scheme_type::params_type typename nil::crypto3::marshalling::types::commitment_params< @@ -110,26 +110,26 @@ namespace nil { >; template - placeholder_common_data, CommonDataType> + placeholder_common_data, CommonDataType> fill_placeholder_common_data(const CommonDataType &common_data){ - using TTypeBase = typename nil::marshalling::field_type; + using TTypeBase = typename nil::crypto3::marshalling::field_type; using result_type = placeholder_common_data; - using array_int_marshalling_type = nil::marshalling::types::array_list , - nil::marshalling::option::sequence_size_field_prefix> + using array_int_marshalling_type = nil::crypto3::marshalling::types::array_list , + nil::crypto3::marshalling::option::sequence_size_field_prefix> >; - using column_r_marshalling_type = nil::marshalling::types::array_list > + nil::crypto3::marshalling::option::sequence_size_field_prefix> >; column_r_marshalling_type filled_columns_rotations; for( const auto &column_rotation:common_data.columns_rotations){ array_int_marshalling_type filled_column; for( const auto &i:column_rotation){ - filled_column.value().push_back(nil::marshalling::types::integral(i)); + filled_column.value().push_back(nil::crypto3::marshalling::types::integral(i)); } filled_columns_rotations.value().push_back(filled_column); } @@ -139,9 +139,9 @@ namespace nil { common_data.commitments.fixed_values ); - nil::marshalling::types::array_list , - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::types::array_list , + nil::crypto3::marshalling::option::sequence_size_field_prefix> > filled_constraint_system_with_params_hash; if constexpr(nil::crypto3::algebra::is_field_element< @@ -152,24 +152,24 @@ namespace nil { export_bits(integral, std::back_inserter(blob), 8); for( std::size_t i = blob.size(); i > 0; i--){ filled_constraint_system_with_params_hash.value().push_back( - nil::marshalling::types::integral(blob[i-1]) + nil::crypto3::marshalling::types::integral(blob[i-1]) ); } } else { for( std::size_t i = 0; i < common_data.vk.constraint_system_with_params_hash.size(); i++){ filled_constraint_system_with_params_hash.value().push_back( - nil::marshalling::types::integral(common_data.vk.constraint_system_with_params_hash[i]) + nil::crypto3::marshalling::types::integral(common_data.vk.constraint_system_with_params_hash[i]) ); } } - using permuted_column_indices_type = nil::marshalling::types::array_list , - nil::marshalling::option::sequence_size_field_prefix> + using permuted_column_indices_type = nil::crypto3::marshalling::types::array_list , + nil::crypto3::marshalling::option::sequence_size_field_prefix> >; permuted_column_indices_type filled_permuted_columns; for( const auto &index:common_data.permuted_columns){ - filled_permuted_columns.value().push_back(nil::marshalling::types::integral(index)); + filled_permuted_columns.value().push_back(nil::crypto3::marshalling::types::integral(index)); } auto filled_commitment_params = fill_commitment_params( @@ -183,16 +183,16 @@ namespace nil { return result_type(std::make_tuple( filled_commitments, // 0 filled_columns_rotations, // 1 - nil::marshalling::types::integral(common_data.desc.witness_columns), // 2 - nil::marshalling::types::integral(common_data.desc.public_input_columns), // 3 - nil::marshalling::types::integral(common_data.desc.constant_columns), // 4 - nil::marshalling::types::integral(common_data.desc.selector_columns), // 5 - nil::marshalling::types::integral(common_data.desc.usable_rows_amount), // 6 - nil::marshalling::types::integral(common_data.desc.rows_amount), // 7 - nil::marshalling::types::integral(common_data.max_gates_degree), // 8 - nil::marshalling::types::integral(common_data.permutation_parts), // 9 - nil::marshalling::types::integral(common_data.lookup_parts), // 10 - nil::marshalling::types::integral(common_data.max_quotient_chunks), // 11 + nil::crypto3::marshalling::types::integral(common_data.desc.witness_columns), // 2 + nil::crypto3::marshalling::types::integral(common_data.desc.public_input_columns), // 3 + nil::crypto3::marshalling::types::integral(common_data.desc.constant_columns), // 4 + nil::crypto3::marshalling::types::integral(common_data.desc.selector_columns), // 5 + nil::crypto3::marshalling::types::integral(common_data.desc.usable_rows_amount), // 6 + nil::crypto3::marshalling::types::integral(common_data.desc.rows_amount), // 7 + nil::crypto3::marshalling::types::integral(common_data.max_gates_degree), // 8 + nil::crypto3::marshalling::types::integral(common_data.permutation_parts), // 9 + nil::crypto3::marshalling::types::integral(common_data.lookup_parts), // 10 + nil::crypto3::marshalling::types::integral(common_data.max_quotient_chunks), // 11 filled_permuted_columns, // 12 filled_constraint_system_with_params_hash, // 13 filled_commitment_params, // 14 @@ -202,7 +202,7 @@ namespace nil { template CommonDataType make_placeholder_common_data(const - placeholder_common_data, CommonDataType> &filled_common_data + placeholder_common_data, CommonDataType> &filled_common_data ){ auto fixed_values = make_commitment(std::get<0>(filled_common_data.value())); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/preprocessed_public_data.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/preprocessed_public_data.hpp index 455d30b27e..94163cdfb7 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/preprocessed_public_data.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/preprocessed_public_data.hpp @@ -47,7 +47,7 @@ namespace nil { namespace types { // ******************* placeholder preprocessed public data ********************************* // template - using placeholder_preprocessed_public_data = nil::marshalling::types::bundle< + using placeholder_preprocessed_public_data = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // plonk_public_polynomial_dfs_table public_polynomial_table; @@ -69,12 +69,12 @@ namespace nil { >; template - placeholder_preprocessed_public_data, PreprocessedPublicDataType> + placeholder_preprocessed_public_data, PreprocessedPublicDataType> fill_placeholder_preprocessed_public_data(const PreprocessedPublicDataType& preprocessed_public_data) { - using TTypeBase = typename nil::marshalling::field_type; + using TTypeBase = typename nil::crypto3::marshalling::field_type; using PolynomialDFSType = typename PreprocessedPublicDataType::polynomial_dfs_type; using result_type = placeholder_preprocessed_public_data< - nil::marshalling::field_type, PreprocessedPublicDataType>; + nil::crypto3::marshalling::field_type, PreprocessedPublicDataType>; return result_type(std::make_tuple( fill_plonk_public_table( @@ -91,10 +91,10 @@ namespace nil { template PreprocessedPublicDataType make_placeholder_preprocessed_public_data( const placeholder_preprocessed_public_data< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, PreprocessedPublicDataType> &filled_preprocessed_public_data) { - using TTypeBase = typename nil::marshalling::field_type; + using TTypeBase = typename nil::crypto3::marshalling::field_type; using PolynomialDFSType = typename PreprocessedPublicDataType::polynomial_dfs_type; return PreprocessedPublicDataType({ diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp index d808875ff0..0a4f280807 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/proof.hpp @@ -49,15 +49,15 @@ namespace nil { namespace marshalling { namespace types { template - using placeholder_partial_evaluation_proof = nil::marshalling::types::bundle< + using placeholder_partial_evaluation_proof = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // batch size integers - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral >, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename commitment::type > @@ -65,25 +65,25 @@ namespace nil { >; template - placeholder_partial_evaluation_proof, Proof> + placeholder_partial_evaluation_proof, Proof> fill_placeholder_partial_evaluation_proof( const typename Proof::partial_proof_type &partial_proof) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; // batch size integers - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > filled_batch_size; // batch commitments - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename commitment::type > filled_commitments; for (const auto &[batch_index, commitment] : partial_proof.commitments) { filled_batch_size.value().push_back( - nil::marshalling::types::integral(batch_index)); + nil::crypto3::marshalling::types::integral(batch_index)); filled_commitments.value().push_back( fill_commitment(commitment)); } @@ -96,7 +96,7 @@ namespace nil { template typename Proof::partial_proof_type make_placeholder_partial_evaluation_proof( - const placeholder_partial_evaluation_proof, Proof> &filled_proof) + const placeholder_partial_evaluation_proof, Proof> &filled_proof) { typename Proof::partial_proof_type partial_proof; @@ -115,7 +115,7 @@ namespace nil { // This should be different for different commitment schemes! template - using placeholder_evaluation_proof = nil::marshalling::types::bundle< + using placeholder_evaluation_proof = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // typename FieldType::value_type challenge @@ -128,10 +128,10 @@ namespace nil { template - placeholder_evaluation_proof, Proof> + placeholder_evaluation_proof, Proof> fill_placeholder_evaluation_proof(const typename Proof::evaluation_proof &proof, const CommitmentParamsType& commitment_params) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using field_marshalling_type = field_element; @@ -150,7 +150,7 @@ namespace nil { template typename Proof::evaluation_proof make_placeholder_evaluation_proof( - const placeholder_evaluation_proof, Proof> &filled_proof) + const placeholder_evaluation_proof, Proof> &filled_proof) { typename Proof::evaluation_proof proof; @@ -165,16 +165,16 @@ namespace nil { } template - using placeholder_proof = nil::marshalling::types::bundle< + using placeholder_proof = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // typename commitment_scheme_type::commitment_type commitments - // All of them are similar size. So no nil::marshalling::option needed + // All of them are similar size. So no nil::crypto3::marshalling::option needed // There won't be too many commitments. So uint8_t is enough for length - nil::marshalling::types::array_list< + nil::crypto3::marshalling::types::array_list< TTypeBase, typename commitment::type, - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::option::sequence_size_field_prefix> >, // evaluation_proof eval_proof @@ -183,15 +183,15 @@ namespace nil { >; template - placeholder_proof, Proof> + placeholder_proof, Proof> fill_placeholder_proof(const Proof &proof, const CommitmentParamsType& commitment_params) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - nil::marshalling::types::array_list< + nil::crypto3::marshalling::types::array_list< TTypeBase, typename commitment::type, - nil::marshalling::option::sequence_size_field_prefix> + nil::crypto3::marshalling::option::sequence_size_field_prefix> > filled_commitments; for( const auto &it:proof.commitments){ filled_commitments.value().push_back( @@ -207,7 +207,7 @@ namespace nil { template Proof make_placeholder_proof( - const placeholder_proof, Proof> &filled_proof) + const placeholder_proof, Proof> &filled_proof) { Proof proof; @@ -235,10 +235,10 @@ namespace nil { } template - using placeholder_aggregated_proof_type = nil::marshalling::types::bundle< + using placeholder_aggregated_proof_type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, placeholder_partial_evaluation_proof >, @@ -247,15 +247,15 @@ namespace nil { >; template - placeholder_aggregated_proof_type, Proof> + placeholder_aggregated_proof_type, Proof> fill_placeholder_aggregated_proof( const AggregatedProof &proof, const typename Proof::commitment_scheme_type::fri_type::params_type &fri_params ) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, placeholder_partial_evaluation_proof > filled_partial_proofs; @@ -274,7 +274,7 @@ namespace nil { template AggregatedProof make_placeholder_aggregated_proof( - const placeholder_aggregated_proof_type, Proof> &filled_proof) + const placeholder_aggregated_proof_type, Proof> &filled_proof) { AggregatedProof proof; diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/transcript_initialization_context.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/transcript_initialization_context.hpp index 6fdc85c67d..8939172fb9 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/transcript_initialization_context.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/placeholder/transcript_initialization_context.hpp @@ -44,27 +44,27 @@ namespace nil { namespace types { template - using marshalling_string_type = nil::marshalling::types::string; + using marshalling_string_type = nil::crypto3::marshalling::types::string; // ******************* placeholder transcript initialization context ********************************* // template - using transcript_initialization_context = nil::marshalling::types::bundle< + using transcript_initialization_context = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // constexpr static const std::size_t witness_columns = PlaceholderParamsType::witness_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // constexpr static const std::size_t public_input_columns = PlaceholderParamsType::public_input_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // constexpr static const std::size_t constant_columns = PlaceholderParamsType::constant_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // constexpr static const std::size_t selector_columns = PlaceholderParamsType::selector_columns; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // constexpr static const typename field_type::value_type delta = PlaceholderParamsType::delta; field_element, // std::size_t rows_amount; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // std::size_t usable_rows_amount; - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // typename commitment_type::params_type commitment_params; typename commitment_params::type, @@ -76,9 +76,9 @@ namespace nil { >; template - transcript_initialization_context, TranscriptInitializationContextType> + transcript_initialization_context, TranscriptInitializationContextType> fill_transcript_initialization_context(const TranscriptInitializationContextType &init_context) { - using TTypeBase = typename nil::marshalling::field_type; + using TTypeBase = typename nil::crypto3::marshalling::field_type; using result_type = transcript_initialization_context; using field_element_marshalling_type = field_element; @@ -90,13 +90,13 @@ namespace nil { ); return result_type(std::make_tuple( - nil::marshalling::types::integral(init_context.witness_columns), - nil::marshalling::types::integral(init_context.public_input_columns), - nil::marshalling::types::integral(init_context.constant_columns), - nil::marshalling::types::integral(init_context.selector_columns), + nil::crypto3::marshalling::types::integral(init_context.witness_columns), + nil::crypto3::marshalling::types::integral(init_context.public_input_columns), + nil::crypto3::marshalling::types::integral(init_context.constant_columns), + nil::crypto3::marshalling::types::integral(init_context.selector_columns), field_element_marshalling_type(init_context.delta), - nil::marshalling::types::integral(init_context.rows_amount), - nil::marshalling::types::integral(init_context.usable_rows_amount), + nil::crypto3::marshalling::types::integral(init_context.rows_amount), + nil::crypto3::marshalling::types::integral(init_context.usable_rows_amount), filled_commitment_params, field_element_marshalling_type(init_context.modulus), marshalling_string_type(init_context.application_id) diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp index 02fde8f4a4..e2d7dccf53 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/assignment_table.hpp @@ -51,38 +51,38 @@ namespace nil { // Table description is marshalled separately, so it can be used in // other parts of system (e.g. DFRI). template - using plonk_assignment_table_description = nil::marshalling::types::bundle< + using plonk_assignment_table_description = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::integral, // witness_amount - nil::marshalling::types::integral, // public_input_amount - nil::marshalling::types::integral, // constant_amount - nil::marshalling::types::integral, // selector_amount + nil::crypto3::marshalling::types::integral, // witness_amount + nil::crypto3::marshalling::types::integral, // public_input_amount + nil::crypto3::marshalling::types::integral, // constant_amount + nil::crypto3::marshalling::types::integral, // selector_amount - nil::marshalling::types::integral, // usable_rows - nil::marshalling::types::integral // rows_amount + nil::crypto3::marshalling::types::integral, // usable_rows + nil::crypto3::marshalling::types::integral // rows_amount > >; template - plonk_assignment_table_description> fill_assignment_table_description( + plonk_assignment_table_description> fill_assignment_table_description( const zk::snark::plonk_table_description& desc ) { - using TTypeBase = nil::marshalling::field_type; - using result_type = plonk_assignment_table_description>; + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = plonk_assignment_table_description>; using value_type = typename FieldType::value_type; return result_type(std::move(std::make_tuple( - nil::marshalling::types::integral(desc.witness_columns), - nil::marshalling::types::integral(desc.public_input_columns), - nil::marshalling::types::integral(desc.constant_columns), - nil::marshalling::types::integral(desc.selector_columns), - nil::marshalling::types::integral(desc.usable_rows_amount), - nil::marshalling::types::integral(desc.rows_amount)))); + nil::crypto3::marshalling::types::integral(desc.witness_columns), + nil::crypto3::marshalling::types::integral(desc.public_input_columns), + nil::crypto3::marshalling::types::integral(desc.constant_columns), + nil::crypto3::marshalling::types::integral(desc.selector_columns), + nil::crypto3::marshalling::types::integral(desc.usable_rows_amount), + nil::crypto3::marshalling::types::integral(desc.rows_amount)))); } template zk::snark::plonk_table_description make_assignment_table_description( - const plonk_assignment_table_description> &filled_description) { + const plonk_assignment_table_description> &filled_description) { zk::snark::plonk_table_description desc( std::get<0>(filled_description.value()).value(), @@ -100,32 +100,32 @@ namespace nil { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// template - using plonk_assignment_table = nil::marshalling::types::bundle< + using plonk_assignment_table = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::integral, // witness_amount - nil::marshalling::types::integral, // public_input_amount - nil::marshalling::types::integral, // constant_amount - nil::marshalling::types::integral, // selector_amount + nil::crypto3::marshalling::types::integral, // witness_amount + nil::crypto3::marshalling::types::integral, // public_input_amount + nil::crypto3::marshalling::types::integral, // constant_amount + nil::crypto3::marshalling::types::integral, // selector_amount - nil::marshalling::types::integral, // usable_rows - nil::marshalling::types::integral, // rows_amount + nil::crypto3::marshalling::types::integral, // usable_rows + nil::crypto3::marshalling::types::integral, // rows_amount // witnesses - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >, // public_inputs - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >, // constants - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element >, // selectors - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element > @@ -133,17 +133,17 @@ namespace nil { >; template - nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - field_element, FieldValueType>> + nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + field_element, FieldValueType>> fill_field_element_vector_from_columns_with_padding( const std::vector> &columns, const std::size_t size, const FieldValueType &padding) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using field_element_type = field_element; - using field_element_vector_type = nil::marshalling::types::standard_array_list< + using field_element_vector_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, field_element_type>; @@ -163,9 +163,9 @@ namespace nil { template std::vector> make_field_element_columns_vector( - const nil::marshalling::types::standard_array_list< - nil::marshalling::field_type, - field_element, FieldValueType>> + const nil::crypto3::marshalling::types::standard_array_list< + nil::crypto3::marshalling::field_type, + field_element, FieldValueType>> &field_elem_vector, const std::size_t columns_amount, const std::size_t rows_amount) { @@ -190,21 +190,21 @@ namespace nil { } template - plonk_assignment_table, PlonkTable> fill_assignment_table( + plonk_assignment_table, PlonkTable> fill_assignment_table( std::size_t usable_rows, const PlonkTable &assignments ) { - using TTypeBase = nil::marshalling::field_type; - using result_type = plonk_assignment_table, PlonkTable>; + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = plonk_assignment_table, PlonkTable>; using value_type = typename PlonkTable::field_type::value_type; return result_type(std::move(std::make_tuple( - nil::marshalling::types::integral(assignments.witnesses_amount()), - nil::marshalling::types::integral(assignments.public_inputs_amount()), - nil::marshalling::types::integral(assignments.constants_amount()), - nil::marshalling::types::integral(assignments.selectors_amount()), - nil::marshalling::types::integral(usable_rows), - nil::marshalling::types::integral(assignments.rows_amount()), + nil::crypto3::marshalling::types::integral(assignments.witnesses_amount()), + nil::crypto3::marshalling::types::integral(assignments.public_inputs_amount()), + nil::crypto3::marshalling::types::integral(assignments.constants_amount()), + nil::crypto3::marshalling::types::integral(assignments.selectors_amount()), + nil::crypto3::marshalling::types::integral(usable_rows), + nil::crypto3::marshalling::types::integral(assignments.rows_amount()), fill_field_element_vector_from_columns_with_padding( assignments.witnesses(), assignments.rows_amount(), @@ -229,7 +229,7 @@ namespace nil { } template std::pair, PlonkTable> make_assignment_table( - const plonk_assignment_table, PlonkTable> &filled_assignments){ + const plonk_assignment_table, PlonkTable> &filled_assignments){ using value_type = typename PlonkTable::field_type::value_type; diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint.hpp index ee5a399288..6d92c2f0b5 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint.hpp @@ -48,29 +48,29 @@ namespace nil { using plonk_constraint = typename expression::type; template - plonk_constraint, PlonkConstraint> + plonk_constraint, PlonkConstraint> fill_plonk_constraint(const PlonkConstraint &constr) { return fill_expression(constr); } template PlonkConstraint make_plonk_constraint( - const plonk_constraint, PlonkConstraint> &filled_constr) + const plonk_constraint, PlonkConstraint> &filled_constr) { return make_expression(filled_constr); } /*********************** Vector of plonk constraints as an input to gate ****************************/ template - using plonk_constraints = nil::marshalling::types::standard_array_list< + using plonk_constraints = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_constraint >; template - plonk_constraints, Constraint> + plonk_constraints, Constraint> fill_plonk_constraints(const std::vector &constraints) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; plonk_constraints filled_constraints; for (const auto &constraint : constraints) { @@ -82,7 +82,7 @@ namespace nil { template std::vector - make_plonk_constraints(const plonk_constraints, Constraint> &filled_constraints) + make_plonk_constraints(const plonk_constraints, Constraint> &filled_constraints) { std::vector constraints; for (std::size_t i = 0; i < filled_constraints.value().size(); i++) { diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint_system.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint_system.hpp index adef7f5fd3..ac2209b46b 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint_system.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/constraint_system.hpp @@ -50,10 +50,10 @@ namespace nil { namespace types { template using public_input_sizes_type = - nil::marshalling::types::standard_size_t_array_list; + nil::crypto3::marshalling::types::standard_size_t_array_list; template - using plonk_constraint_system = nil::marshalling::types::bundle< + using plonk_constraint_system = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< plonk_gates< TTypeBase, typename PlonkConstraintSystem::gates_container_type::value_type >, // gates plonk_copy_constraints< TTypeBase, typename PlonkConstraintSystem::field_type >, // copy constraints @@ -66,13 +66,13 @@ namespace nil { >; template - plonk_constraint_system, PlonkConstraintSystem> + plonk_constraint_system, PlonkConstraintSystem> fill_plonk_constraint_system(const PlonkConstraintSystem &system) { - using TTypeBase = nil::marshalling::field_type; - using result_type = plonk_constraint_system, PlonkConstraintSystem>; + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = plonk_constraint_system, PlonkConstraintSystem>; public_input_sizes_type public_input_sizes; for(std::size_t i = 0; i < system.public_input_sizes_num(); i++){ - public_input_sizes.value().push_back(nil::marshalling::types::integral, std::size_t>(system.public_input_size(i))); + public_input_sizes.value().push_back(nil::crypto3::marshalling::types::integral, std::size_t>(system.public_input_size(i))); } return result_type(std::make_tuple( @@ -86,7 +86,7 @@ namespace nil { template PlonkConstraintSystem make_plonk_constraint_system( - const plonk_constraint_system, PlonkConstraintSystem> &filled_system) + const plonk_constraint_system, PlonkConstraintSystem> &filled_system) { std::vector public_input_sizes; for(std::size_t i = 0; i < std::get<4>(filled_system.value()).value().size(); i++){ diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/copy_constraint.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/copy_constraint.hpp index aded5cfe93..3691914130 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/copy_constraint.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/copy_constraint.hpp @@ -20,15 +20,15 @@ namespace nil { // *********************** Plonk copy constraint **************************** // template - using plonk_copy_constraint = nil::marshalling::types::bundle>::type, typename variable>::type >>; template - plonk_copy_constraint, FieldType> + plonk_copy_constraint, FieldType> fill_plonk_copy_constraint(const nil::crypto3::zk::snark::plonk_copy_constraint ©_constraint){ - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using result_type = plonk_copy_constraint; using VariableType = nil::crypto3::zk::snark::plonk_variable; @@ -43,7 +43,7 @@ namespace nil { template nil::crypto3::zk::snark::plonk_copy_constraint make_plonk_copy_constraint( - const plonk_copy_constraint, FieldType> &filled_copy_constraint) + const plonk_copy_constraint, FieldType> &filled_copy_constraint) { using VariableType = nil::crypto3::zk::snark::plonk_variable; return nil::crypto3::zk::snark::plonk_copy_constraint( @@ -55,15 +55,15 @@ namespace nil { // *********************** Plonk copy constraints **************************** // template - using plonk_copy_constraints = nil::marshalling::types::standard_array_list< + using plonk_copy_constraints = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_copy_constraint >; template - plonk_copy_constraints, FieldType> + plonk_copy_constraints, FieldType> fill_plonk_copy_constraints(const std::vector> &constraints) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; plonk_copy_constraints filled_constraints; for (const auto &constraint : constraints) { @@ -78,7 +78,7 @@ namespace nil { template std::vector > make_plonk_copy_constraints( - const plonk_copy_constraints, FieldType> &filled_constraints) + const plonk_copy_constraints, FieldType> &filled_constraints) { std::vector> constraints; constraints.reserve(filled_constraints.value().size()); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/gate.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/gate.hpp index 86499cb88a..713d3d2826 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/gate.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/gate.hpp @@ -43,12 +43,12 @@ namespace nil { namespace types { template - using plonk_gate = nil::marshalling::types::bundle< + using plonk_gate = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::size_t selector_index - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // std::vector> constraints - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_constraint > @@ -56,13 +56,13 @@ namespace nil { >; template - plonk_gate, PlonkGate> fill_plonk_gate(const PlonkGate &gate) { - using TTypeBase = nil::marshalling::field_type; + plonk_gate, PlonkGate> fill_plonk_gate(const PlonkGate &gate) { + using TTypeBase = nil::crypto3::marshalling::field_type; using result_type = plonk_gate; - using size_t_marshalling_type = nil::marshalling::types::integral; + using size_t_marshalling_type = nil::crypto3::marshalling::types::integral; using constraint_marshalling_type = plonk_constraint; - using constraint_vector_marshalling_type = nil::marshalling::types::standard_array_list< + using constraint_vector_marshalling_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, constraint_marshalling_type>; constraint_vector_marshalling_type filled_constraints; @@ -77,7 +77,7 @@ namespace nil { template PlonkGate make_plonk_gate( - const plonk_gate, PlonkGate> &filled_gate) + const plonk_gate, PlonkGate> &filled_gate) { std::size_t selector_index = std::get<0>(filled_gate.value()).value(); @@ -96,13 +96,13 @@ namespace nil { template using plonk_gates = - nil::marshalling::types::standard_array_list>; + nil::crypto3::marshalling::types::standard_array_list>; template - plonk_gates, PlonkGate> + plonk_gates, PlonkGate> fill_plonk_gates(const InputRange &gates) { - using TTypeBase = nil::marshalling::field_type; - using result_type = nil::marshalling::types::standard_array_list< + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_gate>; result_type filled_gates; @@ -115,7 +115,7 @@ namespace nil { template std::vector make_plonk_gates( - const plonk_gates, PlonkGate> &filled_gates) + const plonk_gates, PlonkGate> &filled_gates) { std::vector gates; gates.reserve(filled_gates.value().size()); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_constraint.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_constraint.hpp index 7a8fd2dbeb..4d0b61d66a 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_constraint.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_constraint.hpp @@ -46,18 +46,18 @@ namespace nil { // For example selector algorithms may be completely different. // *********************** Lookup constraint **************************** // template - using plonk_lookup_constraint = nil::marshalling::types::bundle, // table_id + using plonk_lookup_constraint = nil::crypto3::marshalling::types::bundle, // table_id plonk_constraints // constraint >>; template - plonk_lookup_constraint, Constraint> + plonk_lookup_constraint, Constraint> fill_plonk_lookup_constraint(const Constraint &constraint){ - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; return plonk_lookup_constraint( std::tuple( - nil::marshalling::types::integral(constraint.table_id), + nil::crypto3::marshalling::types::integral(constraint.table_id), fill_plonk_constraints(constraint.lookup_input) ) ); @@ -65,7 +65,7 @@ namespace nil { template Constraint make_plonk_lookup_constraint( - const plonk_lookup_constraint, Constraint> &filled_constraint) + const plonk_lookup_constraint, Constraint> &filled_constraint) { return Constraint({ std::get<0>(filled_constraint.value()).value(), @@ -75,15 +75,15 @@ namespace nil { // *********************** Vector of lookup constraints for a lookup gate **************************** // template - using plonk_lookup_constraints = nil::marshalling::types::standard_array_list< + using plonk_lookup_constraints = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_lookup_constraint >; template - plonk_lookup_constraints, Constraint> + plonk_lookup_constraints, Constraint> fill_plonk_lookup_constraints(const std::vector &constraints) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; plonk_lookup_constraints filled_constraints; for (const auto &constraint : constraints) { @@ -95,7 +95,7 @@ namespace nil { template std::vector make_plonk_lookup_constraints( - const plonk_lookup_constraints, Constraint> &filled_constraints) + const plonk_lookup_constraints, Constraint> &filled_constraints) { std::vector constraints; constraints.reserve(filled_constraints.value().size()); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_gate.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_gate.hpp index e2bddc63ae..802d126f8b 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_gate.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_gate.hpp @@ -43,12 +43,12 @@ namespace nil { namespace marshalling { namespace types { template - using plonk_lookup_gate = nil::marshalling::types::bundle< + using plonk_lookup_gate = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::size_t selector_index - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // std::vector> constraints - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_lookup_constraint > @@ -56,13 +56,13 @@ namespace nil { >; template - plonk_lookup_gate, PlonkGate> fill_plonk_lookup_gate(const PlonkGate &gate) { - using TTypeBase = nil::marshalling::field_type; + plonk_lookup_gate, PlonkGate> fill_plonk_lookup_gate(const PlonkGate &gate) { + using TTypeBase = nil::crypto3::marshalling::field_type; using result_type = plonk_lookup_gate; - using size_t_marshalling_type = nil::marshalling::types::integral; + using size_t_marshalling_type = nil::crypto3::marshalling::types::integral; using constraint_marshalling_type = plonk_lookup_constraint; - using constraint_vector_marshalling_type = nil::marshalling::types::standard_array_list< + using constraint_vector_marshalling_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, constraint_marshalling_type>; constraint_vector_marshalling_type filled_constraints; @@ -77,7 +77,7 @@ namespace nil { template PlonkGate make_plonk_lookup_gate( - const plonk_lookup_gate, PlonkGate> &filled_gate) + const plonk_lookup_gate, PlonkGate> &filled_gate) { std::size_t selector_index = std::get<0>(filled_gate.value()).value(); std::vector constraints; @@ -92,15 +92,15 @@ namespace nil { template using plonk_lookup_gates = - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_lookup_gate >; template - plonk_lookup_gates, PlonkGate> + plonk_lookup_gates, PlonkGate> fill_plonk_lookup_gates(const InputRange &gates) { - using TTypeBase = nil::marshalling::field_type; - using result_type = nil::marshalling::types::standard_array_list< + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_lookup_gate>; result_type filled_gates; @@ -113,7 +113,7 @@ namespace nil { template std::vector make_plonk_lookup_gates( - const plonk_lookup_gates, PlonkGate> &filled_gates) + const plonk_lookup_gates, PlonkGate> &filled_gates) { std::vector gates; gates.reserve(filled_gates.value().size()); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_table.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_table.hpp index d1379e672a..cb4ec7c97d 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_table.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/lookup_table.hpp @@ -42,12 +42,12 @@ namespace nil { namespace types { template - using plonk_lookup_table = nil::marshalling::types::bundle< + using plonk_lookup_table = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::integral, // tag_index - nil::marshalling::types::integral, // columns_number + nil::crypto3::marshalling::types::integral, // tag_index + nil::crypto3::marshalling::types::integral, // columns_number - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename variable::type > @@ -55,12 +55,12 @@ namespace nil { >; template - plonk_lookup_table, LookupTable> + plonk_lookup_table, LookupTable> fill_plonk_lookup_table(const LookupTable &table){ - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using variable_type = typename LookupTable::variable_type; - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename variable::type > filled_options; @@ -80,8 +80,8 @@ namespace nil { } return plonk_lookup_table( std::make_tuple( - nil::marshalling::types::integral(table.tag_index), - nil::marshalling::types::integral(table.columns_number), + nil::crypto3::marshalling::types::integral(table.tag_index), + nil::crypto3::marshalling::types::integral(table.columns_number), filled_options ) ); @@ -89,7 +89,7 @@ namespace nil { template LookupTable make_plonk_lookup_table( - const plonk_lookup_table, LookupTable> &filled_table + const plonk_lookup_table, LookupTable> &filled_table ) { std::size_t tag_index = std::get<0>(filled_table.value()).value(); std::size_t columns_number = std::get<1>(filled_table.value()).value(); @@ -121,15 +121,15 @@ namespace nil { template using plonk_lookup_tables = - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_lookup_table >; template - plonk_lookup_tables, PlonkTable> + plonk_lookup_tables, PlonkTable> fill_plonk_lookup_tables(const InputRange &tables) { - using TTypeBase = nil::marshalling::field_type; - using result_type = nil::marshalling::types::standard_array_list< + using TTypeBase = nil::crypto3::marshalling::field_type; + using result_type = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, plonk_lookup_table>; result_type filled_tables; @@ -142,7 +142,7 @@ namespace nil { template std::vector make_plonk_lookup_tables( - const plonk_lookup_tables, PlonkTable> &filled_tables) + const plonk_lookup_tables, PlonkTable> &filled_tables) { std::vector tables; tables.reserve(filled_tables.value().size()); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/plonk_public_polynomial_dfs_table.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/plonk_public_polynomial_dfs_table.hpp index 123f929d70..ee0c004054 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/plonk_public_polynomial_dfs_table.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/plonk_public_polynomial_dfs_table.hpp @@ -45,7 +45,7 @@ namespace nil { namespace types { template - using plonk_public_polynomial_table = nil::marshalling::types::bundle< + using plonk_public_polynomial_table = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // public_inputs polynomial_vector, @@ -57,12 +57,12 @@ namespace nil { >; template - plonk_public_polynomial_table, PlonkPublicTable> fill_plonk_public_table( + plonk_public_polynomial_table, PlonkPublicTable> fill_plonk_public_table( const PlonkPublicTable &public_table ) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using PolynomialType = typename PlonkPublicTable::column_type; - using result_type = plonk_public_polynomial_table, PlonkPublicTable>; + using result_type = plonk_public_polynomial_table, PlonkPublicTable>; return result_type(std::make_tuple( fill_polynomial_vector(public_table.public_inputs()), fill_polynomial_vector(public_table.constants()), @@ -73,10 +73,10 @@ namespace nil { template std::shared_ptr make_plonk_public_table( const plonk_public_polynomial_table< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, PlonkPublicTable> &filled_public_table) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using PolynomialType = typename PlonkPublicTable::column_type; return std::make_shared( diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/variable.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/variable.hpp index 43d23305af..c1bc602b3d 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/variable.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/plonk/variable.hpp @@ -47,29 +47,29 @@ namespace nil { //********************************* plonk_variable ***************************/ template struct variable { - using type = nil::marshalling::types::bundle< + using type = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< // std::size_t index - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // std::int32_t rotation - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, //bool relative - nil::marshalling::types::integral, + nil::crypto3::marshalling::types::integral, // enum column_type : std::uint8_t { witness, public_input, constant, selector } type - nil::marshalling::types::integral> + nil::crypto3::marshalling::types::integral> >; }; template - typename variable, Variable>::type + typename variable, Variable>::type fill_variable(const Variable &var) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using result_type = typename variable::type; - using size_t_marshalling_type = nil::marshalling::types::integral; - using int32_marshalling_type = nil::marshalling::types::integral; - using octet_marshalling_type = nil::marshalling::types::integral; - using bool_marshalling_type = nil::marshalling::types::integral; + using size_t_marshalling_type = nil::crypto3::marshalling::types::integral; + using int32_marshalling_type = nil::crypto3::marshalling::types::integral; + using octet_marshalling_type = nil::crypto3::marshalling::types::integral; + using bool_marshalling_type = nil::crypto3::marshalling::types::integral; return result_type(std::make_tuple( size_t_marshalling_type(var.index), @@ -81,7 +81,7 @@ namespace nil { template Variable make_variable( - const typename variable, Variable>::type &filled_var) + const typename variable, Variable>::type &filled_var) { return Variable(std::get<0>(filled_var.value()).value(), std::get<1>(filled_var.value()).value(), @@ -91,15 +91,15 @@ namespace nil { //****************** vector of plonk_variable *************************/ template - using variables = nil::marshalling::types::standard_array_list< + using variables = nil::crypto3::marshalling::types::standard_array_list< TTypeBase, typename variable::type >; template - variables, typename Variable::assignment_type> + variables, typename Variable::assignment_type> fill_variables(const std::vector &vars) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using AssignmentType = typename Variable::assignment_type; variables filled_vars; @@ -112,7 +112,7 @@ namespace nil { template std::vector make_variables( - const variables, typename Variable::assignment_type> &filled_vars) + const variables, typename Variable::assignment_type> &filled_vars) { std::vector vars; vars.reserve(filled_vars.value().size()); diff --git a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/sparse_vector.hpp b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/sparse_vector.hpp index db5f6ce4bd..41da1128a4 100644 --- a/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/sparse_vector.hpp +++ b/crypto3/libs/marshalling/zk/include/nil/crypto3/marshalling/zk/types/sparse_vector.hpp @@ -55,17 +55,17 @@ namespace nil { typename TTypeBase, typename SparseVector, typename = typename std::enable_if< - std::is_same>::value, + std::is_same>::value, bool>::type, typename... TOptions> - using sparse_vector = nil::marshalling::types::bundle< + using sparse_vector = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_size_t_array_list, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, curve_element>, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > >; @@ -73,17 +73,17 @@ namespace nil { typename KCSparseVector, typename = typename std::enable_if< std::is_same>::value, + nil::crypto3::container::sparse_vector>::value, bool>::type, typename... TOptions> - using knowledge_commitment_sparse_vector = nil::marshalling::types::bundle< + using knowledge_commitment_sparse_vector = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_size_t_array_list, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, knowledge_commitment>, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > >; @@ -91,28 +91,28 @@ namespace nil { typename KCSparseVector, typename = typename std::enable_if< std::is_same>::value, + nil::crypto3::container::sparse_vector>::value, bool>::type, typename... TOptions> - using fast_knowledge_commitment_sparse_vector = nil::marshalling::types::bundle< + using fast_knowledge_commitment_sparse_vector = nil::crypto3::marshalling::types::bundle< TTypeBase, std::tuple< - nil::marshalling::types::standard_size_t_array_list, - nil::marshalling::types::standard_array_list< + nil::crypto3::marshalling::types::standard_size_t_array_list, + nil::crypto3::marshalling::types::standard_array_list< TTypeBase, fast_knowledge_commitment>, - nil::marshalling::types::integral + nil::crypto3::marshalling::types::integral > >; template - sparse_vector, SparseVector> + sparse_vector, SparseVector> fill_sparse_vector(const SparseVector &sparse_vector_inp) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - using integral_type = nil::marshalling::types::integral; - using integral_vector_type = nil::marshalling::types::standard_size_t_array_list; + using integral_type = nil::crypto3::marshalling::types::integral; + using integral_vector_type = nil::crypto3::marshalling::types::standard_size_t_array_list; integral_vector_type filled_indices; @@ -121,7 +121,7 @@ namespace nil { filled_indices_val.push_back(integral_type(sparse_vector_inp.indices[i])); } - return sparse_vector, SparseVector>( + return sparse_vector, SparseVector>( std::make_tuple(filled_indices, fill_curve_element_vector( sparse_vector_inp.values), @@ -130,11 +130,11 @@ namespace nil { template SparseVector make_sparse_vector( - const sparse_vector, SparseVector> &filled_sparse_vector) + const sparse_vector, SparseVector> &filled_sparse_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - using integral_type = nil::marshalling::types::integral; + using integral_type = nil::crypto3::marshalling::types::integral; std::vector constructed_indices; const std::vector &filled_indices = @@ -155,13 +155,13 @@ namespace nil { } template - knowledge_commitment_sparse_vector, KCSparseVector> + knowledge_commitment_sparse_vector, KCSparseVector> fill_knowledge_commitment_sparse_vector(const KCSparseVector &knowledge_commitment_sparse_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - using integral_type = nil::marshalling::types::integral; - using integral_vector_type = nil::marshalling::types::standard_size_t_array_list; + using integral_type = nil::crypto3::marshalling::types::integral; + using integral_vector_type = nil::crypto3::marshalling::types::standard_size_t_array_list; integral_vector_type filled_indices; @@ -171,7 +171,7 @@ namespace nil { } return ::nil::crypto3::marshalling::types:: - knowledge_commitment_sparse_vector, KCSparseVector>( + knowledge_commitment_sparse_vector, KCSparseVector>( std::make_tuple( filled_indices, fill_knowledge_commitment_vector( @@ -181,12 +181,12 @@ namespace nil { template KCSparseVector make_knowledge_commitment_vector( - const knowledge_commitment_sparse_vector, KCSparseVector> + const knowledge_commitment_sparse_vector, KCSparseVector> &filled_kc_sparse_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - using integral_type = nil::marshalling::types::integral; + using integral_type = nil::crypto3::marshalling::types::integral; std::vector constructed_indices; const std::vector &filled_indices = @@ -207,13 +207,13 @@ namespace nil { } template - fast_knowledge_commitment_sparse_vector, KCSparseVector> + fast_knowledge_commitment_sparse_vector, KCSparseVector> fill_fast_knowledge_commitment_sparse_vector(const KCSparseVector &knowledge_commitment_sparse_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - using integral_type = nil::marshalling::types::integral; - using integral_vector_type = nil::marshalling::types::standard_size_t_array_list; + using integral_type = nil::crypto3::marshalling::types::integral; + using integral_vector_type = nil::crypto3::marshalling::types::standard_size_t_array_list; integral_vector_type filled_indices; @@ -223,7 +223,7 @@ namespace nil { } return ::nil::crypto3::marshalling::types:: - fast_knowledge_commitment_sparse_vector, KCSparseVector>( + fast_knowledge_commitment_sparse_vector, KCSparseVector>( std::make_tuple( filled_indices, fill_fast_knowledge_commitment_vector( @@ -233,12 +233,12 @@ namespace nil { template KCSparseVector make_fast_knowledge_commitment_vector( - const fast_knowledge_commitment_sparse_vector, KCSparseVector> + const fast_knowledge_commitment_sparse_vector, KCSparseVector> &filled_kc_sparse_vector) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; - using integral_type = nil::marshalling::types::integral; + using integral_type = nil::crypto3::marshalling::types::integral; std::vector constructed_indices; const std::vector &filled_indices = diff --git a/crypto3/libs/marshalling/zk/include/nil/detail/type_traits.hpp b/crypto3/libs/marshalling/zk/include/nil/detail/type_traits.hpp deleted file mode 100644 index 9873546cca..0000000000 --- a/crypto3/libs/marshalling/zk/include/nil/detail/type_traits.hpp +++ /dev/null @@ -1,297 +0,0 @@ -//---------------------------------------------------------------------------// -// Copyright (c) 2018-2021 Mikhail Komarov -// Copyright (c) 2020-2021 Nikita Kaskov -// -// MIT License -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -//---------------------------------------------------------------------------// - -#ifndef NIL_DETAIL_TYPE_TRAITS_HPP -#define NIL_DETAIL_TYPE_TRAITS_HPP - -#include - -#include -#include - -#include -#include - -#define GENERATE_HAS_MEMBER_TYPE(Type) \ - template \ - class HasMemberType_##Type { \ - public: \ - static constexpr bool RESULT = false; \ - }; \ - \ - template \ - class HasMemberType_##Type::value || std::is_union::value>::type> { \ - private: \ - using Yes = char[2]; \ - using No = char[1]; \ - \ - struct Fallback { \ - struct Type { }; \ - }; \ - struct Derived : T, Fallback { }; \ - \ - template \ - static No &test(typename U::Type *); \ - template \ - static Yes &test(U *); \ - \ - public: \ - static constexpr bool RESULT = sizeof(test(nullptr)) == sizeof(Yes); \ - }; \ - \ - template \ - struct has_##Type : public std::integral_constant::RESULT> { }; - -#define GENERATE_HAS_MEMBER(member) \ - template \ - class HasMember_##member { \ - public: \ - static constexpr bool RESULT = false; \ - }; \ - \ - template \ - class HasMember_##member::value || std::is_union::value>::type> { \ - private: \ - using Yes = char[2]; \ - using No = char[1]; \ - \ - struct Fallback { \ - int member; \ - }; \ - struct Derived : T, Fallback { }; \ - \ - template \ - static No &test(decltype(U::member) *); \ - template \ - static Yes &test(U *); \ - \ - public: \ - static constexpr bool RESULT = sizeof(test(nullptr)) == sizeof(Yes); \ - }; \ - \ - template \ - struct has_##member : public std::integral_constant::RESULT> { }; - -#define GENERATE_HAS_MEMBER_FUNCTION(Function, ...) \ - \ - template \ - struct has_##Function { \ - struct Fallback { \ - void Function(##__VA_ARGS__); \ - }; \ - \ - struct Derived : Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -#define GENERATE_HAS_MEMBER_CONST_FUNCTION(Function, ...) \ - \ - template \ - struct has_##Function { \ - struct Fallback { \ - void Function(##__VA_ARGS__) const; \ - }; \ - \ - struct Derived : Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -#define GENERATE_HAS_MEMBER_RETURN_FUNCTION(Function, ReturnType, ...) \ - \ - template \ - struct has_##Function { \ - struct Dummy { \ - typedef void ReturnType; \ - }; \ - typedef typename std::conditional::value, T, Dummy>::type TType; \ - typedef typename TType::ReturnType type; \ - \ - struct Fallback { \ - type Function(##__VA_ARGS__); \ - }; \ - \ - struct Derived : TType, Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -#define GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(Function, ReturnType, ...) \ - \ - template \ - struct has_##Function { \ - struct Dummy { \ - typedef void ReturnType; \ - }; \ - typedef typename std::conditional::value, T, Dummy>::type TType; \ - typedef typename TType::ReturnType type; \ - \ - struct Fallback { \ - type Function(##__VA_ARGS__) const; \ - }; \ - \ - struct Derived : TType, Fallback { }; \ - \ - template \ - struct ChT; \ - \ - template \ - static char (&f(ChT *))[1]; \ - \ - template \ - static char (&f(...))[2]; \ - \ - static bool const value = sizeof(f(0)) == 2; \ - }; - -namespace nil { - namespace detail { - - GENERATE_HAS_MEMBER_TYPE(iterator) - GENERATE_HAS_MEMBER_TYPE(const_iterator) - - GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(begin, const_iterator) - GENERATE_HAS_MEMBER_CONST_RETURN_FUNCTION(end, const_iterator) - - template - struct is_iterator { - static char test(...); - - template::difference_type, - typename = typename std::iterator_traits::pointer, - typename = typename std::iterator_traits::reference, - typename = typename std::iterator_traits::value_type, - typename = typename std::iterator_traits::iterator_category> - static long test(U &&); - - constexpr static bool value = std::is_same())), long>::value; - }; - - template - struct is_range { - static const bool value = has_begin::value && has_end::value; - }; - - template - struct is_container { - static const bool value - = has_const_iterator::value && has_begin::value && has_end::value; - }; - - /// @brief Check whether provided type is a variant of - /// std::tuple. - /// @tparam TType Type to check. - template - struct is_tuple { - /// @brief By default Value has value false. Will be true for any - /// variant of std::tuple. - static const bool value = false; - }; - - /// @cond SKIP_DOC - template - struct is_tuple> { - static const bool value = true; - }; - /// @endcond - - //---------------------------------------- - - /// @brief Check whether TType type is included in the tuple TTuple - /// @tparam TType Type to check - /// @tparam TTuple Tuple - /// @pre @code IsTuple::value == true @endcode - template - class is_in_tuple { - static_assert(is_tuple::value, "TTuple must be std::tuple"); - - public: - /// @brief By default the value is false, will be set to true if TType - /// is found in TTuple. - static const bool value = false; - }; - - /// @cond SKIP_DOC - template - class is_in_tuple> { - public: - static const bool value - = std::is_same::value || is_in_tuple>::value; - }; - - template - class is_in_tuple> { - public: - static const bool value = false; - }; - - template - struct is_array { - static const bool value = false; - }; - - template - struct is_array> { - static const bool value = true; - }; - - template - struct is_array> { - static const bool value = true; - }; - - /// @endcond - } // namespace detail -} // namespace nil - -#endif // NIL_DETAIL_TYPE_TRAITS_HPP \ No newline at end of file diff --git a/crypto3/libs/marshalling/zk/test/accumulation_vector.cpp b/crypto3/libs/marshalling/zk/test/accumulation_vector.cpp index 556a674472..0ef7468b14 100644 --- a/crypto3/libs/marshalling/zk/test/accumulation_vector.cpp +++ b/crypto3/libs/marshalling/zk/test/accumulation_vector.cpp @@ -59,7 +59,7 @@ void test_accumulation_vector(nil::crypto3::container::accumulation_vector, nil::crypto3::container::accumulation_vector>; + types::accumulation_vector, nil::crypto3::container::accumulation_vector>; accumulation_vector_type filled_val = types::fill_accumulation_vector, Endianness>(val); @@ -76,14 +76,14 @@ void test_accumulation_vector(nil::crypto3::container::accumulation_vector constructed_val_read = types::make_accumulation_vector, Endianness>( @@ -114,7 +114,7 @@ BOOST_AUTO_TEST_SUITE(sparse_vector_test_suite) BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g1_be) { std::cout << "BLS12-381 g1 group accumulation vector big-endian test started" << std::endl; - test_accumulation_vector::g1_type<>, nil::marshalling::option::big_endian, + test_accumulation_vector::g1_type<>, nil::crypto3::marshalling::option::big_endian, 5>(); std::cout << "BLS12-381 g1 group accumulation vector big-endian test finished" << std::endl; } @@ -122,14 +122,14 @@ BOOST_AUTO_TEST_SUITE(sparse_vector_test_suite) // BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g1_le) { // std::cout << "BLS12-381 g1 group accumulation vector little-endian test started" << std::endl; // test_accumulation_vector::g1_type<>, -// nil::marshalling::option::little_endian, +// nil::crypto3::marshalling::option::little_endian, // 5>(); // std::cout << "BLS12-381 g1 group accumulation vector little-endian test finished" << std::endl; // } BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g2_be) { std::cout << "BLS12-381 g2 group accumulation vector big-endian test started" << std::endl; - test_accumulation_vector::g2_type<>, nil::marshalling::option::big_endian, + test_accumulation_vector::g2_type<>, nil::crypto3::marshalling::option::big_endian, 5>(); std::cout << "BLS12-381 g2 group accumulation vector big-endian test finished" << std::endl; } @@ -137,7 +137,7 @@ BOOST_AUTO_TEST_SUITE(sparse_vector_test_suite) // BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g2_le) { // std::cout << "BLS12-381 g2 group accumulation vector little-endian test started" << std::endl; // test_accumulation_vector::g2_type<>, -// nil::marshalling::option::little_endian, +// nil::crypto3::marshalling::option::little_endian, // 5>(); // std::cout << "BLS12-381 g2 group accumulation vector little-endian test finished" << std::endl; // } diff --git a/crypto3/libs/marshalling/zk/test/fri_commitment.cpp b/crypto3/libs/marshalling/zk/test/fri_commitment.cpp index 4247cc25e8..a681ab71ae 100644 --- a/crypto3/libs/marshalling/zk/test/fri_commitment.cpp +++ b/crypto3/libs/marshalling/zk/test/fri_commitment.cpp @@ -75,7 +75,7 @@ using namespace nil::crypto3; template void test_fri_proof(typename FRI::proof_type &proof, typename nil::crypto3::marshalling::types::batch_info_type batch_info, const typename FRI::params_type& params) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; auto filled_proof = nil::crypto3::marshalling::types::fill_fri_proof(proof, batch_info, params); auto _proof = nil::crypto3::marshalling::types::make_fri_proof(filled_proof, batch_info); @@ -99,12 +99,12 @@ void test_fri_proof(typename FRI::proof_type &proof, typename nil::crypto3::mars cv.resize(filled_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); typename nil::crypto3::marshalling::types::fri_proof::type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); typename FRI::proof_type constructed_val_read = nil::crypto3::marshalling::types::make_fri_proof( test_val_read, batch_info); BOOST_CHECK(proof == constructed_val_read); @@ -119,8 +119,8 @@ BOOST_FIXTURE_TEST_SUITE(marshalling_fri_proof_elements, test_tools::random_test using value_type = typename field_type::value_type; using hash_type = nil::crypto3::hashes::keccak_1600<256>; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using FRI = typename nil::crypto3::zk::commitments::detail::basic_batched_fri; BOOST_AUTO_TEST_CASE(polynomial_test) { @@ -152,17 +152,17 @@ BOOST_FIXTURE_TEST_SUITE(marshalling_fri_proof_elements, test_tools::random_test auto _f = nil::crypto3::marshalling::types::make_merkle_proof_vector(filled); BOOST_CHECK(mp == _f); - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; std::vector cv; cv.resize(filled.length(), 0x00); auto write_iter = cv.begin(); auto status = filled.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); nil::crypto3::marshalling::types::merkle_proof_vector_type test_val_read; auto read_iter = cv.begin(); test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = nil::crypto3::marshalling::types::make_merkle_proof_vector(test_val_read); BOOST_CHECK(mp == constructed_val_read); } @@ -217,7 +217,7 @@ BOOST_AUTO_TEST_SUITE_END() BOOST_FIXTURE_TEST_SUITE(marshalling_real_fri_proofs, test_tools::random_test_initializer) - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; BOOST_AUTO_TEST_CASE(marshalling_fri_basic_test) { // setup diff --git a/crypto3/libs/marshalling/zk/test/kzg_commitment.cpp b/crypto3/libs/marshalling/zk/test/kzg_commitment.cpp index c4a9793e17..1a5051f5b6 100644 --- a/crypto3/libs/marshalling/zk/test/kzg_commitment.cpp +++ b/crypto3/libs/marshalling/zk/test/kzg_commitment.cpp @@ -89,7 +89,7 @@ struct placeholder_class_test_initializer { using kzg_type = zk::commitments::batched_kzg; typedef typename kzg_type::transcript_type transcript_type; using kzg_scheme_type = typename zk::commitments::kzg_commitment_scheme_v2; - using endianness = nil::marshalling::option::big_endian; + using endianness = nil::crypto3::marshalling::option::big_endian; scalar_value_type alpha = 7u; auto params = kzg_scheme_type::create_params(8, alpha); diff --git a/crypto3/libs/marshalling/zk/test/lpc_commitment.cpp b/crypto3/libs/marshalling/zk/test/lpc_commitment.cpp index 3236b657cc..cd051ca248 100644 --- a/crypto3/libs/marshalling/zk/test/lpc_commitment.cpp +++ b/crypto3/libs/marshalling/zk/test/lpc_commitment.cpp @@ -77,7 +77,7 @@ using namespace nil::crypto3; template void test_lpc_proof(typename LPC::proof_type &proof, typename LPC::fri_type::params_type fri_params) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; auto filled_proof = nil::crypto3::marshalling::types::fill_eval_proof(proof, fri_params); auto _proof = nil::crypto3::marshalling::types::make_eval_proof(filled_proof); @@ -87,12 +87,12 @@ void test_lpc_proof(typename LPC::proof_type &proof, typename LPC::fri_type::par cv.resize(filled_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); typename nil::crypto3::marshalling::types::eval_proof::type test_val_read; auto read_iter = cv.begin(); test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); typename LPC::proof_type constructed_val_read = nil::crypto3::marshalling::types::make_eval_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); @@ -103,7 +103,7 @@ void test_lpc_aggregated_proof( typename LPC::aggregated_proof_type &proof, typename LPC::fri_type::params_type fri_params ) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; auto filled_proof = nil::crypto3::marshalling::types::fill_aggregated_proof(proof, fri_params); @@ -114,12 +114,12 @@ void test_lpc_aggregated_proof( cv.resize(filled_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); typename nil::crypto3::marshalling::types::aggregated_proof test_val_read; auto read_iter = cv.begin(); test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); typename LPC::aggregated_proof_type constructed_val_read = nil::crypto3::marshalling::types::make_aggregated_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); @@ -128,7 +128,7 @@ void test_lpc_aggregated_proof( // This function will test saving and restoring LPC commitment scheme state to a file/buffer. template void test_lpc_state_recovery(const LPC& lpc_commitment_scheme) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; auto filled_lpc_scheme = nil::crypto3::marshalling::types::fill_commitment_scheme(lpc_commitment_scheme); auto _lpc_commitment_scheme = nil::crypto3::marshalling::types::make_commitment_scheme(filled_lpc_scheme); @@ -139,12 +139,12 @@ void test_lpc_state_recovery(const LPC& lpc_commitment_scheme) { cv.resize(filled_lpc_scheme.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_lpc_scheme.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); typename nil::crypto3::marshalling::types::commitment_scheme_state::type test_val_read; auto read_iter = cv.begin(); test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = nil::crypto3::marshalling::types::make_commitment_scheme(test_val_read); BOOST_CHECK(constructed_val_read.has_value()); @@ -165,8 +165,8 @@ BOOST_AUTO_TEST_SUITE(marshalling_random) using value_type = typename field_type::value_type; using hash_type = nil::crypto3::hashes::keccak_1600<256>; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using FRI = typename nil::crypto3::zk::commitments::detail::basic_batched_fri; using lpc_params_type = typename nil::crypto3::zk::commitments::list_polynomial_commitment_params< hash_type, hash_type, m @@ -207,7 +207,7 @@ BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(marshalling_real) // Setup common types. - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; using curve_type = nil::crypto3::algebra::curves::vesta; using field_type = curve_type::scalar_field_type; using merkle_hash_type = nil::crypto3::hashes::keccak_1600<256>; diff --git a/crypto3/libs/marshalling/zk/test/merkle_proof.cpp b/crypto3/libs/marshalling/zk/test/merkle_proof.cpp index 7b55539941..bdd3e71e7d 100644 --- a/crypto3/libs/marshalling/zk/test/merkle_proof.cpp +++ b/crypto3/libs/marshalling/zk/test/merkle_proof.cpp @@ -102,7 +102,7 @@ void test_merkle_proof(std::size_t tree_depth) { using merkle_tree_type = nil::crypto3::containers::merkle_tree; using merkle_proof_type = nil::crypto3::containers::merkle_proof; using merkle_proof_marshalling_type = - types::merkle_proof, merkle_proof_type>; + types::merkle_proof, merkle_proof_type>; std::size_t leafs_number = std::pow(Arity, tree_depth); // You can also lazy convert byte stream to field elements stream using @@ -134,14 +134,14 @@ void test_merkle_proof(std::size_t tree_depth) { std::vector cv; cv.resize(filled_merkle_proof.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_merkle_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_merkle_proof.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); print_merkle_proof(cv.cbegin(), cv.cend(), data[proof_idx].cbegin(), data[proof_idx].cend(), true); merkle_proof_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); merkle_proof_type constructed_val_read = types::make_merkle_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); } @@ -160,9 +160,9 @@ using HashTypes = boost::mpl::list< BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_proof_arity_2_test, HashType, HashTypes) { std::srand(std::time(0)); - test_merkle_proof(5); - test_merkle_proof(10); - test_merkle_proof(15); + test_merkle_proof(5); + test_merkle_proof(10); + test_merkle_proof(15); } // Poseidon hash function supports only Arity 2. @@ -172,18 +172,18 @@ using BlockHashTypes = boost::mpl::list< >; BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_proof_arity_3_test, HashType, BlockHashTypes) { - test_merkle_proof(5); - test_merkle_proof(10); + test_merkle_proof(5); + test_merkle_proof(10); } BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_proof_arity_4_test, HashType, BlockHashTypes) { - test_merkle_proof(5); - test_merkle_proof(10); + test_merkle_proof(5); + test_merkle_proof(10); } BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_proof_arity_5_test, HashType, BlockHashTypes) { - test_merkle_proof(5); - test_merkle_proof(10); + test_merkle_proof(5); + test_merkle_proof(10); } BOOST_AUTO_TEST_SUITE_END() diff --git a/crypto3/libs/marshalling/zk/test/merkle_tree.cpp b/crypto3/libs/marshalling/zk/test/merkle_tree.cpp index 8b66c67f47..7416bd60aa 100644 --- a/crypto3/libs/marshalling/zk/test/merkle_tree.cpp +++ b/crypto3/libs/marshalling/zk/test/merkle_tree.cpp @@ -66,7 +66,7 @@ void test_merkle_tree_marshalling(std::size_t tree_depth) { using namespace nil::crypto3::marshalling; using merkle_tree_type = nil::crypto3::containers::merkle_tree; using merkle_tree_marshalling_type = - types::merkle_tree, merkle_tree_type>; + types::merkle_tree, merkle_tree_type>; std::size_t leafs_number = std::pow(Arity, tree_depth); // You can also lazy convert byte stream to field elements stream using @@ -96,14 +96,14 @@ void test_merkle_tree_marshalling(std::size_t tree_depth) { std::vector cv; cv.resize(filled_merkle_tree.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_merkle_tree.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_merkle_tree.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_merkle_tree(cv.cbegin(), cv.cend(), data[tree_idx].cbegin(), data[tree_idx].cend(), true); merkle_tree_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); merkle_tree_type constructed_val_read = types::make_merkle_tree(test_val_read); BOOST_CHECK(tree == constructed_val_read); } @@ -122,9 +122,9 @@ using HashTypes = boost::mpl::list< BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_tree_arity_2_test, HashType, HashTypes) { std::srand(std::time(0)); - test_merkle_tree_marshalling(2); - test_merkle_tree_marshalling(4); - test_merkle_tree_marshalling(8); + test_merkle_tree_marshalling(2); + test_merkle_tree_marshalling(4); + test_merkle_tree_marshalling(8); } // Poseidon hash function supports only Arity 2. @@ -134,18 +134,18 @@ using BlockHashTypes = boost::mpl::list< >; BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_tree_arity_3_test, HashType, BlockHashTypes) { - test_merkle_tree_marshalling(2); - test_merkle_tree_marshalling(4); + test_merkle_tree_marshalling(2); + test_merkle_tree_marshalling(4); } BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_tree_arity_4_test, HashType, BlockHashTypes) { - test_merkle_tree_marshalling(2); - test_merkle_tree_marshalling(4); + test_merkle_tree_marshalling(2); + test_merkle_tree_marshalling(4); } BOOST_AUTO_TEST_CASE_TEMPLATE(marshalling_merkle_tree_arity_5_test, HashType, BlockHashTypes) { - test_merkle_tree_marshalling(2); - test_merkle_tree_marshalling(4); + test_merkle_tree_marshalling(2); + test_merkle_tree_marshalling(4); } BOOST_AUTO_TEST_SUITE_END() diff --git a/crypto3/libs/marshalling/zk/test/placeholder_common_data.cpp b/crypto3/libs/marshalling/zk/test/placeholder_common_data.cpp index 3f44a54193..47bc498c82 100644 --- a/crypto3/libs/marshalling/zk/test/placeholder_common_data.cpp +++ b/crypto3/libs/marshalling/zk/test/placeholder_common_data.cpp @@ -100,8 +100,8 @@ struct placeholder_common_data_test_runner { void test_placeholder_common_data(common_data_type const& common_data) { - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; auto filled_common_data = nil::crypto3::marshalling::types::fill_placeholder_common_data(common_data); auto _common_data = nil::crypto3::marshalling::types::make_placeholder_common_data(filled_common_data); @@ -111,12 +111,12 @@ struct placeholder_common_data_test_runner { cv.resize(filled_common_data.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_common_data.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); nil::crypto3::marshalling::types::placeholder_common_data test_val_read; auto read_iter = cv.begin(); test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = nil::crypto3::marshalling::types::make_placeholder_common_data( test_val_read ); diff --git a/crypto3/libs/marshalling/zk/test/placeholder_preprocessed_public_data.cpp b/crypto3/libs/marshalling/zk/test/placeholder_preprocessed_public_data.cpp index 7358da3b5c..231119a7b7 100644 --- a/crypto3/libs/marshalling/zk/test/placeholder_preprocessed_public_data.cpp +++ b/crypto3/libs/marshalling/zk/test/placeholder_preprocessed_public_data.cpp @@ -102,8 +102,8 @@ struct placeholder_preprocessed_public_data_test_runner { void test_placeholder_preprocessed_public_data(public_data_type const& data) { - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; auto filled_public_data = nil::crypto3::marshalling::types:: fill_placeholder_preprocessed_public_data(data); @@ -115,12 +115,12 @@ struct placeholder_preprocessed_public_data_test_runner { cv.resize(filled_public_data.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_public_data.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); nil::crypto3::marshalling::types::placeholder_preprocessed_public_data test_val_read; auto read_iter = cv.begin(); test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = nil::crypto3::marshalling::types:: make_placeholder_preprocessed_public_data(test_val_read); BOOST_CHECK(data == constructed_val_read); diff --git a/crypto3/libs/marshalling/zk/test/placeholder_proof.cpp b/crypto3/libs/marshalling/zk/test/placeholder_proof.cpp index 0ff04084d7..5ad0dc826c 100644 --- a/crypto3/libs/marshalling/zk/test/placeholder_proof.cpp +++ b/crypto3/libs/marshalling/zk/test/placeholder_proof.cpp @@ -110,8 +110,8 @@ template struct placeholder_lpc_proof_test_runner { - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using field_type = FieldType; typedef placeholder_circuit_params circuit_params; @@ -212,12 +212,12 @@ struct placeholder_lpc_proof_test_runner { cv.resize(filled_placeholder_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_placeholder_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); proof_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_placeholder_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); } @@ -227,7 +227,7 @@ struct placeholder_lpc_proof_test_runner { using namespace nil::crypto3::marshalling; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using proof_marshalling_type = nil::crypto3::marshalling::types::placeholder_partial_evaluation_proof; auto filled_placeholder_proof = types::fill_placeholder_partial_evaluation_proof(proof); @@ -238,12 +238,12 @@ struct placeholder_lpc_proof_test_runner { cv.resize(filled_placeholder_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_placeholder_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); proof_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_placeholder_partial_evaluation_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); } @@ -260,7 +260,7 @@ struct placeholder_lpc_proof_test_runner { { using namespace nil::crypto3::marshalling; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using proof_marshalling_type = nil::crypto3::marshalling::types::placeholder_aggregated_proof_type; auto filled_placeholder_proof = types::fill_placeholder_aggregated_proof( @@ -273,12 +273,12 @@ struct placeholder_lpc_proof_test_runner { cv.resize(filled_placeholder_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_placeholder_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); proof_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_placeholder_aggregated_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); } @@ -535,8 +535,8 @@ struct placeholder_kzg_v2_proof_test_runner : public test_tools::random_test_ini void test_placeholder_proof(const ProofType &proof, const CommitmentParamsType& params, std::string output_file = "") { using namespace nil::crypto3::marshalling; - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using proof_marshalling_type = nil::crypto3::marshalling::types::placeholder_proof; @@ -548,12 +548,12 @@ struct placeholder_kzg_v2_proof_test_runner : public test_tools::random_test_ini cv.resize(filled_placeholder_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_placeholder_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); proof_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_placeholder_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); } @@ -590,7 +590,7 @@ struct placeholder_kzg_v2_proof_test_runner : public test_tools::random_test_ini ); using common_data_type = typename placeholder_public_preprocessor::preprocessed_data_type::common_data_type; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; test_placeholder_proof(kzg_proof, kzg_params); bool verifier_res = placeholder_verifier::process( diff --git a/crypto3/libs/marshalling/zk/test/plonk_assignment_table.cpp b/crypto3/libs/marshalling/zk/test/plonk_assignment_table.cpp index 74d1d25273..8f2a5b9311 100644 --- a/crypto3/libs/marshalling/zk/test/plonk_assignment_table.cpp +++ b/crypto3/libs/marshalling/zk/test/plonk_assignment_table.cpp @@ -83,7 +83,7 @@ struct plonk_assignment_table_test_runner { bool test_assignment_table_description() { plonk_table_description const& val = desc; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using value_marshalling_type = nil::crypto3::marshalling::types::plonk_assignment_table_description; auto filled_val = types::fill_assignment_table_description(val); @@ -94,11 +94,11 @@ struct plonk_assignment_table_test_runner { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); table_desc = types::make_assignment_table_description(test_val_read); BOOST_CHECK(val == table_desc); @@ -109,7 +109,7 @@ struct plonk_assignment_table_test_runner { template bool test_assignment_table() { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using plonk_table = plonk_assignment_table; using value_marshalling_type = nil::crypto3::marshalling::types::plonk_assignment_table; @@ -125,11 +125,11 @@ struct plonk_assignment_table_test_runner { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); table_desc_pair = types::make_assignment_table(test_val_read); BOOST_CHECK(val == table_desc_pair.second); @@ -140,7 +140,7 @@ struct plonk_assignment_table_test_runner { bool run_test() { - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; BOOST_CHECK(test_assignment_table_description()); BOOST_CHECK(test_assignment_table()); return true; diff --git a/crypto3/libs/marshalling/zk/test/plonk_constraint_system.cpp b/crypto3/libs/marshalling/zk/test/plonk_constraint_system.cpp index 35e1e486e4..77036c6172 100644 --- a/crypto3/libs/marshalling/zk/test/plonk_constraint_system.cpp +++ b/crypto3/libs/marshalling/zk/test/plonk_constraint_system.cpp @@ -79,8 +79,8 @@ struct plonk_constraint_system_test_runner { bool run_test() { - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using value_marshalling_type = nil::crypto3::marshalling::types::plonk_constraint_system; auto filled_val = nil::crypto3::marshalling::types::fill_plonk_constraint_system(system); @@ -91,11 +91,11 @@ struct plonk_constraint_system_test_runner { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_constraint_system(test_val_read); BOOST_CHECK(system == constructed_val_read); diff --git a/crypto3/libs/marshalling/zk/test/plonk_gates.cpp b/crypto3/libs/marshalling/zk/test/plonk_gates.cpp index 68b1a693fd..319f825044 100644 --- a/crypto3/libs/marshalling/zk/test/plonk_gates.cpp +++ b/crypto3/libs/marshalling/zk/test/plonk_gates.cpp @@ -176,7 +176,7 @@ void test_plonk_variable() { using namespace nil::crypto3::marshalling; using varialbe_type = nil::crypto3::zk::snark::plonk_variable; - using value_marshalling_type = typename types::variable, varialbe_type>::type; + using value_marshalling_type = typename types::variable, varialbe_type>::type; auto val = generate_random_plonk_variable(); @@ -188,12 +188,12 @@ void test_plonk_variable() { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_variable(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -203,7 +203,7 @@ void test_plonk_variables(std::size_t n) { using namespace nil::crypto3::marshalling; using variable_type = nil::crypto3::zk::snark::plonk_variable; - using value_marshalling_type = typename types::variables, Field>; + using value_marshalling_type = typename types::variables, Field>; std::vector val; for (size_t i = 0; i < n; i++) { @@ -221,12 +221,12 @@ void test_plonk_variables(std::size_t n) { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_variables(test_val_read); BOOST_CHECK(val.size() == _val.size()); for (std::size_t i = 0; i < val.size(); i++) { @@ -241,7 +241,7 @@ void test_plonk_term(std::size_t vars_n) { using variable_type = nil::crypto3::zk::snark::plonk_variable; using value_type = nil::crypto3::math::term; using value_marshalling_type = - typename types::term, value_type>::type; + typename types::term, value_type>::type; auto val = generate_random_plonk_term(vars_n); auto filled_val = types::fill_term(val); @@ -252,13 +252,13 @@ void test_plonk_term(std::size_t vars_n) { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_term(test_val_read); BOOST_CHECK_EQUAL(val, constructed_val_read); } @@ -270,7 +270,7 @@ void test_expression(std::size_t vars_n, std::size_t terms_n) { using variable_type = nil::crypto3::zk::snark::plonk_variable; using value_type = nil::crypto3::math::expression; using value_marshalling_type = - typename types::expression, value_type>::type; + typename types::expression, value_type>::type; auto val = generate_random_plonk_expression(vars_n, terms_n); @@ -282,13 +282,13 @@ void test_expression(std::size_t vars_n, std::size_t terms_n) { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_expression(test_val_read); BOOST_CHECK_EQUAL(val, constructed_val_read); } @@ -299,7 +299,7 @@ void test_plonk_constraint(std::size_t vars_n, std::size_t depth) { using variable_type = nil::crypto3::zk::snark::plonk_variable; using value_type = nil::crypto3::zk::snark::plonk_constraint; - using value_marshalling_type = types::plonk_constraint, value_type>; + using value_marshalling_type = types::plonk_constraint, value_type>; auto val = value_type(generate_random_plonk_expression(vars_n, depth)); @@ -311,13 +311,13 @@ void test_plonk_constraint(std::size_t vars_n, std::size_t depth) { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_constraint(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -329,7 +329,7 @@ void test_plonk_constraints(std::size_t vars_n, std::size_t depth, std::size_t c using variable_type = nil::crypto3::zk::snark::plonk_variable; using constraint_type = nil::crypto3::zk::snark::plonk_constraint; using value_type = std::vector; - using value_marshalling_type = types::plonk_constraints, constraint_type>; + using value_marshalling_type = types::plonk_constraints, constraint_type>; value_type val; for (std::size_t i = 0; i < constraints_n; i++) { @@ -347,12 +347,12 @@ void test_plonk_constraints(std::size_t vars_n, std::size_t depth, std::size_t c cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_constraints(test_val_read); BOOST_CHECK(val.size() == constructed_val_read.size()); @@ -368,7 +368,7 @@ void test_plonk_lookup_constraints(std::size_t vars_n, std::size_t depth, std::s using variable_type = nil::crypto3::zk::snark::plonk_variable; using constraint_type = nil::crypto3::zk::snark::plonk_lookup_constraint; using value_type = std::vector; - using value_marshalling_type = types::plonk_lookup_constraints, constraint_type>; + using value_marshalling_type = types::plonk_lookup_constraints, constraint_type>; value_type val; for (std::size_t i = 0; i < constraints_n; i++) { @@ -383,12 +383,12 @@ void test_plonk_lookup_constraints(std::size_t vars_n, std::size_t depth, std::s cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_lookup_constraints(test_val_read); BOOST_CHECK(val == constructed_val_read); @@ -400,7 +400,7 @@ void test_plonk_lookup_constraint(std::size_t vars_n, std::size_t depth, std::si using variable_type = nil::crypto3::zk::snark::plonk_variable; using value_type = nil::crypto3::zk::snark::plonk_lookup_constraint; - using value_marshalling_type = types::plonk_lookup_constraint, value_type>; + using value_marshalling_type = types::plonk_lookup_constraint, value_type>; auto val = generate_random_plonk_lookup_constraint(vars_n, depth, expr_n); @@ -412,13 +412,13 @@ void test_plonk_lookup_constraint(std::size_t vars_n, std::size_t depth, std::si cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_lookup_constraint(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -430,7 +430,7 @@ void test_plonk_gate(std::size_t vars_n, std::size_t terms_n, std::size_t constr using variable_type = nil::crypto3::zk::snark::plonk_variable; using constraint_type = nil::crypto3::zk::snark::plonk_constraint; using value_type = nil::crypto3::zk::snark::plonk_gate; - using value_marshalling_type = types::plonk_gate, value_type>; + using value_marshalling_type = types::plonk_gate, value_type>; auto val = generate_random_plonk_gate(vars_n, terms_n, constr_n); @@ -442,13 +442,13 @@ void test_plonk_gate(std::size_t vars_n, std::size_t terms_n, std::size_t constr cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_gate(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -456,7 +456,7 @@ void test_plonk_gate(std::size_t vars_n, std::size_t terms_n, std::size_t constr template void test_plonk_lookup_gate(std::size_t vars_n, std::size_t depth, std::size_t expr_n, std::size_t constr_n) { using namespace nil::crypto3::marshalling; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using variable_type = nil::crypto3::zk::snark::plonk_variable; using constraint_type = nil::crypto3::zk::snark::plonk_lookup_constraint; @@ -472,13 +472,13 @@ void test_plonk_lookup_gate(std::size_t vars_n, std::size_t depth, std::size_t e cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_lookup_gate(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -490,7 +490,7 @@ void test_plonk_gates(std::size_t vars_n, std::size_t depth, std::size_t constr_ using variable_type = nil::crypto3::zk::snark::plonk_variable; using constraint_type = nil::crypto3::zk::snark::plonk_constraint; using value_type = nil::crypto3::zk::snark::plonk_gate; - using value_marshalling_type = types::plonk_gates, value_type>; + using value_marshalling_type = types::plonk_gates, value_type>; std::vector val; for (std::size_t i = 0; i < gates_n; i++) { @@ -505,13 +505,13 @@ void test_plonk_gates(std::size_t vars_n, std::size_t depth, std::size_t constr_ cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_gates(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -523,7 +523,7 @@ void test_plonk_lookup_gates(std::size_t vars_n, std::size_t depth, std::size_t using variable_type = nil::crypto3::zk::snark::plonk_variable; using constraint_type = nil::crypto3::zk::snark::plonk_lookup_constraint; using value_type = nil::crypto3::zk::snark::plonk_lookup_gate; - using value_marshalling_type = types::plonk_lookup_gates, value_type>; + using value_marshalling_type = types::plonk_lookup_gates, value_type>; std::vector val; for (std::size_t i = 0; i < gates_n; i++) { @@ -538,13 +538,13 @@ void test_plonk_lookup_gates(std::size_t vars_n, std::size_t depth, std::size_t cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_lookup_gates(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -552,7 +552,7 @@ void test_plonk_lookup_gates(std::size_t vars_n, std::size_t depth, std::size_t template void test_plonk_lookup_table(std::size_t col_n, std::size_t op_n) { using namespace nil::crypto3::marshalling; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using value_type = nil::crypto3::zk::snark::plonk_lookup_table; using value_marshalling_type = types::plonk_lookup_table; @@ -566,13 +566,13 @@ void test_plonk_lookup_table(std::size_t col_n, std::size_t op_n) { cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_lookup_table(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -580,7 +580,7 @@ void test_plonk_lookup_table(std::size_t col_n, std::size_t op_n) { template void test_plonk_lookup_tables(std::size_t col_n, std::size_t op_n, std::size_t t_n) { using namespace nil::crypto3::marshalling; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using value_type = nil::crypto3::zk::snark::plonk_lookup_table; using value_marshalling_type = types::plonk_lookup_tables; @@ -599,13 +599,13 @@ void test_plonk_lookup_tables(std::size_t col_n, std::size_t op_n, std::size_t t cv.resize(filled_val.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + nil::crypto3::marshalling::status_type status = filled_val.write(write_iter, cv.size()); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); // print_byteblob(std::cout, cv.cbegin(), cv.cend()); value_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); auto constructed_val_read = types::make_plonk_lookup_tables(test_val_read); BOOST_CHECK(val == constructed_val_read); } @@ -613,7 +613,7 @@ void test_plonk_lookup_tables(std::size_t col_n, std::size_t op_n, std::size_t t BOOST_AUTO_TEST_SUITE(plonk_constraint_system_details) using curve_type = nil::crypto3::algebra::curves::alt_bn128_254; using field_type = typename curve_type::scalar_field_type; - using endianness = nil::marshalling::option::big_endian; + using endianness = nil::crypto3::marshalling::option::big_endian; BOOST_AUTO_TEST_CASE(marshalling_plonk_variable) { for (auto i = 0; i < 100; i++) { diff --git a/crypto3/libs/marshalling/zk/test/polys_evaluator.cpp b/crypto3/libs/marshalling/zk/test/polys_evaluator.cpp index 67deb90625..655966b813 100644 --- a/crypto3/libs/marshalling/zk/test/polys_evaluator.cpp +++ b/crypto3/libs/marshalling/zk/test/polys_evaluator.cpp @@ -79,7 +79,7 @@ using namespace nil::crypto3; template void test_polys_evaluator_marshalling(PolysEvaluator &evaluator) { - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; auto filled_evaluator = nil::crypto3::marshalling::types::fill_polys_evaluator(evaluator); auto _evaluator = nil::crypto3::marshalling::types::make_polys_evaluator(filled_evaluator); @@ -89,12 +89,12 @@ void test_polys_evaluator_marshalling(PolysEvaluator &evaluator) { cv.resize(filled_evaluator.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_evaluator.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); nil::crypto3::marshalling::types::polys_evaluator test_val_read; auto read_iter = cv.begin(); test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); PolysEvaluator constructed_val_read = nil::crypto3::marshalling::types::make_polys_evaluator(test_val_read); @@ -103,7 +103,7 @@ void test_polys_evaluator_marshalling(PolysEvaluator &evaluator) { BOOST_AUTO_TEST_SUITE(marshalling_real) // Setup common types. - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; using curve_type = nil::crypto3::algebra::curves::vesta; using field_type = curve_type::scalar_field_type; using merkle_hash_type = nil::crypto3::hashes::keccak_1600<256>; diff --git a/crypto3/libs/marshalling/zk/test/sparse_vector.cpp b/crypto3/libs/marshalling/zk/test/sparse_vector.cpp index 48c7a02554..d7c8353eb6 100644 --- a/crypto3/libs/marshalling/zk/test/sparse_vector.cpp +++ b/crypto3/libs/marshalling/zk/test/sparse_vector.cpp @@ -57,7 +57,7 @@ void test_sparse_vector(nil::crypto3::container::sparse_vector val) { using namespace nil::crypto3::marshalling; using unit_type = unsigned char; - using sparse_vector_type = types::sparse_vector, + using sparse_vector_type = types::sparse_vector, nil::crypto3::container::sparse_vector>; sparse_vector_type filled_val = @@ -75,13 +75,13 @@ void test_sparse_vector(nil::crypto3::container::sparse_vector val) { auto write_iter = cv.begin(); auto status = filled_val.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); sparse_vector_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == nil::crypto3::marshalling::status_type::success); nil::crypto3::container::sparse_vector constructed_val_read = types::make_sparse_vector, Endianness>(test_val_read); @@ -109,28 +109,28 @@ BOOST_AUTO_TEST_SUITE(sparse_vector_test_suite) BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g1_be) { std::cout << "BLS12-381 g1 group field sparse vector big-endian test started" << std::endl; - test_sparse_vector::g1_type<>, nil::marshalling::option::big_endian, 5>(); + test_sparse_vector::g1_type<>, nil::crypto3::marshalling::option::big_endian, 5>(); std::cout << "BLS12-381 g1 group field sparse vector big-endian test finished" << std::endl; } // BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g1_le) { // std::cout << "BLS12-381 g1 group field sparse vector little-endian test started" << std::endl; // test_sparse_vector::g1_type<>, -// nil::marshalling::option::little_endian, +// nil::crypto3::marshalling::option::little_endian, // 5>(); // std::cout << "BLS12-381 g1 group field sparse vector little-endian test finished" << std::endl; // } BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g2_be) { std::cout << "BLS12-381 g2 group field sparse vector big-endian test started" << std::endl; - test_sparse_vector::g2_type<>, nil::marshalling::option::big_endian, 5>(); + test_sparse_vector::g2_type<>, nil::crypto3::marshalling::option::big_endian, 5>(); std::cout << "BLS12-381 g2 group field sparse vector big-endian test finished" << std::endl; } // BOOST_AUTO_TEST_CASE(sparse_vector_bls12_381_g2_le) { // std::cout << "BLS12-381 g2 group field little-endian test started" << std::endl; // test_sparse_vector::g2_type<>, -// nil::marshalling::option::little_endian, +// nil::crypto3::marshalling::option::little_endian, // 5>(); // std::cout << "BLS12-381 g2 group field little-endian test finished" << std::endl; // } diff --git a/crypto3/libs/transpiler/include/nil/blueprint/transpiler/lpc_evm_verifier_gen.hpp b/crypto3/libs/transpiler/include/nil/blueprint/transpiler/lpc_evm_verifier_gen.hpp index 3e20e550bf..4d3ac3c0c1 100644 --- a/crypto3/libs/transpiler/include/nil/blueprint/transpiler/lpc_evm_verifier_gen.hpp +++ b/crypto3/libs/transpiler/include/nil/blueprint/transpiler/lpc_evm_verifier_gen.hpp @@ -724,7 +724,7 @@ namespace nil { auto fixed_poly_values = _common_data.commitment_scheme_data; using eta_hash = crypto3::hashes::keccak_1600<256>; using field_element_type = nil::crypto3::marshalling::types::field_element< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, typename PlaceholderParams::field_type::value_type>; if (fixed_poly_values.size() == 0) diff --git a/crypto3/libs/transpiler/test/evm.cpp b/crypto3/libs/transpiler/test/evm.cpp index dee43163b0..e364a81753 100644 --- a/crypto3/libs/transpiler/test/evm.cpp +++ b/crypto3/libs/transpiler/test/evm.cpp @@ -244,7 +244,7 @@ namespace { using namespace nil::crypto3::marshalling; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = marshalling::field_type; using proof_marshalling_type = nil::crypto3::marshalling::types::placeholder_proof; auto filled_placeholder_proof = types::fill_placeholder_proof(proof, params); @@ -255,7 +255,7 @@ namespace { cv.resize(filled_placeholder_proof.length(), 0x00); auto write_iter = cv.begin(); auto status = filled_placeholder_proof.write(write_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == marshalling::status_type::success); if (!output_file.empty()) { print_placeholder_proof(cv.cbegin(), cv.cend(), false, output_file.c_str()); @@ -264,7 +264,7 @@ namespace { proof_marshalling_type test_val_read; auto read_iter = cv.begin(); status = test_val_read.read(read_iter, cv.size()); - BOOST_CHECK(status == nil::marshalling::status_type::success); + BOOST_CHECK(status == marshalling::status_type::success); auto constructed_val_read = types::make_placeholder_proof(test_val_read); BOOST_CHECK(proof == constructed_val_read); } @@ -328,7 +328,7 @@ namespace { } // namespace BOOST_AUTO_TEST_SUITE(placeholder_circuit1) - using Endianness = nil::marshalling::option::big_endian; + using Endianness = marshalling::option::big_endian; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -444,7 +444,7 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_tools::random_test_initializer; using field_type = typename curve_type::scalar_field_type; @@ -560,8 +560,8 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_tools::random_test_initializer; + using Endianness = marshalling::option::big_endian; + using TTypeBase = marshalling::field_type; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -680,7 +680,7 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_tools::random_test_initializer; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -325,8 +325,8 @@ BOOST_FIXTURE_TEST_CASE(aggregated_proof_sanity_test, test_initializer) { BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(recursive_circuit2) - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -435,8 +435,8 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_initializer) { BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(recursive_circuit3) - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -852,8 +852,8 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_initializer) { BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(recursive_circuit6) - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -957,8 +957,8 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_initializer) { BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(recursive_circuit7) - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -1064,8 +1064,8 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_initializer) { BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(recursive_circuit7_chunk10) - using Endianness = nil::marshalling::option::big_endian; - using TTypeBase = nil::marshalling::field_type; + using Endianness = nil::crypto3::marshalling::option::big_endian; + using TTypeBase = nil::crypto3::marshalling::field_type; using curve_type = algebra::curves::pallas; using field_type = typename curve_type::base_field_type; @@ -1169,4 +1169,4 @@ BOOST_FIXTURE_TEST_CASE(transpiler_test, test_initializer) { output_file.close(); } } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp index 00d4590430..74353eabe9 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp @@ -76,9 +76,9 @@ namespace nil { typedef typename containers::merkle_tree merkle_tree_type; typedef typename containers::merkle_proof merkle_proof_type; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = marshalling::option::big_endian; using field_element_type = - nil::crypto3::marshalling::types::field_element, + nil::crypto3::marshalling::types::field_element, typename FieldType::value_type>; using precommitment_type = merkle_tree_type; diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp index 33ec6827f8..d8f1a4e0f2 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp @@ -74,9 +74,9 @@ namespace nil { typedef typename containers::merkle_tree merkle_tree_type; typedef typename containers::merkle_proof merkle_proof_type; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; using field_element_type = - nil::crypto3::marshalling::types::field_element, + nil::crypto3::marshalling::types::field_element, typename FieldType::value_type>; using precommitment_type = merkle_tree_type; diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp index ce630c8690..5d7ecb9a44 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp @@ -97,9 +97,9 @@ namespace nil { // For initial proof only, size of all values are similar typedef std::vector polynomials_values_type; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = marshalling::option::big_endian; using field_element_type = nil::crypto3::marshalling::types::field_element< - nil::marshalling::field_type, + marshalling::field_type, typename FieldType::value_type >; diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp index db8a66b6dc..dff30d1fe0 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp @@ -658,7 +658,7 @@ namespace nil { using transcript_hash_type = typename CommitmentSchemeType::transcript_hash_type; using polynomial_type = typename CommitmentSchemeType::polynomial_type; using proof_type = typename CommitmentSchemeType::proof_type; - using endianness = nil::marshalling::option::big_endian; + using endianness = nil::crypto3::marshalling::option::big_endian; private: params_type _params; std::map _commitments; @@ -752,9 +752,9 @@ namespace nil { _params, this->_polys[index][i]); this->_ind_commitments[index].push_back(single_commitment); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector single_commitment_bytes = - nil::marshalling::pack(single_commitment, status); + nil::crypto3::marshalling::pack(single_commitment, status); THROW_IF_ERROR_STATUS(status, "kzg::commit"); result.insert(result.end(), single_commitment_bytes.begin(), single_commitment_bytes.end()); } @@ -839,9 +839,9 @@ namespace nil { for (std::size_t j = 0; j < blob_size; j++) { byteblob[j] = this->_commitments.at(k)[i * blob_size + j]; } - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; typename curve_type::template g1_type<>::value_type - i_th_commitment = nil::marshalling::pack(byteblob, status); + i_th_commitment = nil::crypto3::marshalling::pack(byteblob, status); THROW_IF_ERROR_STATUS(status, "kzg::verify_eval"); auto U_commit = nil::crypto3::zk::algorithms::commit_one (_params, this->get_U(k, i)); diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp index ea86534852..9c9970718f 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp @@ -105,9 +105,9 @@ namespace nil { } }; - using endianness = nil::marshalling::option::big_endian; + using endianness = marshalling::option::big_endian; using field_element_type = nil::crypto3::marshalling::types::field_element< - nil::marshalling::field_type, + marshalling::field_type, commitment_type >; private: @@ -202,9 +202,9 @@ namespace nil { _params, this->_polys[index][i]); this->_ind_commitments[index].push_back(single_commitment); - nil::marshalling::status_type status; + marshalling::status_type status; std::vector single_commitment_bytes = - nil::marshalling::pack(single_commitment, status); + marshalling::pack(single_commitment, status); THROW_IF_ERROR_STATUS(status, "kzg_v2::commit"); result.insert(result.end(), single_commitment_bytes.begin(), single_commitment_bytes.end()); } @@ -308,7 +308,7 @@ namespace nil { auto F = CommitmentSchemeType::single_commitment_type::zero(); auto rsum = CommitmentSchemeType::scalar_value_type::zero(); - nil::marshalling::status_type status; + marshalling::status_type status; for (const auto &it: this->_commitments) { auto k = it.first; @@ -320,7 +320,7 @@ namespace nil { byteblob[j] = this->_commitments[k][i * blob_size + j]; } typename curve_type::template g1_type<>::value_type - cm_i = nil::marshalling::pack(byteblob, status); + cm_i = marshalling::pack(byteblob, status); THROW_IF_ERROR_STATUS(status, "kzg_v2::verify_eval"); auto Z_T_S_i = set_difference_polynom(_merged_points, this->_points.at(k)[i]).evaluate( theta_2); diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp index 98cc6d9414..46514a6350 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp @@ -117,13 +117,13 @@ namespace nil { ); // Marshall the initialization context and push it to the transcript. - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; auto filled_context = nil::crypto3::marshalling::types::fill_transcript_initialization_context< Endianness, nil::crypto3::zk::snark::detail::transcript_initialization_context>(context); std::vector cv(filled_context.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_context.write(write_iter, cv.size()); + nil::crypto3::marshalling::status_type status = filled_context.write(write_iter, cv.size()); THROW_IF_ERROR_STATUS(status, "transcript_initialization_context::compute_constraint_system_with_params_hash"); // Append constraint_system to the buffer "cv". diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp index 38ebd4a1ef..dee26b5ebf 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp @@ -722,8 +722,8 @@ namespace nil { const auto &table = lookup_tables[t_id]; auto key = std::tuple(table.tag_index, 0, plonk_variable::column_type::selector); auto shifted_key = std::tuple(table.tag_index, 1, plonk_variable::column_type::selector); - typename FieldType::value_type selector_value = evaluations[key];; - typename FieldType::value_type shifted_selector_value = evaluations[shifted_key];; + typename FieldType::value_type selector_value = evaluations[key]; + typename FieldType::value_type shifted_selector_value = evaluations[shifted_key]; for( std::size_t o_id = 0; o_id < table.lookup_options.size(); o_id++){ typename FieldType::value_type v = selector_value * (t_id + 1); typename FieldType::value_type shifted_v = shifted_selector_value * (t_id + 1); @@ -747,7 +747,7 @@ namespace nil { for( std::size_t g_id = 0; g_id < lookup_gates.size(); g_id++ ){ const auto &gate = lookup_gates[g_id]; auto key = std::tuple(gate.tag_index, 0, plonk_variable::column_type::selector); - typename FieldType::value_type selector_value= evaluations[key]; + typename FieldType::value_type selector_value = evaluations[key]; for( std::size_t c_id = 0; c_id < gate.constraints.size(); c_id++){ const auto &constraint = gate.constraints[c_id]; typename FieldType::value_type l = selector_value * constraint.table_id; diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp index eb9f443a47..c1b726e422 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp @@ -145,7 +145,7 @@ namespace nil { _proof.commitments[VARIABLE_VALUES_BATCH] = _commitment_scheme.commit(VARIABLE_VALUES_BATCH); } transcript(_proof.commitments[VARIABLE_VALUES_BATCH]); - + // 4. permutation_argument if( constraint_system.copy_constraints().size() > 0 ){ auto permutation_argument = placeholder_permutation_argument::prove_eval( diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp index b7a3eb1351..e5c6227b03 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp @@ -91,9 +91,9 @@ namespace nil { ); acc(data); } else { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; typename hash_type::construction::type::block_type byte_data = - nil::marshalling::pack(data, status); + nil::crypto3::marshalling::pack(data, status); THROW_IF_ERROR_STATUS(status, "fiat_shamir_heuristic_accumulative::operator()"); acc(byte_data); } @@ -173,9 +173,9 @@ namespace nil { algebra::is_field_element::value > operator()(element const& data) { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector byte_data = - nil::marshalling::pack(data, status); + nil::crypto3::marshalling::pack(data, status); THROW_IF_ERROR_STATUS(status, "fiat_shamir_heuristic_sequential::operator()"); auto acc_convertible = hash(state); state = accumulators::extract::hash( @@ -199,9 +199,9 @@ namespace nil { std::size_t count = std::min(data.size(), state.size()); std::copy(state.begin(), state.begin() + count, data.begin() + data.size() - count); - nil::marshalling::status_type status; - big_uint_of_hash_size raw_result = - nil::marshalling::pack(state, status); + nil::crypto3::marshalling::status_type status; + big_uint_of_hash_size raw_result = + nil::crypto3::marshalling::pack(state, status); THROW_IF_ERROR_STATUS(status, "fiat_shamir_heuristic_sequential::challenge"); return raw_result; } @@ -209,8 +209,8 @@ namespace nil { template Integral int_challenge() { state = hash(state); - nil::marshalling::status_type status; - big_uint_of_hash_size raw_result = nil::marshalling::pack(state, status); + nil::crypto3::marshalling::status_type status; + big_uint_of_hash_size raw_result = nil::crypto3::marshalling::pack(state, status); // If we remove the next line, raw_result is a much larger number, conversion to 'Integral' will overflow // and in debug mode an assert will fire. In release mode nothing will change. raw_result &= ~Integral(0); @@ -329,7 +329,7 @@ namespace nil { Integral result = 0u; Integral factor = 1u; size_t bytes_to_fill = sizeof(Integral); - // TODO(martun): consider using export_bits here, or nil::marshalling::pack, instead of this. + // TODO(martun): consider using export_bits here, or nil::crypto3::marshalling::pack, instead of this. while (intermediate_result > 0u && bytes_to_fill != 0u) { auto last_byte = intermediate_result % 0x100u; Integral last_byte_integral = static_cast(last_byte); diff --git a/crypto3/libs/zk/include/nil/crypto3/zk/transcript/kimchi_transcript.hpp b/crypto3/libs/zk/include/nil/crypto3/zk/transcript/kimchi_transcript.hpp index 474bf7cbd8..e7549fe080 100644 --- a/crypto3/libs/zk/include/nil/crypto3/zk/transcript/kimchi_transcript.hpp +++ b/crypto3/libs/zk/include/nil/crypto3/zk/transcript/kimchi_transcript.hpp @@ -29,7 +29,7 @@ namespace nil { template integral_type pack(std::vector limbs_lsb) { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::size_t byte_size = integral_type::Bits / // TODO(ioxid): should round up here CHAR_BIT; @@ -37,7 +37,7 @@ namespace nil { limbs_lsb.resize(size); std::reverse(limbs_lsb.begin(), limbs_lsb.end()); - integral_type res = nil::marshalling::pack(limbs_lsb, status); + integral_type res = nil::crypto3::marshalling::pack(limbs_lsb, status); THROW_IF_ERROR_STATUS(status, "std::vector to integral_type"); return res; @@ -45,10 +45,10 @@ namespace nil { template std::vector unpack(value_type &value) { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; integral_type scalar_value = integral_type(value.data); std::vector limbs_lsb = - nil::marshalling::pack(scalar_value, status); + nil::crypto3::marshalling::pack(scalar_value, status); THROW_IF_ERROR_STATUS(status, "integral_type to std::vector"); std::reverse(limbs_lsb.begin(), limbs_lsb.end()); @@ -252,10 +252,10 @@ namespace nil { typename base_field_type::integral_type(f.data)); this->sponge.absorb(casted_to_base_value); } else { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; typename scalar_field_type::integral_type scalar_f(f.data); std::vector bits = - nil::marshalling::pack(scalar_f, status); + nil::crypto3::marshalling::pack(scalar_f, status); THROW_IF_ERROR_STATUS(status, "FqSponge::absorb_fr"); std::vector shifted_bits(bits.size(), false); @@ -267,7 +267,7 @@ namespace nil { typename base_field_type::integral_type(0); typename base_field_type::integral_type high_bits = - nil::marshalling::pack(shifted_bits, status); + nil::crypto3::marshalling::pack(shifted_bits, status); THROW_IF_ERROR_STATUS(status, "FqSponge::absorb_fr"); typename base_field_type::value_type high_bits_field = diff --git a/crypto3/libs/zk/test/commitment/kzg.cpp b/crypto3/libs/zk/test/commitment/kzg.cpp index 215d16637b..70fdca8a5d 100644 --- a/crypto3/libs/zk/test/commitment/kzg.cpp +++ b/crypto3/libs/zk/test/commitment/kzg.cpp @@ -233,10 +233,10 @@ BOOST_AUTO_TEST_CASE(kzg_test_mnt6_accumulated) { auto params = typename kzg_type::params_type(n, alpha); auto commit = zk::algorithms::commit(params, f); - nil::marshalling::status_type status; - using endianness = nil::marshalling::option::big_endian; + nil::crypto3::marshalling::status_type status; + using endianness = nil::crypto3::marshalling::option::big_endian; std::vector single_commitment_bytes = - nil::marshalling::pack(commit, status); + nil::crypto3::marshalling::pack(commit, status); dump_vector(single_commitment_bytes, "commitment"); BOOST_CHECK(curve_type::template g1_type<>::value_type::one() == params.commitment_key[0]); @@ -570,11 +570,11 @@ BOOST_AUTO_TEST_CASE(batched_kzg_placeholder_repr) { // auto params = typename kzg_type::params_type(8, 8, alpha); auto params = create_kzg_params(3 /*degree_log*/); auto commits = zk::algorithms::commit(params, polys); - using endianness = nil::marshalling::option::big_endian; + using endianness = nil::crypto3::marshalling::option::big_endian; for (auto &c: commits) { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector single_commitment_bytes = - nil::marshalling::pack(c, status); + nil::crypto3::marshalling::pack(c, status); dump_vector(single_commitment_bytes, "commitment"); } diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp index a902243210..b636ac0ff8 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_compile_time_size.hpp @@ -80,9 +80,9 @@ namespace nil { typedef typename containers::merkle_tree merkle_tree_type; typedef typename containers::merkle_proof merkle_proof_type; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = marshalling::option::big_endian; using field_element_type = - nil::crypto3::marshalling::types::field_element, + nil::crypto3::marshalling::types::field_element, typename FieldType::value_type>; using precommitment_type = merkle_tree_type; diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp index 7ea3051bd8..2d47426b67 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_batched_fri_runtime_size.hpp @@ -78,9 +78,9 @@ namespace nil { typedef typename containers::merkle_tree merkle_tree_type; typedef typename containers::merkle_proof merkle_proof_type; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; using field_element_type = - nil::crypto3::marshalling::types::field_element, + nil::crypto3::marshalling::types::field_element, typename FieldType::value_type>; using precommitment_type = merkle_tree_type; diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp index 816cb6a943..96c6c3f5b1 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/basic_fri.hpp @@ -104,9 +104,9 @@ namespace nil { // For initial proof only, size of all values are similar typedef std::vector polynomials_values_type; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; using field_element_type = nil::crypto3::marshalling::types::field_element< - nil::marshalling::field_type, + nil::crypto3::marshalling::field_type, typename FieldType::value_type >; diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/element_knowledge_commitment.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/element_knowledge_commitment.hpp index 371048605f..fc2b797c84 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/element_knowledge_commitment.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/element_knowledge_commitment.hpp @@ -32,6 +32,8 @@ #include +#include + namespace nil { namespace crypto3 { namespace zk { diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/fold_polynomial.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/fold_polynomial.hpp index 0819304a0d..0604e356bd 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/fold_polynomial.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/fold_polynomial.hpp @@ -89,7 +89,9 @@ namespace nil { typename FieldType::value_type acc = alpha; for (std::size_t i = 0; i <= f_folded.degree(); i++) { - f_folded[i] = two_inversed * ((1u + acc) * f[i] + (1u - acc) * f[domain->size() / 2 + i]); + f_folded[i] = two_inversed * ( + (typename FieldType::value_type(1u) + acc) * f[i] + + (typename FieldType::value_type(1u) - acc) * f[domain->size() / 2 + i]); acc *= omega_inversed; } diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/proof_of_work.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/proof_of_work.hpp index 2fcdfa5a7d..643699eff8 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/proof_of_work.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/detail/polynomial/proof_of_work.hpp @@ -178,7 +178,7 @@ namespace nil { return pow_seed + (std::size_t)pow_value_offset; } - static inline bool verify(transcript_type &transcript, value_type proof_of_work, std::size_t GrindingBits=16) { + static inline bool verify(transcript_type &transcript, value_type proof_of_work, std::size_t GrindingBits = 16) { transcript(proof_of_work); integral_type mask = (GrindingBits > 0 ? diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp index 7ea61f6f06..63db1f16ed 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg.hpp @@ -662,7 +662,7 @@ namespace nil { using transcript_hash_type = typename CommitmentSchemeType::transcript_hash_type; using polynomial_type = typename CommitmentSchemeType::polynomial_type; using proof_type = typename CommitmentSchemeType::proof_type; - using endianness = nil::marshalling::option::big_endian; + using endianness = nil::crypto3::marshalling::option::big_endian; private: params_type _params; std::map _commitments; @@ -756,9 +756,9 @@ namespace nil { _params, this->_polys[index][i]); this->_ind_commitments[index].push_back(single_commitment); - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector single_commitment_bytes = - nil::marshalling::pack(single_commitment, status); + nil::crypto3::marshalling::pack(single_commitment, status); THROW_IF_ERROR_STATUS(status, "kzg::commit"); result.insert(result.end(), single_commitment_bytes.begin(), single_commitment_bytes.end()); } @@ -843,9 +843,9 @@ namespace nil { for (std::size_t j = 0; j < blob_size; j++) { byteblob[j] = this->_commitments.at(k)[i * blob_size + j]; } - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; typename curve_type::template g1_type<>::value_type - i_th_commitment = nil::marshalling::pack(byteblob, status); + i_th_commitment = nil::crypto3::marshalling::pack(byteblob, status); THROW_IF_ERROR_STATUS(status, "kzg::verify_eval"); auto U_commit = nil::crypto3::zk::algorithms::commit_one (_params, this->get_U(k, i)); diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp index e06e189403..6e4ad2b3b0 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/kzg_v2.hpp @@ -109,9 +109,9 @@ namespace nil { } }; - using endianness = nil::marshalling::option::big_endian; + using endianness = marshalling::option::big_endian; using field_element_type = nil::crypto3::marshalling::types::field_element< - nil::marshalling::field_type, + marshalling::field_type, commitment_type >; private: @@ -208,9 +208,9 @@ namespace nil { }); std::vector result; for (const auto& single_commitment : this->_ind_commitments[index]) { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector single_commitment_bytes = - nil::marshalling::pack(single_commitment, status); + marshalling::pack(single_commitment, status); THROW_IF_ERROR_STATUS(status, "kzg_v2::commit"); result.insert(result.end(), single_commitment_bytes.begin(), single_commitment_bytes.end()); } @@ -332,7 +332,7 @@ namespace nil { auto F = CommitmentSchemeType::single_commitment_type::zero(); auto rsum = CommitmentSchemeType::scalar_value_type::zero(); - nil::marshalling::status_type status; + marshalling::status_type status; for (const auto &it: this->_commitments) { auto k = it.first; @@ -344,7 +344,7 @@ namespace nil { byteblob[j] = this->_commitments[k][i * blob_size + j]; } typename curve_type::template g1_type<>::value_type - cm_i = nil::marshalling::pack(byteblob, status); + cm_i = marshalling::pack(byteblob, status); THROW_IF_ERROR_STATUS(status, "kzg_v2::verify_eval"); auto Z_T_S_i = set_difference_polynom(_merged_points, this->_points.at(k)[i]).evaluate( theta_2); diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/lpc.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/lpc.hpp index 091f042d0c..d3499d2f20 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/lpc.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/commitments/polynomial/lpc.hpp @@ -115,8 +115,8 @@ namespace nil { , _fixed_polys_values(fixed_polys_values) { } - - + + lpc_commitment_scheme(const typename fri_type::params_type &fri_params) : _fri_params(fri_params), _etha(0u) { } @@ -172,6 +172,7 @@ namespace nil { BOOST_ASSERT(this->_points.size() == this->_polys.size()); BOOST_ASSERT(this->_points.size() == this->_z.get_batches_num()); + // For each batch we have a merkle tree. for (auto const& it: this->_trees) { transcript(it.second.root()); diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/assignment.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/assignment.hpp index 3445d0909c..af7b8effad 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/assignment.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/assignment.hpp @@ -208,10 +208,6 @@ namespace nil { return _public_inputs; } - public_input_container_type move_public_inputs() { - return std::move(_public_inputs); - } - std::uint32_t constants_amount() const { return _constants.size(); } @@ -233,10 +229,6 @@ namespace nil { return _constants; } - constant_container_type move_constants() { - return std::move(_constants); - } - constexpr std::uint32_t selectors_amount() const { return _selectors.size(); } @@ -489,14 +481,14 @@ namespace nil { return _private_table; } - std::shared_ptr move_private_table() { - return std::move(_private_table); - } - std::shared_ptr public_table() const { return _public_table; } + std::shared_ptr move_private_table() { + return std::move(_private_table); + } + std::shared_ptr move_public_table() { return std::move(_public_table); } diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp index eb29482030..e040a9d51b 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/constraint_system.hpp @@ -54,7 +54,6 @@ namespace nil { namespace crypto3 { namespace zk { namespace snark { - /************************* PLONK constraint system ****************************/ constexpr static std::size_t const PLONK_SPECIAL_SELECTOR_ALL_USABLE_ROWS_SELECTED = std::numeric_limits::max(); constexpr static std::size_t const PLONK_SPECIAL_SELECTOR_ALL_NON_FIRST_USABLE_ROWS_SELECTED = std::numeric_limits::max() - 1; // Useful for lookup tables diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/detail/column_polynomial.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/detail/column_polynomial.hpp index a9177e5346..4b486bf470 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/detail/column_polynomial.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/detail/column_polynomial.hpp @@ -95,7 +95,7 @@ namespace nil { template math::polynomial_dfs - column_polynomial_dfs(plonk_column column_assignment, + column_polynomial_dfs(const plonk_column& column_assignment, std::shared_ptr> domain) { std::size_t d = std::distance(column_assignment.begin(), column_assignment.end()) - 1; @@ -110,7 +110,7 @@ namespace nil { template std::vector> - column_range_polynomial_dfs(std::vector> column_range_assignment, + column_range_polynomial_dfs(const std::vector>& column_range_assignment, std::shared_ptr> domain) { std::size_t columns_amount = column_range_assignment.size(); @@ -118,7 +118,7 @@ namespace nil { for (std::size_t column_index = 0; column_index < columns_amount; column_index++) { columns[column_index] = - column_polynomial_dfs(std::move(column_range_assignment[column_index]), domain); + column_polynomial_dfs(column_range_assignment[column_index], domain); } return columns; diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/lookup_table_definition.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/lookup_table_definition.hpp index 8e6b23f4ba..9a17ed13be 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/lookup_table_definition.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/lookup_table_definition.hpp @@ -80,7 +80,7 @@ namespace nil { plonk_lookup_table lookup_table; std::string name; - dynamic_table_definition(std::string _name): name(_name), defined(false) {} + dynamic_table_definition(std::string _name): defined(false), name(_name) {} void define(const plonk_lookup_table &table){ BOOST_ASSERT(!defined); diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/padding.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/padding.hpp index 58f85dabad..f474b8a10b 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/padding.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/arithmetization/plonk/padding.hpp @@ -53,30 +53,30 @@ namespace nil { padded_rows_amount = 8; for (std::uint32_t w_index = 0; w_index < - table._private_table.witnesses_amount(); w_index++) { + table._private_table->witnesses_amount(); w_index++) { - table._private_table._witnesses[w_index].resize(padded_rows_amount, + table._private_table->_witnesses[w_index].resize(padded_rows_amount, FieldType::value_type::zero()); } for (std::uint32_t pi_index = 0; pi_index < - table._public_table.public_inputs_amount(); pi_index++) { + table._public_table->public_inputs_amount(); pi_index++) { - table._public_table._public_inputs[pi_index].resize(padded_rows_amount, + table._public_table->_public_inputs[pi_index].resize(padded_rows_amount, FieldType::value_type::zero()); } for (std::uint32_t c_index = 0; c_index < - table._public_table.constants_amount(); c_index++) { + table._public_table->constants_amount(); c_index++) { - table._public_table._constants[c_index].resize(padded_rows_amount, + table._public_table->_constants[c_index].resize(padded_rows_amount, FieldType::value_type::zero()); } for (std::uint32_t s_index = 0; s_index < - table._public_table.selectors_amount(); s_index++) { + table._public_table->selectors_amount(); s_index++) { - table._public_table._selectors[s_index].resize(padded_rows_amount, + table._public_table->_selectors[s_index].resize(padded_rows_amount, FieldType::value_type::zero()); } @@ -124,7 +124,6 @@ namespace nil { table._private_table->_witnesses[w_index][i] = alg_rnd(); } } - return padded_rows_amount; } } // namespace snark diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp index 986f6a4f27..84b99270d9 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/detail/transcript_initialization_context.hpp @@ -121,13 +121,13 @@ namespace nil { ); // Marshall the initialization context and push it to the transcript. - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; auto filled_context = nil::crypto3::marshalling::types::fill_transcript_initialization_context< Endianness, nil::crypto3::zk::snark::detail::transcript_initialization_context>(context); std::vector cv(filled_context.length(), 0x00); auto write_iter = cv.begin(); - nil::marshalling::status_type status = filled_context.write(write_iter, cv.size()); + nil::crypto3::marshalling::status_type status = filled_context.write(write_iter, cv.size()); THROW_IF_ERROR_STATUS(status, "transcript_initialization_context::compute_constraint_system_with_params_hash"); // Append constraint_system to the buffer "cv". diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp index b7bd4744cc..e1be0369d5 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/lookup_argument.hpp @@ -167,7 +167,8 @@ namespace nil { 0, basic_domain->m, FieldType::value_type::one()); polynomial_dfs_type zero_polynomial( 0, basic_domain->m, FieldType::value_type::zero()); - polynomial_dfs_type mask_assignment = one_polynomial - preprocessed_data.q_last - preprocessed_data.q_blind; + polynomial_dfs_type mask_assignment = + one_polynomial - preprocessed_data.q_last - preprocessed_data.q_blind; polynomial_dfs_type lagrange0 = preprocessed_data.common_data.lagrange_0; std::unique_ptr> lookup_value_ptr = @@ -178,6 +179,7 @@ namespace nil { prepare_lookup_input(mask_assignment, lagrange0); auto& lookup_input = *lookup_input_ptr; + // 3. Lookup_input and lookup_value are ready // Now sort them! // Reduce value and input: @@ -678,7 +680,6 @@ namespace nil { ); std::size_t i1 = 0; std::size_t j1 = 0; - auto append_to_sorted = [usable_rows_amount, &sorted, &i1, &j1] ( const typename FieldType::value_type& value) { sorted[i1][j1] = value; @@ -773,8 +774,8 @@ namespace nil { const auto &table = lookup_tables[t_id]; auto key = std::tuple(table.tag_index, 0, plonk_variable::column_type::selector); auto shifted_key = std::tuple(table.tag_index, 1, plonk_variable::column_type::selector); - auto selector_value = evaluations[key]; - auto shifted_selector_value = evaluations[shifted_key]; + typename FieldType::value_type selector_value = evaluations[key]; + typename FieldType::value_type shifted_selector_value = evaluations[shifted_key]; for( std::size_t o_id = 0; o_id < table.lookup_options.size(); o_id++){ typename FieldType::value_type v = selector_value * (t_id + 1); typename FieldType::value_type shifted_v = shifted_selector_value * (t_id + 1); @@ -798,7 +799,7 @@ namespace nil { for( std::size_t g_id = 0; g_id < lookup_gates.size(); g_id++ ){ const auto &gate = lookup_gates[g_id]; auto key = std::tuple(gate.tag_index, 0, plonk_variable::column_type::selector); - auto selector_value = evaluations[key]; + typename FieldType::value_type selector_value = evaluations[key]; for( std::size_t c_id = 0; c_id < gate.constraints.size(); c_id++){ const auto &constraint = gate.constraints[c_id]; typename FieldType::value_type l = selector_value * constraint.table_id; diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/preprocessor.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/preprocessor.hpp index 7afb7ced4c..8780e59bfe 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/preprocessor.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/preprocessor.hpp @@ -269,7 +269,7 @@ namespace nil { }; bool operator==(const preprocessed_data_type &rhs) const { - return shared_ptr_equal(public_polynomial_table, rhs.public_polynomial_table) && + return shared_ptr_equal(public_polynomial_table, rhs.public_polynomial_table) && permutation_polynomials == rhs.permutation_polynomials && identity_polynomials == rhs.identity_polynomials && q_last == rhs.q_last && diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp index 6ab47adebb..601ad22643 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/prover.hpp @@ -107,7 +107,7 @@ namespace nil { ) { auto prover = placeholder_prover( preprocessed_public_data, std::move(preprocessed_private_data), table_description, - constraint_system, commitment_scheme, skip_commitment_scheme_eval_proofs); + constraint_system, std::move(commitment_scheme), skip_commitment_scheme_eval_proofs); return prover.process(); } @@ -217,6 +217,7 @@ namespace nil { // 8. Run evaluation proofs _proof.eval_proof.challenge = transcript.template challenge(); generate_evaluation_points(); + if (!_skip_commitment_scheme_eval_proofs) { _proof.eval_proof.eval_proof = _commitment_scheme.proof_eval(transcript); } else { @@ -361,7 +362,7 @@ namespace nil { for (std::size_t j = 0; j < gates[i].constraints.size(); j++) { polynomial_dfs_type constraint_result = gates[i].constraints[j].evaluate( - *_polynomial_table, preprocessed_public_data.common_data.basic_domain) * + _polynomial_table, preprocessed_public_data.common_data.basic_domain) * _polynomial_table.selector(gates[i].selector_index); // for (std::size_t k = 0; k < table_description.rows_amount; k++) { if (constraint_result.evaluate( diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/verifier.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/verifier.hpp index 5346f41242..c8b20dcd32 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/verifier.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/snark/systems/plonk/placeholder/verifier.hpp @@ -176,7 +176,7 @@ namespace nil { if (constraint_system.public_input_sizes_num() != 0) max_size = std::min(max_size, constraint_system.public_input_size(i)); auto omega_pow = FieldType::value_type::one(); - for( std::size_t j = 0; j < public_input[i].size(); ++j ){ + for( std::size_t j = 0; j < max_size; ++j ){ value += (public_input[i][j] * omega_pow) * (challenge - omega_pow).inversed(); omega_pow = omega_pow * omega; } diff --git a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp index a6680b2ba3..f4a9d7dade 100644 --- a/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp +++ b/parallel-crypto3/libs/parallel-zk/include/nil/crypto3/zk/transcript/fiat_shamir.hpp @@ -95,9 +95,9 @@ namespace nil { ); acc(data); } else { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; typename hash_type::construction::type::block_type byte_data = - nil::marshalling::pack(data, status); + nil::crypto3::marshalling::pack(data, status); THROW_IF_ERROR_STATUS(status, "fiat_shamir_heuristic_accumulative::operator()"); acc(byte_data); } @@ -177,9 +177,9 @@ namespace nil { algebra::is_field_element::value > operator()(element const& data) { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector byte_data = - nil::marshalling::pack(data, status); + nil::crypto3::marshalling::pack(data, status); THROW_IF_ERROR_STATUS(status, "fiat_shamir_heuristic_sequential::operator()"); auto acc_convertible = hash(state); state = accumulators::extract::hash( @@ -203,8 +203,9 @@ namespace nil { std::size_t count = std::min(data.size(), state.size()); std::copy(state.begin(), state.begin() + count, data.begin() + data.size() - count); - nil::marshalling::status_type status; - big_uint_of_hash_size raw_result = nil::marshalling::pack(state, status); + nil::crypto3::marshalling::status_type status; + big_uint_of_hash_size raw_result = + nil::crypto3::marshalling::pack(state, status); THROW_IF_ERROR_STATUS(status, "fiat_shamir_heuristic_sequential::challenge"); return raw_result; } @@ -212,8 +213,8 @@ namespace nil { template Integral int_challenge() { state = hash(state); - nil::marshalling::status_type status; - big_uint_of_hash_size raw_result = nil::marshalling::pack(state, status); + nil::crypto3::marshalling::status_type status; + big_uint_of_hash_size raw_result = nil::crypto3::marshalling::pack(state, status); // If we remove the next line, raw_result is a much larger number, conversion to 'Integral' will overflow // and in debug mode an assert will fire. In release mode nothing will change. raw_result &= ~Integral(0); @@ -332,7 +333,7 @@ namespace nil { Integral result = 0u; Integral factor = 1u; size_t bytes_to_fill = sizeof(Integral); - // TODO(martun): consider using export_bits here, or nil::marshalling::pack, instead of this. + // TODO(martun): consider using export_bits here, or nil::crypto3::marshalling::pack, instead of this. while (intermediate_result > 0u && bytes_to_fill != 0u) { auto last_byte = intermediate_result % 0x100u; Integral last_byte_integral = static_cast(last_byte); diff --git a/parallel-crypto3/libs/parallel-zk/test/commitment/kzg.cpp b/parallel-crypto3/libs/parallel-zk/test/commitment/kzg.cpp index 674a7fa404..b0db0959fc 100644 --- a/parallel-crypto3/libs/parallel-zk/test/commitment/kzg.cpp +++ b/parallel-crypto3/libs/parallel-zk/test/commitment/kzg.cpp @@ -232,10 +232,10 @@ BOOST_AUTO_TEST_CASE(kzg_test_mnt6_accumulated) { auto params = typename kzg_type::params_type(n, alpha); auto commit = zk::algorithms::commit(params, f); - nil::marshalling::status_type status; - using endianness = nil::marshalling::option::big_endian; + nil::crypto3::marshalling::status_type status; + using endianness = nil::crypto3::marshalling::option::big_endian; std::vector single_commitment_bytes = - nil::marshalling::pack(commit, status); + nil::crypto3::marshalling::pack(commit, status); dump_vector(single_commitment_bytes, "commitment"); BOOST_CHECK(curve_type::template g1_type<>::value_type::one() == params.commitment_key[0]); @@ -569,11 +569,11 @@ BOOST_AUTO_TEST_CASE(batched_kzg_placeholder_repr) { // auto params = typename kzg_type::params_type(8, 8, alpha); auto params = create_kzg_params(3 /*degree_log*/); auto commits = zk::algorithms::commit(params, polys); - using endianness = nil::marshalling::option::big_endian; + using endianness = nil::crypto3::marshalling::option::big_endian; for (auto &c: commits) { - nil::marshalling::status_type status; + nil::crypto3::marshalling::status_type status; std::vector single_commitment_bytes = - nil::marshalling::pack(c, status); + nil::crypto3::marshalling::pack(c, status); dump_vector(single_commitment_bytes, "commitment"); } diff --git a/proof-producer/bin/proof-producer/include/nil/proof-generator/prover.hpp b/proof-producer/bin/proof-producer/include/nil/proof-generator/prover.hpp index ddb804dfe7..79a3e2f53b 100644 --- a/proof-producer/bin/proof-producer/include/nil/proof-generator/prover.hpp +++ b/proof-producer/bin/proof-producer/include/nil/proof-generator/prover.hpp @@ -85,7 +85,7 @@ namespace nil { MarshallingType marshalled_data; auto read_iter = v->begin(); auto status = marshalled_data.read(read_iter, v->size()); - if (status != nil::marshalling::status_type::success) { + if (status != nil::crypto3::marshalling::status_type::success) { BOOST_LOG_TRIVIAL(error) << "When reading a Marshalled structure from file " << path << ", decoding step failed."; return std::nullopt; @@ -102,8 +102,8 @@ namespace nil { std::vector v; v.resize(data_for_marshalling.length(), 0x00); auto write_iter = v.begin(); - nil::marshalling::status_type status = data_for_marshalling.write(write_iter, v.size()); - if (status != nil::marshalling::status_type::success) { + nil::crypto3::marshalling::status_type status = data_for_marshalling.write(write_iter, v.size()); + if (status != nil::crypto3::marshalling::status_type::success) { BOOST_LOG_TRIVIAL(error) << "Marshalled structure encoding failed"; return false; } @@ -171,12 +171,12 @@ namespace nil { placeholder_private_preprocessor::preprocessed_data_type; using ConstraintSystem = nil::blueprint::circuit>; using TableDescription = nil::crypto3::zk::snark::plonk_table_description; - using Endianness = nil::marshalling::option::big_endian; + using Endianness = nil::crypto3::marshalling::option::big_endian; using FriType = typename Lpc::fri_type; using FriParams = typename FriType::params_type; using Column = nil::crypto3::zk::snark::plonk_column; using AssignmentTable = nil::crypto3::zk::snark::plonk_assignment_table; - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using TableMarshalling = nil::crypto3::marshalling::types::plonk_assignment_table; @@ -400,7 +400,7 @@ namespace nil { create_lpc_scheme(); using ProofMarshalling = nil::crypto3::marshalling::types:: - placeholder_proof, Proof>; + placeholder_proof, Proof>; BOOST_LOG_TRIVIAL(info) << "Reading proof from file"; auto marshalled_proof = detail::decode_marshalling_from_file(proof_file_, true); @@ -911,7 +911,7 @@ namespace nil { /* Marshalling types */ using partial_proof_marshalled_type = nil::crypto3::marshalling::types:: - placeholder_proof, Proof>; + placeholder_proof, Proof>; using initial_proof_marshalling_type = nil::crypto3::marshalling::types:: inital_eval_proof; @@ -995,7 +995,7 @@ namespace nil { bool save_proof_of_work( const typename FriType::grinding_type::output_type &proof_of_work, const boost::filesystem::path &output_file) { - using POW_marshalling_type = nil::marshalling::types::integral; + using POW_marshalling_type = nil::crypto3::marshalling::types::integral; BOOST_LOG_TRIVIAL(info) << "Writing proof of work to " << output_file; POW_marshalling_type marshalled_pow(proof_of_work); diff --git a/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/assignment_table_writer.hpp b/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/assignment_table_writer.hpp index 7dbff9146a..aca74c66e2 100644 --- a/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/assignment_table_writer.hpp +++ b/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/assignment_table_writer.hpp @@ -35,7 +35,7 @@ namespace nil { template class assignment_table_writer { - public: + public: using Column = nil::crypto3::zk::snark::plonk_column; using ArithmetizationType = nil::crypto3::zk::snark::plonk_constraint_system; @@ -43,23 +43,23 @@ namespace nil { using AssignmentTableDescription = nil::crypto3::zk::snark::plonk_table_description; // marshalling traits - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using BlueprintFieldValueType = typename BlueprintField::value_type; using MarshallingField = nil::crypto3::marshalling::types::field_element< TTypeBase, BlueprintFieldValueType >; - private: + private: /** - * @brief Write size_t serialized as nil::marshalling::types::integral into output stream. + * @brief Write size_t serialized as nil::crypto3::marshalling::types::integral into output stream. */ static void write_size_t(std::ostream& out, size_t input) { - auto integer_container = nil::marshalling::types::integral(input); + auto integer_container = nil::crypto3::marshalling::types::integral(input); std::array char_array{}; auto write_iter = char_array.begin(); auto const status = integer_container.write(write_iter, char_array.size()); - assert(status == nil::marshalling::status_type::success); + assert(status == nil::crypto3::marshalling::status_type::success); out.write(reinterpret_cast(char_array.data()), char_array.size()); } @@ -83,7 +83,7 @@ namespace nil { std::array char_array{}; auto write_iter = char_array.begin(); auto const status = field_container.write(write_iter, char_array.size()); - assert(status == nil::marshalling::status_type::success); + assert(status == nil::crypto3::marshalling::status_type::success); out.write(reinterpret_cast(char_array.data()), char_array.size()); } diff --git a/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/circuit_writer.hpp b/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/circuit_writer.hpp index de4bcb47a4..26e0ea2b8a 100644 --- a/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/circuit_writer.hpp +++ b/proof-producer/libs/output_artifacts/include/nil/proof-generator/output_artifacts/circuit_writer.hpp @@ -31,7 +31,7 @@ namespace nil { template class circuit_writer { public: - using TTypeBase = nil::marshalling::field_type; + using TTypeBase = nil::crypto3::marshalling::field_type; using Circuit = nil::crypto3::zk::snark::plonk_constraint_system; circuit_writer() = delete; @@ -69,7 +69,7 @@ namespace nil { std::vector cv(filled_val.length(), 0x00); auto iter = cv.begin(); auto const status = filled_val.write(iter, cv.size()); - assert(status == nil::marshalling::status_type::success); + assert(status == nil::crypto3::marshalling::status_type::success); out.write(reinterpret_cast(cv.data()), cv.size()); } }; diff --git a/proof-producer/tests/libs/output_artifacts/test_assignment_table_writer.cpp b/proof-producer/tests/libs/output_artifacts/test_assignment_table_writer.cpp index 4a34122f23..f349ed9b12 100644 --- a/proof-producer/tests/libs/output_artifacts/test_assignment_table_writer.cpp +++ b/proof-producer/tests/libs/output_artifacts/test_assignment_table_writer.cpp @@ -18,8 +18,8 @@ #include #include -using Endianness = nil::marshalling::option::big_endian; -using TTypeBase = nil::marshalling::field_type; +using Endianness = nil::crypto3::marshalling::option::big_endian; +using TTypeBase = nil::crypto3::marshalling::field_type; using BlueprintField = typename nil::crypto3::algebra::curves::pallas::base_field_type; @@ -55,7 +55,7 @@ class AssignmentTableWriterTest: public ::testing::Test { MarshalledTable marshalled_table; auto read_iter = table_bytes_.begin(); auto const status = marshalled_table.read(read_iter, table_bytes_.size()); - ASSERT_TRUE(status == nil::marshalling::status_type::success); + ASSERT_TRUE(status == nil::crypto3::marshalling::status_type::success); // unpack decoded data to table & description auto [desc, table] = nil::crypto3::marshalling::types::make_assignment_table(marshalled_table); diff --git a/proof-producer/tests/libs/output_artifacts/test_circuit_writer.cpp b/proof-producer/tests/libs/output_artifacts/test_circuit_writer.cpp index 8c551c6c9f..6f3e2a4454 100644 --- a/proof-producer/tests/libs/output_artifacts/test_circuit_writer.cpp +++ b/proof-producer/tests/libs/output_artifacts/test_circuit_writer.cpp @@ -13,8 +13,8 @@ #include -using Endianness = nil::marshalling::option::big_endian; -using TTypeBase = nil::marshalling::field_type; +using Endianness = nil::crypto3::marshalling::option::big_endian; +using TTypeBase = nil::crypto3::marshalling::field_type; using BlueprintField = typename nil::crypto3::algebra::curves::pallas::base_field_type; @@ -44,7 +44,7 @@ class CircuitWriterTest: public ::testing::Test { CircuitMarshalling marshalled_circuit; auto read_iter = circuit_bytes_.begin(); auto const status = marshalled_circuit.read(read_iter, circuit_bytes_.size()); - ASSERT_TRUE(status == nil::marshalling::status_type::success); + ASSERT_TRUE(status == nil::crypto3::marshalling::status_type::success); circuit_ = nil::crypto3::marshalling::types::make_plonk_constraint_system(marshalled_circuit); }