blob: b5fb90224f3d7200fb712c16c9a551550733d8a2 [file] [log] [blame]
Matthew Barth0620be72021-04-14 13:31:12 -05001/**
2 * Copyright © 2021 IBM Corporation
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#pragma once
17
18#include "action.hpp"
19#include "manager.hpp"
Matthew Barth93341e02021-04-14 13:56:28 -050020#include "timer.hpp"
Matthew Barth0620be72021-04-14 13:31:12 -050021
22#include <nlohmann/json.hpp>
23
24#include <functional>
25#include <map>
26#include <memory>
27#include <vector>
28
29namespace phosphor::fan::control::json::trigger
30{
31
32using json = nlohmann::json;
33
34// Trigger creation function
35using createTrigger =
36 std::function<void(const json&, const std::string&, Manager*,
37 std::vector<std::unique_ptr<ActionBase>>&)>;
38
39// Mapping of trigger class name to its creation function
Matthew Barth93341e02021-04-14 13:56:28 -050040static const std::map<std::string, createTrigger> triggers = {
41 {"timer", timer::triggerTimer}};
Matthew Barth0620be72021-04-14 13:31:12 -050042
43} // namespace phosphor::fan::control::json::trigger