Timur Iskhakov | 67753ea | 2017-09-09 11:43:04 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 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 ANDROID_HARDWARE_TESTS_TRIE_V1_0_TRIE_H |
| 18 | #define ANDROID_HARDWARE_TESTS_TRIE_V1_0_TRIE_H |
| 19 | |
| 20 | #include <android/hardware/tests/trie/1.0/ITrie.h> |
| 21 | #include <hidl/Status.h> |
| 22 | |
| 23 | #include <string> |
| 24 | |
| 25 | namespace android { |
| 26 | namespace hardware { |
| 27 | namespace tests { |
| 28 | namespace trie { |
| 29 | namespace V1_0 { |
| 30 | namespace implementation { |
| 31 | |
| 32 | using ::android::hardware::Return; |
| 33 | using ::android::hardware::Void; |
| 34 | using ::android::hardware::hidl_string; |
| 35 | using ::android::hardware::hidl_vec; |
| 36 | using ::android::hardware::tests::trie::V1_0::ITrie; |
| 37 | using ::android::hardware::tests::trie::V1_0::TrieNode; |
| 38 | |
| 39 | struct Trie : public ITrie { |
| 40 | // Methods from ::android::hardware::tests::trie::V1_0::ITrie follow. |
| 41 | virtual Return<void> newTrie(newTrie_cb _hidl_cb) override; |
| 42 | virtual Return<void> addStrings(const TrieNode& trie, const hidl_vec<hidl_string>& strings, |
| 43 | addStrings_cb _hidl_cb) override; |
| 44 | virtual Return<void> containsStrings(const TrieNode& trie, const hidl_vec<hidl_string>& strings, |
| 45 | containsStrings_cb _hidl_cb) override; |
| 46 | |
| 47 | private: |
| 48 | void addString(TrieNode* trieRoot, const std::string& str); |
| 49 | bool containsString(const TrieNode* trieRoot, const std::string& str); |
| 50 | }; |
| 51 | |
| 52 | extern "C" ITrie* HIDL_FETCH_ITrie(const char* name); |
| 53 | |
| 54 | } // namespace implementation |
| 55 | } // namespace V1_0 |
| 56 | } // namespace trie |
| 57 | } // namespace tests |
| 58 | } // namespace hardware |
| 59 | } // namespace android |
| 60 | |
| 61 | #endif // ANDROID_HARDWARE_TESTS_TRIE_V1_0_TRIE_H |