{{! Copyright (c) Meta Platforms, Inc. and its affiliates. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. }}{{ > Autogen}} #pragma once #include #include "{{program:include_prefix}}{{program:name}}_types.h" namespace apache { namespace thrift { {{#program:enums}} template <> struct TEnumDataStorage<{{ > common/namespace_cpp2}}{{enum:cpp_name}}> { using type = {{ > common/namespace_cpp2}}{{enum:cpp_name}}; static constexpr const std::size_t size = {{enum:size}}; static constexpr std::array values = { { {{#enum:values}}{{! }} type::{{enum_value:cpp_name}}, {{/enum:values}} }}; static constexpr std::array names = { { {{#enum:values}}{{! }} "{{enum_value:name}}"sv, {{/enum:values}} }}; }; {{/program:enums}} {{#program:structs}} {{#struct:union?}} template <> struct TEnumDataStorage<{{struct:cpp_fullname}}::Type> { using type = {{struct:cpp_fullname}}::Type; static constexpr const std::size_t size = {{struct:num_union_members}}; static constexpr std::array values = { { {{#struct:fields}}{{! }} type::{{field:cpp_name}}, {{/struct:fields}} }}; static constexpr std::array names = { { {{#struct:fields}}{{! }} "{{field:name}}"sv, {{/struct:fields}} }}; }; {{/struct:union?}} {{/program:structs}} {{#program:structs}} template <> struct TStructDataStorage<{{struct:cpp_fullname}}> { static constexpr const std::size_t fields_size = {{struct:fields_size}}; static const std::string_view name; static const std::array fields_names; static const std::array fields_ids; static const std::array fields_types; private: // The following fields describe internal storage metadata, and are private to // prevent user logic from accessing them, but they can be inspected by // debuggers. static const std::array storage_names; // -1 if the field has no isset. static const std::array isset_indexes; }; {{/program:structs}} }} // apache::thrift