Create a stable C pointer to the N last structs in nested_structs_
| 1821 | |
| 1822 | // Create a stable C pointer to the N last structs in nested_structs_ |
| 1823 | struct ArrowSchema** NLastChildren(int64_t n_children, struct ArrowSchema* parent) { |
| 1824 | children_arrays_.emplace_back(n_children); |
| 1825 | struct ArrowSchema** children = children_arrays_.back().data(); |
| 1826 | int64_t nested_offset; |
| 1827 | // If parent is itself at the end of nested_structs_, skip it |
| 1828 | if (parent != nullptr && &nested_structs_.back() == parent) { |
| 1829 | nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children - 1; |
| 1830 | } else { |
| 1831 | nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children; |
| 1832 | } |
| 1833 | for (int64_t i = 0; i < n_children; ++i) { |
| 1834 | children[i] = &nested_structs_[nested_offset + i]; |
| 1835 | } |
| 1836 | return children; |
| 1837 | } |
| 1838 | |
| 1839 | struct ArrowSchema* LastChild(struct ArrowSchema* parent = nullptr) { |
| 1840 | return *NLastChildren(1, parent); |
nothing calls this directly
no test coverage detected