2 * Copyright (c) 2017-2021 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @author Lukasz Kostyra (l.kostyra@samsung.com)
19 * @brief TeecManager singleton class declaration
22 #ifndef LIBTEEC_TEEC_MANAGER_H_
23 #define LIBTEEC_TEEC_MANAGER_H_
25 #include <unordered_map>
31 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
32 #include <tee_client_api.h>
34 #include "TeecContext.h"
40 using TeecContextMap = std::unordered_map<std::string, TeecContextPtr>;
41 using TeecOperationMap = std::unordered_map<uint32_t, TEEC_Operation>;
43 class TeecManager final
46 static TeecManager& Instance();
48 TeecContextPtr GetContext(const std::string& contextName);
50 uint32_t CreateOperation();
51 TEEC_Operation GetOperation(uint32_t id) const;
52 void RemoveOperation(uint32_t id);
55 TeecManager() = default;
56 ~TeecManager() = default;
57 TeecManager(const TeecManager&) = delete;
58 TeecManager(TeecManager&&) = delete;
59 TeecManager& operator=(const TeecManager&) = delete;
60 TeecManager& operator=(TeecManager&&) = delete;
62 TeecContextMap mContexts;
63 TeecOperationMap mOperations;
64 mutable std::mutex mOperationListMutex;
67 } // namespace libteec
68 } // namespace extension
70 #endif // LIBTEEC_TEEC_MANAGER_H_