2 * Copyright (c) 2024 EfficiOS, Inc.
4 * SPDX-License-Identifier: MIT
7 #ifndef BABELTRACE_CPP_COMMON_BT2_PLUGIN_LOAD_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_PLUGIN_LOAD_HPP
10 #include <babeltrace2/babeltrace.h>
12 #include "common/common.h"
13 #include "cpp-common/bt2c/c-string-view.hpp"
16 #include "plugin-set.hpp"
20 inline ConstPluginSet::Shared findAllPluginsFromDir(const bt2c::CStringView path,
21 const bool recurse, const bool failOnLoadError)
23 const bt_plugin_set *pluginSet;
25 switch (bt_plugin_find_all_from_dir(path, recurse, failOnLoadError, &pluginSet)) {
26 case BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK:
27 return ConstPluginSet::Shared::createWithoutRef(pluginSet);
28 case BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND:
29 return ConstPluginSet::Shared {};
30 case BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_MEMORY_ERROR:
32 case BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_ERROR:
41 #endif /* BABELTRACE_CPP_COMMON_BT2_PLUGIN_LOAD_HPP */