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))...
46 InternalApply<Args...>();
53 InternalRevoke<Args...>();
60 } catch (const DPL::Test::TestException &e) {
61 // This is bad. The rest of test will not work properly!
62 std::cerr << "Error during cleaning up environment. "
63 "The rest of test will probably fail." << e.GetMessage() << std::endl;
69 template <typename First>
70 void InternalApply() {
74 template <typename First, typename Second, typename... Rest>
75 void InternalApply() {
77 InternalApply<Second, Rest...>();
80 template <typename First>
81 void InternalRevoke() {
85 template <typename First, typename Second, typename... Rest>
86 void InternalRevoke() {
87 InternalRevoke<Second, Rest...>();
94 } // namespace ProcessSetings