> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# libuserd::LibUserd Class Reference

Part of [LibUserd](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/group__userd.md)

`#include <libuserd_interface.h>`

Inheritance diagram for libuserd::LibUserd:

![](https://mintcdn.com/synopsys-00a47cbc/Srh1_f--TdKCLyqD/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_lib_userd.png?fit=max\&auto=format\&n=Srh1_f--TdKCLyqD\&q=85\&s=efe745f4e50ddca1b73bfd9f5461c747)

## Public Member Functions

| Type | Name |
| - | - |
| ErrorCode | [set\_reader\_path](#aaa0ee8e3f6005ad1a1df4a61181a8408) (const std::string \&path) override set\_reader\_path |
| ErrorCode | [set\_message\_handler](#a67572dc4ae228b2a4a4f41e2324b9861) (ErrorProc, void \*userdata) override set\_message\_handler |
| ErrorCode | [initialize](#a45879b10fc6744a3828e49e139cb49bd) (int32\_t number\_of\_ranks=0) override initialize |
| size\_t | [get\_available\_reader\_count](#abc9b7f863123234d479f0cea920f1a7a) () override get\_available\_reader\_count |
| ErrorCode | [get\_all\_readers](#a05b8b7865b8533aed03258f9a1c72c8e) (std::vector\< IReaderInfo \* > \&info) override get\_all\_readers |
| ErrorCode | [query\_format](#a4b79f486dd05d6ca1b742b322994ddd5) (const std::string \&name1, const std::string \&name2, std::vector\< IReaderInfo \* > \&reader\_info) override query\_format |
| ErrorCode | [shutdown](#a2e5152aa6407bd82e08c5759aea37f32) () override shutdown |

## Static Public Member Functions

| Type | Name |
| - | - |
| static [LibUserd](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_lib_userd.md) \* | [library\_interface](#a99ef641c05ea827c864b5c3508992a5a) () library\_interface |
| static [Reader](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_reader.md) \* | [get\_active\_reader](#a73ee8a229d727fb13ebfa5471e5d640f) () get\_active\_reader |

## Friends

| Type | Name |
| - | - |
| class | [ReaderInfo](#a73671c5be9cbf13d42ff337755c2af76) |

## Detailed Description

[LibUserd](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_lib_userd.md) is the primary interface to the USERD library. All interaction starts at this object. One object instance exists in a process.

Definition at line [527](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/libuserd__interface_8h_source) of file [libuserd\_interface.h](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/libuserd__interface_8h_source).

## Member Function Documentation

### get\_active\_reader()

```cpp theme={null}
static Reader * libuserd::LibUserd::get_active_reader()
```

`static`

get\_active\_reader

Return the currently active reader if any.

**Returns**

[libuserd::Reader](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_reader.md)\* The currently active reader or nullptr if [ReaderInfo::read\_dataset](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_reader_info.md#a4075a3b737a9e328acd27290d6203c5e) has not been called.

### get\_all\_readers()

```cpp theme={null}
ErrorCode libuserd::LibUserd::get_all_readers(std::vector< IReaderInfo * > & info)
```

`override`

get\_all\_readers

Return a list of the readers that are available.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[out] | std::vector\<ReaderInfo> | & info |

**Returns**

ErrorCode

### get\_available\_reader\_count()

```cpp theme={null}
size_t libuserd::LibUserd::get_available_reader_count()
```

`override`

get\_available\_reader\_count

Return a count of the readers that are available.

**Returns**

size\_t Number of available readers

### initialize()

```cpp theme={null}
ErrorCode libuserd::LibUserd::initialize(int32_t number_of_ranks = 0)
```

`override`

initialize

This call initializes the libuserd system. It causes the library to scan for available readers and set up any required reduction engine bits. It can only be called once.

> [!NOTE]
>
> number\_of\_ranks is not currently implemented. It is used to specify the number of parallel servers to use to read the dataset. The values 0 and 1 both represent serial data access. Current code should use the value 0.

**Returns**

ErrorCode

### library\_interface()

```cpp theme={null}
static LibUserd * libuserd::LibUserd::library_interface()
```

`static`

library\_interface

Get the pointer to the library interface.

Note: [LibUserd](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_lib_userd.md) is a singleton and this function will return the existing instance or create a new instance.

**Returns**

[libuserd::LibUserd](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_lib_userd.md)\* The library interface

### query\_format()

```cpp theme={null}
ErrorCode libuserd::LibUserd::query_format(
    const std::string & name1,
    const std::string & name2,
    std::vector< IReaderInfo * > & reader_info
)
```

`override`

query\_format

For a given dataset (filename(s)), ask the readers if they should be able to read that data.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | const | std::string & name1 Primary input filename |
| \[in] | const | std::string & name2 Optional, secondary input filename |
| \[out] | std::vector\<ReaderInfo> | & reader\_info a list of readers that might be able to read the dataset |

**Returns**

ErrorCode

### set\_message\_handler()

```cpp theme={null}
ErrorCode libuserd::LibUserd::set_message_handler(
    ErrorProc,
    void * userdata
)
```

`override`

set\_message\_handler

Many readers can output diagnostic information. This function allows an application to intercept and handle that type of information.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | ErrorProc | The called supplied function to be called when output is generated |
| \[in] | void | \* userdata A user supplied pointer that is passed to the function. |

**Returns**

ErrorCode

### set\_reader\_path()

```cpp theme={null}
ErrorCode libuserd::LibUserd::set_reader_path(const std::string & path)
```

`override`

set\_reader\_path

By default, the library looks for reader shared libraries by looking for Ansys distributions that align with the version number of the libuserd library. A user may override this search path using this function.

Note: This function must be called before [initialize()](#a45879b10fc6744a3828e49e139cb49bd) is called and once intialize() has been called, this method will return

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | const | std::string & path |

**Returns**

ErrorCode returns IGNORED\_AFTER\_INITIALIZE if called after [initialize()](#a45879b10fc6744a3828e49e139cb49bd)

### shutdown()

```cpp theme={null}
ErrorCode libuserd::LibUserd::shutdown()
```

`override`

shutdown

Shutdown the libuserd library, stopping any active reader and any reduction engine. Once this is called, the [LibUserd](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/classlibuserd_1_1_lib_userd.md) interface can no longer be used in the current process.

**Returns**

ErrorCode

## Friends And Related Symbol Documentation

### ReaderInfo

```cpp theme={null}
friend class ReaderInfo
```

`friend`

Definition at line [648](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/libuserd__interface_8h_source) of file [libuserd\_interface.h](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/libuserd__interface_8h_source).

The documentation for this class was generated from the following file:

* D:/ANSYSDev/Product-src/ensight/server/userd/include/[libuserd\_interface.h](https://developer.synopsys.com/docs/ensight/ensight-apis/2025-r2/libuserd__interface_8h_source)
