Coverage Report

Created: 2025-10-27 06:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/flatbuffers/include/flatbuffers/struct.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_STRUCT_H_
18
#define FLATBUFFERS_STRUCT_H_
19
20
#include "flatbuffers/base.h"
21
22
namespace flatbuffers {
23
24
// "structs" are flat structures that do not have an offset table, thus
25
// always have all members present and do not support forwards/backwards
26
// compatible extensions.
27
28
class Struct FLATBUFFERS_FINAL_CLASS {
29
 public:
30
  template <typename T>
31
63.8k
  T GetField(uoffset_t o) const {
32
63.8k
    return ReadScalar<T>(&data_[o]);
33
63.8k
  }
unsigned char flatbuffers::Struct::GetField<unsigned char>(unsigned int) const
Line
Count
Source
31
3.46k
  T GetField(uoffset_t o) const {
32
3.46k
    return ReadScalar<T>(&data_[o]);
33
3.46k
  }
signed char flatbuffers::Struct::GetField<signed char>(unsigned int) const
Line
Count
Source
31
5.22k
  T GetField(uoffset_t o) const {
32
5.22k
    return ReadScalar<T>(&data_[o]);
33
5.22k
  }
short flatbuffers::Struct::GetField<short>(unsigned int) const
Line
Count
Source
31
5.22k
  T GetField(uoffset_t o) const {
32
5.22k
    return ReadScalar<T>(&data_[o]);
33
5.22k
  }
Unexecuted instantiation: unsigned short flatbuffers::Struct::GetField<unsigned short>(unsigned int) const
Unexecuted instantiation: int flatbuffers::Struct::GetField<int>(unsigned int) const
unsigned int flatbuffers::Struct::GetField<unsigned int>(unsigned int) const
Line
Count
Source
31
36.0k
  T GetField(uoffset_t o) const {
32
36.0k
    return ReadScalar<T>(&data_[o]);
33
36.0k
  }
Unexecuted instantiation: long flatbuffers::Struct::GetField<long>(unsigned int) const
Unexecuted instantiation: unsigned long flatbuffers::Struct::GetField<unsigned long>(unsigned int) const
float flatbuffers::Struct::GetField<float>(unsigned int) const
Line
Count
Source
31
10.3k
  T GetField(uoffset_t o) const {
32
10.3k
    return ReadScalar<T>(&data_[o]);
33
10.3k
  }
double flatbuffers::Struct::GetField<double>(unsigned int) const
Line
Count
Source
31
3.46k
  T GetField(uoffset_t o) const {
32
3.46k
    return ReadScalar<T>(&data_[o]);
33
3.46k
  }
34
35
  template <typename T>
36
3.46k
  T GetStruct(uoffset_t o) const {
37
3.46k
    return reinterpret_cast<T>(&data_[o]);
38
3.46k
  }
Unexecuted instantiation: flatbuffers::Struct const* flatbuffers::Struct::GetStruct<flatbuffers::Struct const*>(unsigned int) const
void const* flatbuffers::Struct::GetStruct<void const*>(unsigned int) const
Line
Count
Source
36
3.46k
  T GetStruct(uoffset_t o) const {
37
3.46k
    return reinterpret_cast<T>(&data_[o]);
38
3.46k
  }
39
40
0
  const uint8_t* GetAddressOf(uoffset_t o) const { return &data_[o]; }
41
0
  uint8_t* GetAddressOf(uoffset_t o) { return &data_[o]; }
42
43
 private:
44
  // private constructor & copy constructor: you obtain instances of this
45
  // class by pointing to existing data only
46
  Struct();
47
  Struct(const Struct&);
48
  Struct& operator=(const Struct&);
49
50
  uint8_t data_[1];
51
};
52
53
}  // namespace flatbuffers
54
55
#endif  // FLATBUFFERS_STRUCT_H_