Class NetworkContext
Defined in File network_context.hpp
Base Type
public holoscan::Component
(Class Component)
Derived Type
public holoscan::gxf::GXFNetworkContext
(Class GXFNetworkContext)
-
class NetworkContext : public holoscan::Component
Base class for all network contexts.
This class is the base class for all network contexts (e.g.
holoscan::UcxContext
). It is used to define the common interface for all network contexts.Subclassed by holoscan::gxf::GXFNetworkContext
Public Functions
- NetworkContext() = default
- NetworkContext(NetworkContext&&) = default
-
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<NetworkContext, std::decay_t<ArgT>> && (std::is_same_v<Arg, std::decay_t<ArgT>> || std::is_same_v<ArgList, std::decay_t<ArgT>>)>>
inline explicit NetworkContext(ArgT &&arg, ArgsT&&... args)
Construct a new NetworkContext object.
- ~NetworkContext() override = default
-
inline NetworkContext &id(int64_t id)
Set the NetworkContext ID.
- Parameters
- Returns
id – The ID of the network context.
The reference to this network context.
-
inline NetworkContext &name(const std::string &name) &
Set the name of the network context.
- Parameters
- Returns
name – The name of the network context.
The reference to the network context.
-
inline NetworkContext &&name(const std::string &name) &&
Set the name of the network context.
- Parameters
- Returns
name – The name of the network context.
The reference to the network context.
-
inline NetworkContext &fragment(Fragment *fragment)
Set the fragment of the network context.
- Parameters
- Returns
fragment – The pointer to the fragment of the network context.
The reference to the network context.
Set the component specification to the network context.
- Parameters
- Returns
spec – The component specification.
The reference to the network context.
-
inline ComponentSpec *spec()
Get the component specification of the network context.
- Returns
The pointer to the component specification.
Get the shared pointer to the component spec.
- Returns
The shared pointer to the component spec.
Add a resource to the network context.
- Parameters
arg – The resource to add.
Add a resource to the network context.
- Parameters
arg – The resource to add.
-
inline std::unordered_map<std::string, std::shared_ptr<Resource>> &resources()
Get the resources of the network context.
- Returns
The resources of the network context.
-
inline virtual void setup(ComponentSpec &spec)
Define the network context specification.
- Parameters
spec – The reference to the component specification.
- virtual void initialize() override
Initialize the network context.
This function is called after the network context is created by holoscan::Fragment::make_network_context().
-
inline int64_t id() const
Get the identifier of the component.
By default, the identifier is set to -1. It is set to a valid value when the component is initialized.
With the default executor (GXFExecutor), the identifier is set to the GXF component ID.
- Returns
The identifier of the component.
-
inline void add_arg(const Arg &arg)
Add an argument to the component.
- Parameters
arg – The argument to add.
-
inline void add_arg(Arg &&arg)
Add an argument to the component.
- Parameters
arg – The argument to add.
-
inline void add_arg(const ArgList &arg)
Add a list of arguments to the component.
- Parameters
arg – The list of arguments to add.
-
inline void add_arg(ArgList &&arg)
Add a list of arguments to the component.
- Parameters
arg – The list of arguments to add.
Protected Attributes
- std::shared_ptr<ComponentSpec> spec_
The component specification.
- std::unordered_map<std::string, std::shared_ptr<Resource>> resources_
The resources used by the network context.