> ## 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::StringField Class Reference

`#include <dpf_api.h>`

Inheritance diagram for ansys::dpf::StringField:

![](https://mintcdn.com/synopsys-00a47cbc/Srh1_f--TdKCLyqD/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.png?fit=max\&auto=format\&n=Srh1_f--TdKCLyqD\&q=85\&s=40a2f57589ec00397b287bccf67bd928)

## Public Member Functions

| Type | Name |
| - | - |
| | [StringField](#a6515537907890dc10ff89602c897a960) ([Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) const \*const client, [dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities=0, [dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) data\_size=0) |
| | [StringField](#a25f8ec9565065dd41156b707ecde16f2) (int id, [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) const \*const client) |
| | [StringField](#a89883fda363ca4d9447b12492fa2cea2) ([dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities=0, [dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) data\_size=0) |
| | **StringField** ([StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md) const &) |
| | **StringField** ([StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md) &&) noexcept |
| [StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md) & | **operator=** ([StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md) const &) |
| [StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md) & | **operator=** ([StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md) &&) noexcept |
| [Location](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/structansys_1_1dpf_1_1Location.md) | [location](#a36498c54c9f757124419a3bc56218339) () const |
| [Scoping](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Scoping.md) | [scoping](#aeeb9940f52222c264618d0788360300a) () const |
| [dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) | [dataSize](#aeba443e66b156da5c91910e924cb2e7f) () const |
| void | [push\_back](#a06eaa63c638cbe234067442096a3318a) ([dp\_id](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#ab4574c9af3f2bb8011da7d1f4c8da20e) entity\_id, std::vector\< std::string > const \&values) |
| void | [push\_back](#a9371a94961b517ac01791fff526a00d1) ([dp\_id](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#ab4574c9af3f2bb8011da7d1f4c8da20e) entity\_id, const std::string \*values, [dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) size) |
| void | [setData](#a75fe878c8660665182a13809d521aee8) (std::vector\< std::string > const &[data](#a4c6e1215a605ec027834fb45ae658fd7)) |
| void | [setScoping](#a0b6d8c1c684bc28745a7f7c274c9b49d) ([ansys::dpf::Scoping](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Scoping.md) \&s) |
| [DpfVector](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfVector.md)\< std::string > | [data](#a4c6e1215a605ec027834fb45ae658fd7) () const |
| void | [getData](#ae411e3f2e6c484b88ae6bb0388ab5126) (std::vector\< std::string > \&values\_to\_fill) const |
| void | [entityData](#ae4d965f29b0169db846487806a63f0ae) ([dp\_index](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a417548d1b705a9ba54ba9429afe68920) entity\_index, [DpfVector](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfVector.md)\< std::string > &[data](#a4c6e1215a605ec027834fb45ae658fd7)) const |
| void | [entityDataById](#a640dbd602194655feae974b6661a0864) ([dp\_id](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#ab4574c9af3f2bb8011da7d1f4c8da20e) entity\_id, [DpfVector](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfVector.md)\< std::string > &[data](#a4c6e1215a605ec027834fb45ae658fd7)) const |
| void | [reserve](#a87afeb83d4e137acc852fcc620ce232c) ([dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities, [dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) overall\_size=0) |
| void | [resize](#aec82d7162816699fa809d59547545b76) ([dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) number\_of\_entities, [dp\_int](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/namespaceansys_1_1dpf#a60d181a1f9d29cc7cc38b25dac4401f0) overall\_size) |

> [accordion] Public Member Functions inherited from ansys::dpf::DpfTypes
>
> Public Member Functions inherited from [ansys::dpf::DpfTypes](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md)
>
> | Type | Name |
> | - | - |
> | virtual bool | [empty](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#a39cd546c42518e2332be8f287db95459) () const |
> | virtual bool | [hasInternalObject](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#ae198f89868d85c7db6dc1a934a1d3c15) () const |
> | virtual std::string | [describe](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#a9977945710983bc03d2940fa007847b2) () const |
> | so::API const \* | [callAPI](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#aea34d37e0c080126eff70db34bf46597) () const |
> | bool | [isOnCommonAPI](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#a9f9789ff61cc9d400a2a344830706b73) () const |
> | bool | [getClient](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#a968afd9daa0b0f13b65a2ac61369d73a) ([Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) \&client) const |
> | bool | [hasBeenMovedLocally](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#a1a5634202c15404b6b24e8f50e51cb66) () const |
> | bool | [isSameObject](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md#aa64d5f8fcd7d85ad6ebf708494dbefd7) ([DpfTypes](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfTypes.md) const \&rhs) const |

## Static Public Member Functions

| Type | Name |
| - | - |
|  static [StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md) | **emptyStringField** () |

## Detailed Description

Holds string data describing a Property located on given entities (the [StringField](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1StringField.md)'s data is bounded with its scoping). Is the equivalent of the [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md) but with string values data (and not double values).

## Constructor & Destructor Documentation

### StringField() \[1/3]

```cpp theme={null}
ansys::dpf::StringField::StringField(
    Client const *const client,
    dp_int number_of_entities = 0,
    dp_int data_size = 0
)
```

Create an empty property field with a client.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | client | [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) to create the property field on. |
| \[in] | number\_of\_entities | Number of entities reserved. |
| \[in] | data\_size | Reserved size of data. |

### StringField() \[2/3]

```cpp theme={null}
ansys::dpf::StringField::StringField(
    int id,
    Client const *const client
)
```

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


**Parameters**

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

### StringField() \[3/3]

```cpp theme={null}
ansys::dpf::StringField::StringField(
    dp_int number_of_entities = 0,
    dp_int data_size = 0
)
```

Create a property with number of entities and data size.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | number\_of\_entities | Number of entities reserved. |
| \[in] | data\_size | Reserved size of data. |

## Member Function Documentation

### data()

```cpp theme={null}
DpfVector < std::string > ansys::dpf::StringField::data() const
```

**Returns**

[DpfVector](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfVector.md) of data array.

### dataSize()

```cpp theme={null}
dp_int ansys::dpf::StringField::dataSize() const
```

**Returns**

Size of the data container.

### entityData()

```cpp theme={null}
void ansys::dpf::StringField::entityData(
    dp_index entity_index,
    DpfVector < std::string > & data
) const
```

**Returns**

[DpfVector](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfVector.md) of data array of an entity, by index.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | entity\_index | Index of entity for which to get data. |
| \[out] | data | Pointer to the data. |

### entityDataById()

```cpp theme={null}
void ansys::dpf::StringField::entityDataById(
    dp_id entity_id,
    DpfVector < std::string > & data
) const
```

**Returns**

[DpfVector](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfVector.md) of data array of an entity, by id.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | entity\_id | Id of entity for which to get data. |
| \[out] | data | Pointer to the data. |

### getData()

```cpp theme={null}
void ansys::dpf::StringField::getData(std::vector< std::string > & values_to_fill) const
```

Get all data for property entities.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[out] | values\_to\_fill | Property entity data. |

### location()

```cpp theme={null}
Location ansys::dpf::StringField::location() const
```

**Returns**

[Location](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/structansys_1_1dpf_1_1Location.md) of the property.

### push\_back() \[1/2]

```cpp theme={null}
void ansys::dpf::StringField::push_back(
    dp_id entity_id,
    const std::string * values,
    dp_index size
)
```

Push back the entity data.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | entity\_id | Id of entity for which to push data. |
| \[in] | values | Vector of data for entity. |
| \[in] | size | Number of entities. |

### push\_back() \[2/2]

```cpp theme={null}
void ansys::dpf::StringField::push_back(
    dp_id entity_id,
    std::vector< std::string > const & values
)
```

Push back the entity data.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | entity\_id | Id of entity for which to push data. |
| \[in] | values | Vector of data for entity. |

### reserve()

```cpp theme={null}
void ansys::dpf::StringField::reserve(
    dp_int number_of_entities,
    dp_int overall_size = 0
)
```

Reserve the [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md). Only implemented for in process udage. To reserve the size for gRPC usage, use the constructor.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | number\_of\_entities | Number of entities. |
| \[in] | overall\_size | Total size of entity data. |

### resize()

```cpp theme={null}
void ansys::dpf::StringField::resize(
    dp_int number_of_entities,
    dp_int overall_size
)
```

Reserve the [Field](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Field.md).

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | number\_of\_entities | Number of entities. |
| \[in] | overall\_size | Total size of entity data. |

### scoping()

```cpp theme={null}
Scoping ansys::dpf::StringField::scoping() const
```

**Returns**

[Scoping](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Scoping.md) of the property.

### setData()

```cpp theme={null}
void ansys::dpf::StringField::setData(std::vector< std::string > const & data)
```

Set the data of the property field.

**Parameters**

| Direction | Name | Description |
| - | - | - |
| \[in] | data | Vector of data. |

### setScoping()

```cpp theme={null}
void ansys::dpf::StringField::setScoping(ansys::dpf::Scoping & s)
```

Set the scoping of the property field.
