ONE - On-device Neural Engine
Loading...
Searching...
No Matches
flex_flat_util.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 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_FLEX_FLAT_UTIL_H_
18#define FLATBUFFERS_FLEX_FLAT_UTIL_H_
19
22
23namespace flexbuffers {
24
25// Verifies the `nested` flexbuffer within a flatbuffer vector is valid.
27 const flatbuffers::Vector<uint8_t> *const nested,
28 flatbuffers::Verifier &verifier) {
29 if (!nested) return true;
30 return verifier.Check(flexbuffers::VerifyBuffer(
31 nested->data(), nested->size(), verifier.GetFlexReuseTracker()));
32}
33
34} // namespace flexbuffers
35
36#endif // FLATBUFFERS_FLEX_FLAT_UTIL_H_
const T * data() const
Definition vector.h:260
SizeT size() const
Definition vector.h:164
bool VerifyBuffer(const uint8_t *buf, size_t buf_len, std::vector< uint8_t > *reuse_tracker=nullptr)
bool VerifyNestedFlexBuffer(const flatbuffers::Vector< uint8_t > *const nested, flatbuffers::Verifier &verifier)