A ShapeTree object can own the underlying Shape pointer (via the shape_storage_ member), or can point to a Shape object owned by the caller. This API replaces the underlying Shape object to the one supplied by the caller, whom must ensure the object remain valid for the whole lifetime of this ShapeTree object, and also that the Shape is consistent with it.
| 128 | // caller, whom must ensure the object remain valid for the whole lifetime of |
| 129 | // this ShapeTree object, and also that the Shape is consistent with it. |
| 130 | void replace_shape_ptr(const Shape* shape) { |
| 131 | if (shape_storage_ != nullptr) { |
| 132 | DCHECK_EQ(*shape, *shape_storage_); |
| 133 | shape_storage_ = nullptr; |
| 134 | } |
| 135 | shape_ = shape; |
| 136 | } |
| 137 | |
| 138 | // Returns true if the node at the given index is a leaf node (an array |
| 139 | // shape). |
no outgoing calls
no test coverage detected