Class Resource

Base Type

Derived Types

class Resource : public holoscan::Component

Base class for all resources.

Resources such as system memory or a GPU memory pool that an Operator needs to perform its job. Resources are allocated during the initialization phase of the application. This matches the semantics of GXF’s Memory Allocator or any other components derived from the Component class in GXF.

Subclassed by holoscan::Endpoint, holoscan::gxf::GXFResource

Public Types

enum class ResourceType

Resource type used for the initialization of the resource.

Values:

enumerator kNative
enumerator kGXF

Public Functions

Resource() = default
Resource(Resource&&) = default
template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<Resource, std::decay_t<ArgT>> && (std::is_same_v<Arg, std::decay_t<ArgT>> || std::is_same_v<ArgList, std::decay_t<ArgT>>)>>
inline explicit Resource(ArgT &&arg, ArgsT&&... args)

Construct a new Resource object.

Parameters
~Resource() override = default
inline ResourceType resource_type() const

Get the resource type.

Returns
inline Resource &name(const std::string &name) &

Set the name of the resource.

Parameters
Returns
inline Resource &&name(const std::string &name) &&

Set the name of the resource.

Parameters
Returns
inline Resource &fragment(Fragment *fragment)

Set the fragment of the resource.

Parameters
Returns
inline Resource &spec(const std::shared_ptr<ComponentSpec> &spec)

Set the component specification to the resource.

Parameters
Returns
inline ComponentSpec *spec()

Get the component specification of the resource.

Returns
inline std::shared_ptr<ComponentSpec> spec_shared()

Get the shared pointer to the component spec.

Returns
inline virtual void setup(ComponentSpec &spec)

Define the resource specification.

Parameters
virtual void initialize() override
virtual YAML::Node to_yaml_node() const override

Get a YAML representation of the resource.

Returns

Protected Attributes

ResourceType resource_type_ = ResourceType::kNative
bool is_initialized_ = false

Friends

friend class holoscan::NetworkContext
friend class holoscan::Scheduler
friend class holoscan::Operator

Previous Class Receiver
Next Class RuntimeError
© Copyright 2022-2024, NVIDIA. Last updated on Apr 23, 2024.