> ## 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.

# ansys::dpf::Collection< DataT > Class Template Reference

`#include <dpf_api.h>`

Inherits ansys::dpf::CollectionBase.

## Public Member Functions

| Type | Name |
| - | - |
| | **Collection** ([Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md)\< DataT > const &) |
| | **Collection** ([Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md)\< DataT > &&) noexcept |
| | [Collection](#ac50cf5a210cd3d391525a18c3abefca3) (std::vector\< std::string > const &[labels](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/structansys_1_1dpf_1_1labels.md)) |
| | [Collection](#ad86df2fa4903a8891826f44b195dc344) ([Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Client.md) const \*const client) |
| | [Collection](#acbbfa8b0684530e727c378eeb5c8d46f) ([Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Client.md) const \*const client, std::vector\< std::string > const &[labels](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/structansys_1_1dpf_1_1labels.md)) |
| | [Collection](#a37fdf6aad0fc6b3ebcb39c1a03f78429) (int id, [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Client.md) const \*const client) |
| [Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md) & | **operator=** ([Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md)\< DataT > const &) |
| [Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md) & | **operator=** ([Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md)\< DataT > &&) noexcept |
| DataT | [operator\[\]](#a65acae9c8be4c94b19a82c28ae4419f7) ([dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) index) |
| DataT | [at](#ad69525d9782d30f290d3f250576aa3d1) ([dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) index) |
| const DataT | [at](#ab5a9fa1e466cf9e36ae26d5419768c6d) ([dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) index) const |
| void | [update](#a2ee31954dd991137fe535f3a3b3ffeed) (DataT \&f, [dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) index) |
| void | [add](#afc36f19a39c1909d695f80ff22e0eeb0) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1LabelSpace.md) const &[labels](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/structansys_1_1dpf_1_1labels.md), DataT const \&f, bool can\_replace=true) |
| std::vector\< DataT > | [getEntries](#a04b6d0e9e544f69be27dcfc3c79d5537) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1LabelSpace.md) const \&label\_space) const |
| DataT | [getEntry](#a6dea8d438075e38470c4b9a46ca9ec07) ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1LabelSpace.md) const \&label\_space) const |
|  std::vector\< [dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) > | **getEntriesIndices** ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1LabelSpace.md) const \&lab\_space) const |
| [Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md)\< DataT > | **createSubCollection** ([LabelSpace](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1LabelSpace.md) const \&lab\_space) const create a [Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md) with all the entries corresponding to the label space in input |

## Static Public Member Functions

| Type | Name |
| - | - |
| static [Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md)\< DataT > | [emptyCollection](#a545436af4a3a2c404796ab128ad06890) () |

## Detailed Description

template\<typename DataT>\
&#x20;class ansys::dpf::Collection\< DataT >

Contains a group of entries of same type. The AnyCollection is designed as a set of entries ordered through labels and ids. Labels identify how the entries are filtered.

**See also**

[Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md)

## Constructor & Destructor Documentation

### Collection() \[1/4]

```cpp theme={null}
template<typename DataT >
ansys::dpf::Collection < DataT >:: Collection(std::vector< std::string > const & labels)
```

Create container for a group of entries with the given labels.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | labels | Labels for group of entries. |

### Collection() \[2/4]

```cpp theme={null}
template<typename DataT >
ansys::dpf::Collection < DataT >:: Collection(Client const *const client)
```

Create a new collection on a server.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Client.md) instance designating the IP, port and protocol to use. |

### Collection() \[3/4]

```cpp theme={null}
template<typename DataT >
ansys::dpf::Collection < DataT >:: Collection(
    Client const *const client,
    std::vector< std::string > const & labels
)
```

Create a collection with the given labels on a server.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Client.md) instance designating the IP, port and protocol to use. |
| \[in] | labels | Labels for meshes. |

### Collection() \[4/4]

```cpp theme={null}
template<typename DataT >
ansys::dpf::Collection < DataT >:: Collection(
    int id,
    Client const *const client
)
```

Retrieve an existing instance of [Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md) on a server. \


**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | id | Id of the [Collection](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Collection.md) object on the server's database. |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Client.md) instance designating the IP, port and protocol to use. |

## Member Function Documentation

### add()

```cpp theme={null}
template<typename DataT >
void ansys::dpf::Collection < DataT >::add(
    LabelSpace const & labels,
    DataT const & f,
    bool can_replace = true
)
```

Add [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) with given label space.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | labels | [Label](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/structansys_1_1dpf_1_1Label.md) space for [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md). |
| \[in] | f | [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) to add. |
| \[in] | can\_replace | if can\_replace is false, then, the entity is pushed back without checking if the label space already exists, available starting with 2024R2. |

### at() \[1/2]

```cpp theme={null}
template<typename DataT >
DataT ansys::dpf::Collection < DataT >::at(dp_index index)
```

**Returns**

DataT for given index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | index | Index of [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) to get. |

### at() \[2/2]

```cpp theme={null}
template<typename DataT >
const DataT ansys::dpf::Collection < DataT >::at(dp_index index) const
```

**Returns**

DataT for given index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | index | Index of [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) to get. |

### emptyCollection()

```cpp theme={null}
template<typename DataT >
Collection < DataT > ansys::dpf::Collection < DataT >::emptyCollection
```

`static`

Create an empty container.

**Returns**

Empty container.

### getEntries()

```cpp theme={null}
template<typename DataT >
std::vector< DataT > ansys::dpf::Collection < DataT >::getEntries(
    LabelSpace const & label_space
) const
```

**Returns**

Vector of entries for given label space.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | label\_space | [Label](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/structansys_1_1dpf_1_1Label.md) space for which to get entries. |

### getEntry()

```cpp theme={null}
template<typename DataT >
DataT ansys::dpf::Collection < DataT >::getEntry(LabelSpace const & label_space) const
```

**Returns**

First [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) for given label space.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | label\_space | [Label](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/structansys_1_1dpf_1_1Label.md) space for which to get [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md). |

### operator\[]\()

```cpp theme={null}
template<typename DataT >
DataT ansys::dpf::Collection < DataT >::operator[](dp_int index)
```

**Returns**

[Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) for given index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | index | Index of entries within container. |

### update()

```cpp theme={null}
template<typename DataT >
void ansys::dpf::Collection < DataT >::update(
    DataT & f,
    dp_index index
)
```

Update a [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) at index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | f | New [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md). |
| \[in] | index | Index of [Any](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r2/classansys_1_1dpf_1_1Any.md) to update. |
