diff --git a/src/cpp/dynamic-types/DynamicDataHelper.cpp b/src/cpp/dynamic-types/DynamicDataHelper.cpp index bd82be7827e..93d9243acb3 100644 --- a/src/cpp/dynamic-types/DynamicDataHelper.cpp +++ b/src/cpp/dynamic-types/DynamicDataHelper.cpp @@ -251,16 +251,33 @@ void DynamicDataHelper::aux_index_position( void DynamicDataHelper::print_basic_collection( DynamicData* data) { - const std::vector& bounds = data->type_->descriptor_->bound_; + if (data->type_->get_kind() == TK_SEQUENCE) + { + auto count = data->get_item_count(); + std::cout << "["; + for (size_t i = 0; i < count; ++i) + { + print_basic_element(data, i, data->type_->get_element_type()->get_kind()); + std::cout << (i == count - 1 ? "]" : ", "); + } + if (count == 0) + { + std::cout << "]"; + } + } + else + { + const std::vector& bounds = data->type_->descriptor_->bound_; - std::vector> positions; - fill_array_positions(bounds, positions); + std::vector> positions; + fill_array_positions(bounds, positions); - std::cout << "["; - for (size_t i = 0; i < positions.size(); ++i) - { - print_basic_element(data, data->get_array_index(positions[i]), data->type_->get_element_type()->get_kind()); - std::cout << (i == positions.size() - 1 ? "]" : ", "); + std::cout << "["; + for (size_t i = 0; i < positions.size(); ++i) + { + print_basic_element(data, data->get_array_index(positions[i]), data->type_->get_element_type()->get_kind()); + std::cout << (i == positions.size() - 1 ? "]" : ", "); + } } } @@ -268,16 +285,35 @@ void DynamicDataHelper::print_complex_collection( DynamicData* data, const std::string& tabs) { - const std::vector& bounds = data->type_->descriptor_->bound_; + if (data->type_->get_kind() == TK_SEQUENCE) + { + auto count = data->get_item_count(); - std::vector> positions; - fill_array_positions(bounds, positions); + for (size_t i = 0; i < count; ++i) + { + std::cout << tabs << "[" << i << "] = "; + print_complex_element(data, i, tabs); + std::cout << std::endl; + } - for (size_t i = 0; i < positions.size(); ++i) + if (count == 0) + { + std::cout << "[]"; + } + } + else { - std::cout << tabs << "[" << i << "] = "; - print_complex_element(data, data->get_array_index(positions[i]), tabs); - std::cout << std::endl; + const std::vector& bounds = data->type_->descriptor_->bound_; + + std::vector> positions; + fill_array_positions(bounds, positions); + + for (size_t i = 0; i < positions.size(); ++i) + { + std::cout << tabs << "[" << i << "] = "; + print_complex_element(data, data->get_array_index(positions[i]), tabs); + std::cout << std::endl; + } } }