blob: c2ef40bb69a582433a3378cca39305cda0c34d38 [file] [log] [blame]
Timur Iskhakov67753ea2017-09-09 11:43:04 -07001/*
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
25namespace android {
26namespace hardware {
27namespace tests {
28namespace trie {
29namespace V1_0 {
30namespace implementation {
31
32using ::android::hardware::Return;
33using ::android::hardware::Void;
34using ::android::hardware::hidl_string;
35using ::android::hardware::hidl_vec;
36using ::android::hardware::tests::trie::V1_0::ITrie;
37using ::android::hardware::tests::trie::V1_0::TrieNode;
38
39struct 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
52extern "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