alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 1 | {# |
| 2 | Copyright (c) 2021 Arm Limited. All rights reserved. |
| 3 | SPDX-License-Identifier: Apache-2.0 |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | 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, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | #} |
| 17 | {{common_template_header}} |
| 18 | |
| 19 | #include "BufAttributes.hpp" |
| 20 | |
| 21 | #include <vector> |
| 22 | #include <string> |
| 23 | |
| 24 | {% for namespace in namespaces %} |
| 25 | namespace {{namespace}} { |
| 26 | {% endfor %} |
| 27 | |
| 28 | static const char * labelsVec[] LABELS_ATTRIBUTE = { |
| 29 | {% for label in labels %} |
| 30 | "{{label}}", |
| 31 | {% endfor %} |
| 32 | }; |
| 33 | |
| 34 | bool GetLabelsVector(std::vector<std::string>& labels) |
| 35 | { |
| 36 | constexpr size_t labelsSz = {{labelsSize}}; |
| 37 | labels.clear(); |
| 38 | |
| 39 | if (!labelsSz) { |
| 40 | return false; |
| 41 | } |
| 42 | |
| 43 | labels.reserve(labelsSz); |
| 44 | |
| 45 | for (size_t i = 0; i < labelsSz; ++i) { |
| 46 | labels.emplace_back(labelsVec[i]); |
| 47 | } |
| 48 | |
| 49 | return true; |
| 50 | } |
| 51 | |
| 52 | {% for namespace in namespaces %} |
| 53 | } /* namespace {{name_space}} */ |
| 54 | {% endfor %} |