Coverage Report

Created: 2026-11-12 08:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/third_party/flatbuffers/table.h
Line
Count
Source
1
/*
2
 * Copyright 2021 Google Inc. All rights reserved.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
#ifndef FLATBUFFERS_TABLE_H_
18
#define FLATBUFFERS_TABLE_H_
19
20
#include "flatbuffers/base.h"
21
#include "flatbuffers/verifier.h"
22
23
namespace flatbuffers {
24
25
// "tables" use an offset table (possibly shared) that allows fields to be
26
// omitted and added at will, but uses an extra indirection to read.
27
class Table {
28
 public:
29
1.25M
  const uint8_t *GetVTable() const {
30
1.25M
    return data_ - ReadScalar<soffset_t>(data_);
31
1.25M
  }
32
33
  // This gets the field offset for any of the functions below it, or 0
34
  // if the field was not present.
35
1.25M
  voffset_t GetOptionalFieldOffset(voffset_t field) const {
36
    // The vtable offset is always at the start.
37
1.25M
    auto vtable = GetVTable();
38
    // The first element is the size of the vtable (fields + type id + itself).
39
1.25M
    auto vtsize = ReadScalar<voffset_t>(vtable);
40
    // If the field we're accessing is outside the vtable, we're reading older
41
    // data, so it's the same as if the offset was 0 (not present).
42
1.25M
    return field < vtsize ? ReadScalar<voffset_t>(vtable + field) : 0;
43
1.25M
  }
44
45
218k
  template<typename T> T GetField(voffset_t field, T defaultval) const {
46
218k
    auto field_offset = GetOptionalFieldOffset(field);
47
218k
    return field_offset ? ReadScalar<T>(data_ + field_offset) : defaultval;
48
218k
  }
unsigned char gdal_flatbuffers::Table::GetField<unsigned char>(unsigned short, unsigned char) const
Line
Count
Source
45
109k
  template<typename T> T GetField(voffset_t field, T defaultval) const {
46
109k
    auto field_offset = GetOptionalFieldOffset(field);
47
109k
    return field_offset ? ReadScalar<T>(data_ + field_offset) : defaultval;
48
109k
  }
int gdal_flatbuffers::Table::GetField<int>(unsigned short, int) const
Line
Count
Source
45
46.8k
  template<typename T> T GetField(voffset_t field, T defaultval) const {
46
46.8k
    auto field_offset = GetOptionalFieldOffset(field);
47
46.8k
    return field_offset ? ReadScalar<T>(data_ + field_offset) : defaultval;
48
46.8k
  }
unsigned long gdal_flatbuffers::Table::GetField<unsigned long>(unsigned short, unsigned long) const
Line
Count
Source
45
31.0k
  template<typename T> T GetField(voffset_t field, T defaultval) const {
46
31.0k
    auto field_offset = GetOptionalFieldOffset(field);
47
31.0k
    return field_offset ? ReadScalar<T>(data_ + field_offset) : defaultval;
48
31.0k
  }
unsigned short gdal_flatbuffers::Table::GetField<unsigned short>(unsigned short, unsigned short) const
Line
Count
Source
45
30.9k
  template<typename T> T GetField(voffset_t field, T defaultval) const {
46
30.9k
    auto field_offset = GetOptionalFieldOffset(field);
47
30.9k
    return field_offset ? ReadScalar<T>(data_ + field_offset) : defaultval;
48
30.9k
  }
Unexecuted instantiation: unsigned int gdal_flatbuffers::Table::GetField<unsigned int>(unsigned short, unsigned int) const
49
50
525k
  template<typename P> P GetPointer(voffset_t field) {
51
525k
    auto field_offset = GetOptionalFieldOffset(field);
52
525k
    auto p = data_ + field_offset;
53
525k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
525k
                        : nullptr;
55
525k
  }
gdal_flatbuffers::String const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::String const*>(unsigned short)
Line
Count
Source
50
312k
  template<typename P> P GetPointer(voffset_t field) {
51
312k
    auto field_offset = GetOptionalFieldOffset(field);
52
312k
    auto p = data_ + field_offset;
53
312k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
312k
                        : nullptr;
55
312k
  }
gdal_flatbuffers::Vector<double> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<double> const*>(unsigned short)
Line
Count
Source
50
75.6k
  template<typename P> P GetPointer(voffset_t field) {
51
75.6k
    auto field_offset = GetOptionalFieldOffset(field);
52
75.6k
    auto p = data_ + field_offset;
53
75.6k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
75.6k
                        : nullptr;
55
75.6k
  }
gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Column> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Column> > const*>(unsigned short)
Line
Count
Source
50
56.6k
  template<typename P> P GetPointer(voffset_t field) {
51
56.6k
    auto field_offset = GetOptionalFieldOffset(field);
52
56.6k
    auto p = data_ + field_offset;
53
56.6k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
56.6k
                        : nullptr;
55
56.6k
  }
FlatGeobuf::Crs const* gdal_flatbuffers::Table::GetPointer<FlatGeobuf::Crs const*>(unsigned short)
Line
Count
Source
50
31.1k
  template<typename P> P GetPointer(voffset_t field) {
51
31.1k
    auto field_offset = GetOptionalFieldOffset(field);
52
31.1k
    auto p = data_ + field_offset;
53
31.1k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
31.1k
                        : nullptr;
55
31.1k
  }
gdal_flatbuffers::Vector<unsigned int> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned int> const*>(unsigned short)
Line
Count
Source
50
9.81k
  template<typename P> P GetPointer(voffset_t field) {
51
9.81k
    auto field_offset = GetOptionalFieldOffset(field);
52
9.81k
    auto p = data_ + field_offset;
53
9.81k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
9.81k
                        : nullptr;
55
9.81k
  }
gdal_flatbuffers::Vector<unsigned long> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned long> const*>(unsigned short)
Line
Count
Source
50
7.57k
  template<typename P> P GetPointer(voffset_t field) {
51
7.57k
    auto field_offset = GetOptionalFieldOffset(field);
52
7.57k
    auto p = data_ + field_offset;
53
7.57k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
7.57k
                        : nullptr;
55
7.57k
  }
gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Geometry> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Geometry> > const*>(unsigned short)
Line
Count
Source
50
17.3k
  template<typename P> P GetPointer(voffset_t field) {
51
17.3k
    auto field_offset = GetOptionalFieldOffset(field);
52
17.3k
    auto p = data_ + field_offset;
53
17.3k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
17.3k
                        : nullptr;
55
17.3k
  }
FlatGeobuf::Geometry const* gdal_flatbuffers::Table::GetPointer<FlatGeobuf::Geometry const*>(unsigned short)
Line
Count
Source
50
7.88k
  template<typename P> P GetPointer(voffset_t field) {
51
7.88k
    auto field_offset = GetOptionalFieldOffset(field);
52
7.88k
    auto p = data_ + field_offset;
53
7.88k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
7.88k
                        : nullptr;
55
7.88k
  }
gdal_flatbuffers::Vector<unsigned char> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned char> const*>(unsigned short)
Line
Count
Source
50
7.36k
  template<typename P> P GetPointer(voffset_t field) {
51
7.36k
    auto field_offset = GetOptionalFieldOffset(field);
52
7.36k
    auto p = data_ + field_offset;
53
7.36k
    return field_offset ? reinterpret_cast<P>(p + ReadScalar<uoffset_t>(p))
54
7.36k
                        : nullptr;
55
7.36k
  }
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_flatbuffers::String> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_flatbuffers::String> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Update> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Update> > const*>(unsigned short)
Unexecuted instantiation: gdal_generated_icechunk::RepoStatus const* gdal_flatbuffers::Table::GetPointer<gdal_generated_icechunk::RepoStatus const*>(unsigned short)
Unexecuted instantiation: void const* gdal_flatbuffers::Table::GetPointer<void const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<unsigned short> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned short> const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::MetadataItem> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::MetadataItem> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::SnapshotInfo> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::SnapshotInfo> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Ref> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Ref> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionName> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionName> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::NodeSnapshot> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::NodeSnapshot> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionShapeV2> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionShapeV2> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_generated_icechunk::DimensionShape const*> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_generated_icechunk::DimensionShape const*> const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestRef> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestRef> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_generated_icechunk::ChunkIndexRange const*> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_generated_icechunk::ChunkIndexRange const*> const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestFileInfoV2> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestFileInfoV2> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_generated_icechunk::ManifestFileInfo const*> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_generated_icechunk::ManifestFileInfo const*> const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ArrayManifest> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ArrayManifest> > const*>(unsigned short)
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ChunkRef> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ChunkRef> > const*>(unsigned short)
56
525k
  template<typename P> P GetPointer(voffset_t field) const {
57
525k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
525k
  }
gdal_flatbuffers::String const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::String const*>(unsigned short) const
Line
Count
Source
56
312k
  template<typename P> P GetPointer(voffset_t field) const {
57
312k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
312k
  }
gdal_flatbuffers::Vector<double> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<double> const*>(unsigned short) const
Line
Count
Source
56
75.6k
  template<typename P> P GetPointer(voffset_t field) const {
57
75.6k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
75.6k
  }
gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Column> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Column> > const*>(unsigned short) const
Line
Count
Source
56
56.6k
  template<typename P> P GetPointer(voffset_t field) const {
57
56.6k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
56.6k
  }
FlatGeobuf::Crs const* gdal_flatbuffers::Table::GetPointer<FlatGeobuf::Crs const*>(unsigned short) const
Line
Count
Source
56
31.1k
  template<typename P> P GetPointer(voffset_t field) const {
57
31.1k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
31.1k
  }
gdal_flatbuffers::Vector<unsigned int> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned int> const*>(unsigned short) const
Line
Count
Source
56
9.81k
  template<typename P> P GetPointer(voffset_t field) const {
57
9.81k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
9.81k
  }
gdal_flatbuffers::Vector<unsigned long> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned long> const*>(unsigned short) const
Line
Count
Source
56
7.57k
  template<typename P> P GetPointer(voffset_t field) const {
57
7.57k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
7.57k
  }
gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Geometry> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<FlatGeobuf::Geometry> > const*>(unsigned short) const
Line
Count
Source
56
17.3k
  template<typename P> P GetPointer(voffset_t field) const {
57
17.3k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
17.3k
  }
FlatGeobuf::Geometry const* gdal_flatbuffers::Table::GetPointer<FlatGeobuf::Geometry const*>(unsigned short) const
Line
Count
Source
56
7.88k
  template<typename P> P GetPointer(voffset_t field) const {
57
7.88k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
7.88k
  }
gdal_flatbuffers::Vector<unsigned char> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned char> const*>(unsigned short) const
Line
Count
Source
56
7.36k
  template<typename P> P GetPointer(voffset_t field) const {
57
7.36k
    return const_cast<Table *>(this)->GetPointer<P>(field);
58
7.36k
  }
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_flatbuffers::String> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_flatbuffers::String> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Update> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Update> > const*>(unsigned short) const
Unexecuted instantiation: gdal_generated_icechunk::RepoStatus const* gdal_flatbuffers::Table::GetPointer<gdal_generated_icechunk::RepoStatus const*>(unsigned short) const
Unexecuted instantiation: void const* gdal_flatbuffers::Table::GetPointer<void const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<unsigned short> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<unsigned short> const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::MetadataItem> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::MetadataItem> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::SnapshotInfo> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::SnapshotInfo> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Ref> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::Ref> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionName> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionName> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::NodeSnapshot> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::NodeSnapshot> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionShapeV2> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::DimensionShapeV2> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_generated_icechunk::DimensionShape const*> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_generated_icechunk::DimensionShape const*> const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestRef> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestRef> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_generated_icechunk::ChunkIndexRange const*> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_generated_icechunk::ChunkIndexRange const*> const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestFileInfoV2> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ManifestFileInfoV2> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_generated_icechunk::ManifestFileInfo const*> const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_generated_icechunk::ManifestFileInfo const*> const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ArrayManifest> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ArrayManifest> > const*>(unsigned short) const
Unexecuted instantiation: gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ChunkRef> > const* gdal_flatbuffers::Table::GetPointer<gdal_flatbuffers::Vector<gdal_flatbuffers::Offset<gdal_generated_icechunk::ChunkRef> > const*>(unsigned short) const
59
60
0
  template<typename P> P GetStruct(voffset_t field) const {
61
0
    auto field_offset = GetOptionalFieldOffset(field);
62
0
    auto p = const_cast<uint8_t *>(data_ + field_offset);
63
0
    return field_offset ? reinterpret_cast<P>(p) : nullptr;
64
0
  }
Unexecuted instantiation: gdal_generated_icechunk::ObjectId12 const* gdal_flatbuffers::Table::GetStruct<gdal_generated_icechunk::ObjectId12 const*>(unsigned short) const
Unexecuted instantiation: gdal_generated_icechunk::ObjectId8 const* gdal_flatbuffers::Table::GetStruct<gdal_generated_icechunk::ObjectId8 const*>(unsigned short) const
65
66
  template<typename Raw, typename Face>
67
  flatbuffers::Optional<Face> GetOptional(voffset_t field) const {
68
    auto field_offset = GetOptionalFieldOffset(field);
69
    auto p = data_ + field_offset;
70
    return field_offset ? Optional<Face>(static_cast<Face>(ReadScalar<Raw>(p)))
71
                        : Optional<Face>();
72
  }
73
74
  template<typename T> bool SetField(voffset_t field, T val, T def) {
75
    auto field_offset = GetOptionalFieldOffset(field);
76
    if (!field_offset) return IsTheSameAs(val, def);
77
    WriteScalar(data_ + field_offset, val);
78
    return true;
79
  }
80
  template<typename T> bool SetField(voffset_t field, T val) {
81
    auto field_offset = GetOptionalFieldOffset(field);
82
    if (!field_offset) return false;
83
    WriteScalar(data_ + field_offset, val);
84
    return true;
85
  }
86
87
0
  bool SetPointer(voffset_t field, const uint8_t *val) {
88
0
    auto field_offset = GetOptionalFieldOffset(field);
89
0
    if (!field_offset) return false;
90
0
    WriteScalar(data_ + field_offset,
91
0
                static_cast<uoffset_t>(val - (data_ + field_offset)));
92
0
    return true;
93
0
  }
94
95
0
  uint8_t *GetAddressOf(voffset_t field) {
96
0
    auto field_offset = GetOptionalFieldOffset(field);
97
0
    return field_offset ? data_ + field_offset : nullptr;
98
0
  }
99
0
  const uint8_t *GetAddressOf(voffset_t field) const {
100
0
    return const_cast<Table *>(this)->GetAddressOf(field);
101
0
  }
102
103
0
  bool CheckField(voffset_t field) const {
104
0
    return GetOptionalFieldOffset(field) != 0;
105
0
  }
106
107
  // Verify the vtable of this table.
108
  // Call this once per table, followed by VerifyField once per field.
109
53.6k
  bool VerifyTableStart(Verifier &verifier) const {
110
53.6k
    return verifier.VerifyTableStart(data_);
111
53.6k
  }
112
113
  // Verify a particular field.
114
  template<typename T>
115
  bool VerifyField(const Verifier &verifier, voffset_t field,
116
210k
                   size_t align) const {
117
    // Calling GetOptionalFieldOffset should be safe now thanks to
118
    // VerifyTable().
119
210k
    auto field_offset = GetOptionalFieldOffset(field);
120
    // Check the actual field.
121
210k
    return !field_offset || verifier.VerifyField<T>(data_, field_offset, align);
122
210k
  }
bool gdal_flatbuffers::Table::VerifyField<unsigned char>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
Line
Count
Source
116
131k
                   size_t align) const {
117
    // Calling GetOptionalFieldOffset should be safe now thanks to
118
    // VerifyTable().
119
131k
    auto field_offset = GetOptionalFieldOffset(field);
120
    // Check the actual field.
121
131k
    return !field_offset || verifier.VerifyField<T>(data_, field_offset, align);
122
131k
  }
bool gdal_flatbuffers::Table::VerifyField<int>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
Line
Count
Source
116
47.3k
                   size_t align) const {
117
    // Calling GetOptionalFieldOffset should be safe now thanks to
118
    // VerifyTable().
119
47.3k
    auto field_offset = GetOptionalFieldOffset(field);
120
    // Check the actual field.
121
47.3k
    return !field_offset || verifier.VerifyField<T>(data_, field_offset, align);
122
47.3k
  }
bool gdal_flatbuffers::Table::VerifyField<unsigned long>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
Line
Count
Source
116
15.7k
                   size_t align) const {
117
    // Calling GetOptionalFieldOffset should be safe now thanks to
118
    // VerifyTable().
119
15.7k
    auto field_offset = GetOptionalFieldOffset(field);
120
    // Check the actual field.
121
15.7k
    return !field_offset || verifier.VerifyField<T>(data_, field_offset, align);
122
15.7k
  }
bool gdal_flatbuffers::Table::VerifyField<unsigned short>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
Line
Count
Source
116
15.7k
                   size_t align) const {
117
    // Calling GetOptionalFieldOffset should be safe now thanks to
118
    // VerifyTable().
119
15.7k
    auto field_offset = GetOptionalFieldOffset(field);
120
    // Check the actual field.
121
15.7k
    return !field_offset || verifier.VerifyField<T>(data_, field_offset, align);
122
15.7k
  }
Unexecuted instantiation: bool gdal_flatbuffers::Table::VerifyField<unsigned int>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
Unexecuted instantiation: bool gdal_flatbuffers::Table::VerifyField<gdal_generated_icechunk::ObjectId12>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
123
124
  // VerifyField for required fields.
125
  template<typename T>
126
  bool VerifyFieldRequired(const Verifier &verifier, voffset_t field,
127
0
                           size_t align) const {
128
0
    auto field_offset = GetOptionalFieldOffset(field);
129
0
    return verifier.Check(field_offset != 0) &&
130
0
           verifier.VerifyField<T>(data_, field_offset, align);
131
0
  }
Unexecuted instantiation: bool gdal_flatbuffers::Table::VerifyFieldRequired<gdal_generated_icechunk::ObjectId12>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
Unexecuted instantiation: bool gdal_flatbuffers::Table::VerifyFieldRequired<gdal_generated_icechunk::ObjectId8>(gdal_flatbuffers::Verifier const&, unsigned short, unsigned long) const
132
133
  // Versions for offsets.
134
280k
  bool VerifyOffset(const Verifier &verifier, voffset_t field) const {
135
280k
    auto field_offset = GetOptionalFieldOffset(field);
136
280k
    return !field_offset || verifier.VerifyOffset(data_, field_offset);
137
280k
  }
138
139
11.0k
  bool VerifyOffsetRequired(const Verifier &verifier, voffset_t field) const {
140
11.0k
    auto field_offset = GetOptionalFieldOffset(field);
141
11.0k
    return verifier.Check(field_offset != 0) &&
142
11.0k
           verifier.VerifyOffset(data_, field_offset);
143
11.0k
  }
144
145
 private:
146
  // private constructor & copy constructor: you obtain instances of this
147
  // class by pointing to existing data only
148
  Table();
149
  Table(const Table &other);
150
  Table &operator=(const Table &);
151
152
  uint8_t data_[1];
153
};
154
155
// This specialization allows avoiding warnings like:
156
// MSVC C4800: type: forcing value to bool 'true' or 'false'.
157
template<>
158
inline flatbuffers::Optional<bool> Table::GetOptional<uint8_t, bool>(
159
0
    voffset_t field) const {
160
0
  auto field_offset = GetOptionalFieldOffset(field);
161
0
  auto p = data_ + field_offset;
162
0
  return field_offset ? Optional<bool>(ReadScalar<uint8_t>(p) != 0)
163
0
                      : Optional<bool>();
164
0
}
165
166
}  // namespace flatbuffers
167
168
#endif  // FLATBUFFERS_TABLE_H_