/root/doris/be/src/runtime/struct_value.h
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | // Licensed to the Apache Software Foundation (ASF) under one | 
| 2 |  | // or more contributor license agreements.  See the NOTICE file | 
| 3 |  | // distributed with this work for additional information | 
| 4 |  | // regarding copyright ownership.  The ASF licenses this file | 
| 5 |  | // to you under the Apache License, Version 2.0 (the | 
| 6 |  | // "License"); you may not use this file except in compliance | 
| 7 |  | // with the License.  You may obtain a copy of the License at | 
| 8 |  | // | 
| 9 |  | //   http://www.apache.org/licenses/LICENSE-2.0 | 
| 10 |  | // | 
| 11 |  | // Unless required by applicable law or agreed to in writing, | 
| 12 |  | // software distributed under the License is distributed on an | 
| 13 |  | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | 
| 14 |  | // KIND, either express or implied.  See the License for the | 
| 15 |  | // specific language governing permissions and limitations | 
| 16 |  | // under the License. | 
| 17 |  |  | 
| 18 |  | #pragma once | 
| 19 |  |  | 
| 20 |  | #include <stdint.h> | 
| 21 |  |  | 
| 22 |  | namespace doris { | 
| 23 |  |  | 
| 24 |  | class StructValue { | 
| 25 |  | public: | 
| 26 |  |     StructValue() = default; | 
| 27 |  |  | 
| 28 | 0 |     explicit StructValue(uint32_t size) : _values(nullptr), _size(size), _has_null(false) {} | 
| 29 | 0 |     StructValue(void** values, uint32_t size) : _values(values), _size(size), _has_null(false) {} | 
| 30 |  |     StructValue(void** values, uint32_t size, bool has_null) | 
| 31 | 0 |             : _values(values), _size(size), _has_null(has_null) {} | 
| 32 |  |  | 
| 33 |  |     //void to_struct_val(StructVal* val) const; | 
| 34 |  |     //static StructValue from_struct_val(const StructVal& val); | 
| 35 |  |  | 
| 36 | 0 |     uint32_t size() const { return _size; } | 
| 37 | 0 |     void set_size(uint32_t size) { _size = size; } | 
| 38 | 0 |     bool has_null() const { return _has_null; } | 
| 39 | 0 |     void set_has_null(bool has_null) { _has_null = has_null; } | 
| 40 | 0 |     bool is_null_at(uint32_t index) const { | 
| 41 | 0 |         return this->_has_null && this->_values[index] == nullptr;   Branch (41:16): [True: 0, False: 0]
  Branch (41:35): [True: 0, False: 0]
 | 
| 42 | 0 |     } | 
| 43 |  |  | 
| 44 |  |     void shallow_copy(const StructValue* other); | 
| 45 |  |  | 
| 46 | 0 |     const void** values() const { return const_cast<const void**>(_values); } | 
| 47 | 0 |     void** mutable_values() { return _values; } | 
| 48 | 0 |     void set_values(void** values) { _values = values; } | 
| 49 | 0 |     const void* child_value(uint32_t index) const { return _values[index]; } | 
| 50 | 0 |     void* mutable_child_value(uint32_t index) { return _values[index]; } | 
| 51 | 0 |     void set_child_value(void* value, uint32_t index) { _values[index] = value; } | 
| 52 |  |  | 
| 53 |  | private: | 
| 54 |  |     // pointer to the start of the vector of children pointers. These pointers are | 
| 55 |  |     // point to children values where a null pointer means that this child is NULL. | 
| 56 |  |     void** _values = nullptr; | 
| 57 |  |     // the number of values in this struct value. | 
| 58 |  |     uint32_t _size; | 
| 59 |  |     // child has no null value if has_null is false. | 
| 60 |  |     // child may has null value if has_null is true. | 
| 61 |  |     bool _has_null; | 
| 62 |  | }; | 
| 63 |  | } // namespace doris |