> This page is for version 3.0 (Latest) (default).
> For other versions, use one of these documentation indexes:
> - 3.0 (Latest) (default): https://docs.nvidia.com/holoscan/sensor-bridge/3-0/llms.txt
> - 2.7: https://docs.nvidia.com/holoscan/sensor-bridge/2-7/llms.txt
> - Archives: https://docs.nvidia.com/holoscan/sensor-bridge/archives/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sensor-bridge/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sensor-bridge/_mcp/server.

# hololink::module::Module

> Module encapsulates a set of services, normally associated with a specific HSB implementation.

`Module` encapsulates a set of services, normally associated with a specific HSB implementation.

The group of services for a specific `Module` are normally implemented in a single shared object file, but an application also provides a `Module` instance that encapsulates services that those loaded modules will use (e.g. Logging).

Applications hold a `std::shared_ptr<``Module``>` and pass it to the type-safe [`get_service`](#getservice) function of the interface they want (e.g. [`Service`](service)`<T>::`[`get_service`](#getservice)), which calls [Module::get_service](#getservice) and returns a correctly typed pointer.

A service returned from a `Module` remains valid for as long as the caller holds it, independent of how long the caller keeps the `Module` itself.

```cpp showLineNumbers={false}
#include <hololink/module/module.hpp>
```

**Inherits from:** `std::enable_shared_from_this< Module >` (public)

---

## Methods

### get_service \[#getservice]

```cpp showLineNumbers={false}
virtual std::shared_ptr<const void> hololink::module::Module::get_service(
    const char *instance_id,
    const char *type_id,
    bool allow_null = false
)
```

Look up a service by its untyped identifiers.

This is the untyped lookup that the type-safe [`get_service`](#getservice) functions are built on; applications always call those instead. If a service matching both identifiers is available, it is returned; repeated calls with the same identifiers may return the same instance. A service that has not been used before may be created by the module as part of the lookup.

**Returns:** The service, as a type-erased pointer to the object registered under `type_id`, or nullptr when it is not found and `allow_null` is `true`.

**Throws:** `std::runtime_error` if `instance_id` or `type_id` is null, or if the service is not found and `allow_null` is `false`.

**Parameters**

**`instance_id`** `const char *`

Names the specific service instance; its format is defined by the service type.

---

**`type_id`** `const char *`

Names the type of the service interface, corresponding with the 'type_id' member of a [Service](service) class (e.g. `"mipi_dphy.v1"`).

---

**`allow_null`** `bool` — default: false

If `false` (the default), a service that cannot be found causes a std::runtime_error to be thrown. If `true`, an empty pointer is returned instead.

---