2 * Copyright (c) 2015 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 Bartlomiej Grzelewski (b.grzelewski@samsung.com)
27 #include <dpl/test/test_exception.h>
29 #include <process-settings/policy.h>
31 namespace ProcessSettings {
33 template <typename PolicyArg, typename... Args>
34 class Executor : public PolicyArg, public Args... {
36 template <typename... T>
38 : PolicyArg(std::forward<T>(t)...)
39 , Args(static_cast<Policy&>(*this))...
45 InternalApply<Args...>();
51 InternalRevoke<Args...>();
58 } catch (const DPL::Test::TestException &e) {
59 // This is bad. The rest of test will not work properly!
60 std::cerr << "Error during cleaning up environment. "
61 "The rest of test will probably fail." << e.GetMessage() << std::endl;
67 template <typename First>
68 void InternalApply() {
72 template <typename First, typename Second, typename... Rest>
73 void InternalApply() {
75 InternalApply<Second, Rest...>();
78 template <typename First>
79 void InternalRevoke() {
83 template <typename First, typename Second, typename... Rest>
84 void InternalRevoke() {
85 InternalRevoke<Second, Rest...>();
92 } // namespace ProcessSetings