blob: 0966ee4d5441cf8ac8f6fd32408c46be9e29b40e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#pragma once
#include <utility>
#include <memory>
#include "utils.hpp"
namespace phosphor
{
namespace inventory
{
namespace manager
{
class Manager;
namespace details
{
using ActionBase = holder::CallableBase<void, Manager&>;
using ActionBasePtr = std::shared_ptr<ActionBase>;
template <typename T>
using Action = holder::CallableHolder<T, void, Manager&>;
/** @brief make_action
*
* Adapt an action function object.
*
* @param[in] action - The action being adapted.
* @returns - The adapted action.
*
* @tparam T - The type of the action being adapted.
*/
template <typename T>
auto make_action(T&& action)
{
return Action<T>::template make_shared<Action<T>>(
std::forward<T>(action));
}
} // namespace details
namespace actions
{
/** @brief The default action. */
inline void noop(Manager &mgr) noexcept { }
/** @brief Destroy an object action. */
inline auto destroyObject(const char *path)
{
return [path](auto &m){m.destroyObject(path);};
}
} // namespace actions
} // namespace manager
} // namespace inventory
} // namespace phosphor
// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|