| 2785 | } |
| 2786 | |
| 2787 | bool generate_struct_deserialization(AST_Structure* node, |
| 2788 | FieldFilter field_filter) |
| 2789 | { |
| 2790 | const std::string actual_cpp_name = scoped(node->name()); |
| 2791 | std::string cpp_name = actual_cpp_name; |
| 2792 | std::string const_cpp_name; |
| 2793 | switch (field_filter) { |
| 2794 | case FieldFilter_All: |
| 2795 | const_cpp_name = "const" + actual_cpp_name + "&"; |
| 2796 | break; |
| 2797 | case FieldFilter_NestedKeyOnly: |
| 2798 | cpp_name = "const NestedKeyOnly<" + actual_cpp_name + ">"; |
| 2799 | const_cpp_name = "const NestedKeyOnly<const" + actual_cpp_name + ">&"; |
| 2800 | break; |
| 2801 | case FieldFilter_KeyOnly: |
| 2802 | cpp_name = "const KeyOnly<" + actual_cpp_name + ">"; |
| 2803 | const_cpp_name = "const KeyOnly<const" + actual_cpp_name + ">&"; |
| 2804 | break; |
| 2805 | } |
| 2806 | const std::string value_access = field_filter == FieldFilter_All ? "" : ".value"; |
| 2807 | const bool wrap_nested_key_only = field_filter != FieldFilter_All; |
| 2808 | const Fields fields(node, field_filter); |
| 2809 | const Fields::Iterator fields_end = fields.end(); |
| 2810 | RtpsFieldCustomizer rtpsCustom(cpp_name); |
| 2811 | |
| 2812 | const bool use_cxx11 = be_global->language_mapping() == BE_GlobalData::LANGMAP_CXX11; |
| 2813 | |
| 2814 | const ExtensibilityKind exten = be_global->extensibility(node); |
| 2815 | const bool not_final = exten != extensibilitykind_final; |
| 2816 | const bool is_mutable = exten == extensibilitykind_mutable; |
| 2817 | const bool is_appendable = exten == extensibilitykind_appendable; |
| 2818 | |
| 2819 | { |
| 2820 | Function extraction("operator>>", "bool"); |
| 2821 | extraction.addArg("strm", "Serializer&"); |
| 2822 | extraction.addArg("stru", cpp_name + "&"); |
| 2823 | extraction.endArgs(); |
| 2824 | Intro intro; |
| 2825 | string expr; |
| 2826 | const std::string indent = " "; |
| 2827 | |
| 2828 | be_global->impl_ << |
| 2829 | " const Encoding& encoding = strm.encoding();\n" |
| 2830 | " ACE_UNUSED_ARG(encoding);\n"; |
| 2831 | if (is_appendable) { |
| 2832 | be_global->impl_ << |
| 2833 | " bool reached_end_of_struct = false;\n" |
| 2834 | " ACE_UNUSED_ARG(reached_end_of_struct);\n"; |
| 2835 | } |
| 2836 | marshal_generator::generate_dheader_code( |
| 2837 | " if (!strm.read_delimiter(total_size)) {\n" |
| 2838 | " return false;\n" |
| 2839 | " }\n", not_final); |
| 2840 | |
| 2841 | if (not_final) { |
| 2842 | be_global->impl_ << |
| 2843 | " const size_t end_of_struct = strm.rpos() + total_size;\n" |
| 2844 | "\n"; |
no test coverage detected