1e5c31af7Sopenharmony_ci#ifndef _VKSCOMMON_HPP
2e5c31af7Sopenharmony_ci#define _VKSCOMMON_HPP
3e5c31af7Sopenharmony_ci
4e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
5e5c31af7Sopenharmony_ci * Vulkan CTS Framework
6e5c31af7Sopenharmony_ci * --------------------
7e5c31af7Sopenharmony_ci *
8e5c31af7Sopenharmony_ci * Copyright (c) 2021 The Khronos Group Inc.
9e5c31af7Sopenharmony_ci *
10e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
11e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
12e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
13e5c31af7Sopenharmony_ci *
14e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
15e5c31af7Sopenharmony_ci *
16e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
17e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
18e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
20e5c31af7Sopenharmony_ci * limitations under the License.
21e5c31af7Sopenharmony_ci *
22e5c31af7Sopenharmony_ci *-------------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include <deDefs.h>
25e5c31af7Sopenharmony_ci#include <string>
26e5c31af7Sopenharmony_ci#include <vector>
27e5c31af7Sopenharmony_ci#include <functional>
28e5c31af7Sopenharmony_ci#include <cassert>
29e5c31af7Sopenharmony_ci#include <stdexcept>
30e5c31af7Sopenharmony_ci#include <future>
31e5c31af7Sopenharmony_ci#include <algorithm>
32e5c31af7Sopenharmony_ci
33e5c31af7Sopenharmony_cinamespace vksc_server
34e5c31af7Sopenharmony_ci{
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ciusing msize = std::size_t;
37e5c31af7Sopenharmony_ci
38e5c31af7Sopenharmony_ciusing s32 = deInt32;
39e5c31af7Sopenharmony_ci
40e5c31af7Sopenharmony_ciusing u8  = deUint8;
41e5c31af7Sopenharmony_ciusing u16 = deUint16;
42e5c31af7Sopenharmony_ciusing u32 = deUint32;
43e5c31af7Sopenharmony_ciusing u64 = deUint64;
44e5c31af7Sopenharmony_ci
45e5c31af7Sopenharmony_ciusing std::string;
46e5c31af7Sopenharmony_ciusing std::vector;
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_citemplate <typename R>
49e5c31af7Sopenharmony_cibool is_ready (const std::future<R>& f)
50e5c31af7Sopenharmony_ci{
51e5c31af7Sopenharmony_ci	return f.wait_for(std::chrono::seconds(1)) == std::future_status::ready;
52e5c31af7Sopenharmony_ci}
53e5c31af7Sopenharmony_ci
54e5c31af7Sopenharmony_citemplate <typename T, typename PRED>
55e5c31af7Sopenharmony_civector<T>& remove_erase_if (vector<T>& on, PRED pred)
56e5c31af7Sopenharmony_ci{
57e5c31af7Sopenharmony_ci	on.erase( std::remove_if(on.begin(), on.end(), pred),  on.end() );
58e5c31af7Sopenharmony_ci	return on;
59e5c31af7Sopenharmony_ci}
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_ci}; // vksc_server
62e5c31af7Sopenharmony_ci
63e5c31af7Sopenharmony_ci#endif // _VKSCOMMON_HPP
64