MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
Provider.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Contributors to the Media eXchange Layer project.
2//
3// SPDX-License-Identifier: Apache-2.0
4
5#include "Provider.hpp"
6#include <map>
7#include <optional>
8#include "mxl/fabrics.h"
9
11{
12
13 static std::map<std::string_view, Provider> const providerStringMap = {
14 {"any", Provider::ANY },
15 {"tcp", Provider::TCP },
16 {"verbs", Provider::VERBS},
17 {"efa", Provider::EFA },
18 {"shm", Provider::SHM },
19 };
20
22 {
23 switch (provider)
24 {
30 }
31
33 }
34
35 std::optional<Provider> providerFromAPI(mxlFabricsProvider api) noexcept
36 {
37 switch (api)
38 {
44 }
45
46 return std::nullopt;
47 }
48
49 std::optional<Provider> providerFromString(std::string const& s) noexcept
50 {
51 auto it = providerStringMap.find(s);
52 if (it == providerStringMap.end())
53 {
54 return std::nullopt;
55 }
56
57 return it->second;
58 }
59}
enum mxlFabricsProvider_t mxlFabricsProvider
@ MXL_FABRICS_PROVIDER_VERBS
Definition fabrics.h:50
@ MXL_FABRICS_PROVIDER_ANY
Definition fabrics.h:48
@ MXL_FABRICS_PROVIDER_TCP
Definition fabrics.h:49
@ MXL_FABRICS_PROVIDER_SHM
Definition fabrics.h:52
@ MXL_FABRICS_PROVIDER_EFA
Definition fabrics.h:51
std::optional< Provider > providerFromString(std::string const &s) noexcept
Parse a provider name string, and return the enum value.
Definition Provider.cpp:49
static std::map< std::string_view, Provider > const providerStringMap
Definition Provider.cpp:13
std::optional< Provider > providerFromAPI(mxlFabricsProvider api) noexcept
Convert between external and internal versions of this type.
Definition Provider.cpp:35
Provider
Internal representation of supported libfabric providers.
Definition Provider.hpp:17
mxlFabricsProvider providerToAPI(Provider provider) noexcept
Convert between external and internal versions of this type.
Definition Provider.cpp:21