blob: 0966ee4d5441cf8ac8f6fd32408c46be9e29b40e [file] [log] [blame]
#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