Class DefaultFragmentService
Defined in File fragment_service.hpp
Base Type
public holoscan::FragmentService
(Class FragmentService)
-
class DefaultFragmentService : public holoscan::FragmentService
Default implementation of FragmentService for basic resource sharing.
DefaultFragmentService provides a straightforward implementation of the FragmentService interface. It manages a single Resource instance and provides type-safe access methods.
This class is designed to be used directly for simple resource sharing scenarios or as a base class for more specialized service implementations.
NoteThis class is non-copyable to prevent accidental duplication of the managed resource. Move operations are supported to allow transfer of ownership.
Public Functions
-
DefaultFragmentService() = default
Construct a service managing the specified resource.
- Parameters
resource – The resource to be managed by this service.
-
~DefaultFragmentService() = default
-
DefaultFragmentService(const DefaultFragmentService&) = delete
-
DefaultFragmentService &operator=(const DefaultFragmentService&) = delete
-
DefaultFragmentService(DefaultFragmentService&&) = default
-
DefaultFragmentService &operator=(DefaultFragmentService&&) = default
Get the resource cast to a specific type.
This templated method provides type-safe access to the managed resource. It attempts to cast the resource to the requested type using dynamic_pointer_cast.
- Template Parameters
ResourceT – The type to cast the resource to. Must be derived from Resource.
- Returns
Shared pointer to the resource cast to ResourceT, or nullptr if the cast fails.
-
inline virtual std::shared_ptr<Resource> resource() const override
Get the underlying resource without type casting.
- Returns
Shared pointer to the managed resource.
Set the underlying resource.
- Parameters
resource – The resource to be managed by this service.
Protected Attributes
-
std::shared_ptr<Resource> resource_
The managed resource instance.
Friends
- friend class Fragment
-
DefaultFragmentService() = default