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

`#include <dpf_api.h>`

Inheritance diagram for ansys::dpf::DataTree:

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

## Public Member Functions

| Type | Name |
| - | - |
| | [DataTree](#a1c47166bd00e9a3168a9f045f6de1e0e) ([Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1Client.md) const \*const client) |
| | **DataTree** ([DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) const &) |
| | **DataTree** ([DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) &&) noexcept |
| [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) & | **operator=** ([DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) const &) |
| [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) & | **operator=** ([DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) &&) noexcept |
| void | [fillFromJson](#a3772c0ff3572c7f84c4c05502e425d08) (std::istream const \&stream) const |
| void | [fillFromTxt](#a64415f0ebdf85080a7c413edc24114d2) (std::istream const \&stream) const |
| void | [writeToTxt](#a2f6cbbcca9c04de9a5d1821ab1f85d38) (std::ostream \&stream) const |
| void | [writeToJson](#a3fc23d000373acf82b7be9d9689ff957) (std::ostream \&stream) const |
| std::vector\< std::string > | [getAvailableAttributeNames](#a387ca479f3cfbc9108525f61b7572302) () const |
| std::vector\< std::string > | [getAvailableSubTreeNames](#a2cf094e8fce213c47869123396bac585) () const |
| const [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) | [getSubByName](#a5c2cf876663f094d2fd3f54c7975a111) (std::string const \&name) const |
| int | [getIntAttribute](#a46a3776bd7cf77093a45e314d172f680) (std::string const \&name) const |
| bool | [getBoolAttribute](#af98385ef4774e32f1b35ff51875504f1) (std::string const \&name) const |
| unsigned int | [getUnsignedIntAttribute](#aeaf30fcfd9747d81e734f06220f86da1) (std::string const \&name) const |
| double | [getDoubleAttribute](#a880be298bf672cb260e363dfbedf11ab) (std::string const \&name) const |
| std::string | [getStringAttribute](#aa574aae0a2da672daefcb46b06557f00) (std::string const \&name) const |
| std::vector\< int > | [getVectIntAttribute](#a4f338286ecc048c1072d9ba901d84fec) (std::string const \&name) const |
| std::vector\< double > | [getVectDoubleAttribute](#a4254b2eb4e8e198e7a5a37a5aacd5337) (std::string const \&name) const |
| std::vector\< std::string > | [getVectStringAttribute](#a35917cb2bc740594ed3dbfb6d6f4b20a) (std::string const \&name) const |
| void | [makeIntAttribute](#a00f7067a548e3ca2dc21ac63bf1f4e13) (std::string const \&name, int value) |
| void | [makeBoolAttribute](#a12d088c2d4aecb4d7ad4e28b400cd9c1) (std::string const \&name, bool value) |
| void | [makeUnsignedIntAttribute](#ae4120d3564517f8481feddb749940e32) (std::string const \&name, unsigned int value) |
| void | [makeDoubleAttribute](#aa2d8b58119590de684d399072435b565) (std::string const \&name, double value) |
| void | [makeStringAttribute](#a82714e5e01a67de376d2e0e53bb1e126) (std::string const \&name, std::string const \&value) |
| void | [makeVectIntAttribute](#a40c87dbd75b43d54a01f6a2326952a50) (std::string const \&name, std::vector\< int > const \&value) |
| void | [makeVectDoubleAttribute](#a13ea47ce80b84b62943ae7048d119484) (std::string const \&name, std::vector\< double > const \&value) |
| void | [makeVectStringAttribute](#aa03b920ab02e60829acc9587f9bf51fc) (std::string const \&name, std::vector\< std::string > const \&value) |
| [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) | [makeSub](#aa18973ec995c9088d1d6abb65c7660ff) (std::string const \&name) |
|  void | **makeSubTreeAttribute** (std::string const \&name, [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) const \*const sub\_tree) |
| bool | [hasAttribute](#a3422a0cbc6d69c9dd91ea7a5cb5869bb) (std::string const \&attribute\_name) const |
| bool | [hasSub](#a6d1859fee7564672cbf1a85d9d8bb492) (std::string const \&attribute\_name) const |

> [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 [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md) | [emptyDataTree](#afb0171dc88164d841e4d8d1d14c8dc92) () |

## Detailed Description

Define a DOM (Document-Object-Model) tree.

## Constructor & Destructor Documentation

### DataTree()

```cpp theme={null}
ansys::dpf::DataTree::DataTree(Client const *const 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) instance designating the IP, port and protocol to use. |

## Member Function Documentation

### emptyDataTree()

```cpp theme={null}
static DataTree ansys::dpf::DataTree::emptyDataTree()
```

`static`

Create an empty [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md).

**Returns**

Empty [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DataTree.md).

### fillFromJson()

```cpp theme={null}
void ansys::dpf::DataTree::fillFromJson(std::istream const & stream) const
```

Fill this data tree with the content of a json file generated by another tree (See [DataTree::writeToJson](#a3fc23d000373acf82b7be9d9689ff957)).

### fillFromTxt()

```cpp theme={null}
void ansys::dpf::DataTree::fillFromTxt(std::istream const & stream) const
```

Fill this data tree with the content of a txt file generated by another tree (See [DataTree::writeToTxt](#a2f6cbbcca9c04de9a5d1821ab1f85d38)).

### getAvailableAttributeNames()

```cpp theme={null}
std::vector< std::string > ansys::dpf::DataTree::getAvailableAttributeNames() const
```

**Returns**

the list of attributes names available (without recursivity in the subtrees).

### getAvailableSubTreeNames()

```cpp theme={null}
std::vector< std::string > ansys::dpf::DataTree::getAvailableSubTreeNames() const
```

**Returns**

the list of first rank substree names available (without recursivity in the subtrees).

### getBoolAttribute()

```cpp theme={null}
bool ansys::dpf::DataTree::getBoolAttribute(std::string const & name) const
```

**Returns**

an attribute by its name.

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist. |

### getDoubleAttribute()

```cpp theme={null}
double ansys::dpf::DataTree::getDoubleAttribute(std::string const & name) const
```

**Returns**

an attribute by its name.

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist. |

### getIntAttribute()

```cpp theme={null}
int ansys::dpf::DataTree::getIntAttribute(std::string const & name) const
```

**Returns**

an attribute by its name.

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist. |

### getStringAttribute()

```cpp theme={null}
std::string ansys::dpf::DataTree::getStringAttribute(std::string const & name) const
```

**Returns**

an attribute by its name.

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist. |

### getSubByName()

```cpp theme={null}
const DataTree ansys::dpf::DataTree::getSubByName(std::string const & name) const
```

**Returns**

a subtree by its name (return an empty substree if it doesn't exist).

### getUnsignedIntAttribute()

```cpp theme={null}
unsigned int ansys::dpf::DataTree::getUnsignedIntAttribute(std::string const & name) const
```

**Returns**

an attribute by its name.

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist. |

### getVectDoubleAttribute()

```cpp theme={null}
std::vector< double > ansys::dpf::DataTree::getVectDoubleAttribute(
    std::string const & name
) const
```

**Returns**

an attribute by its name.

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist. |

### getVectIntAttribute()

```cpp theme={null}
std::vector< int > ansys::dpf::DataTree::getVectIntAttribute(std::string const & name) const
```

**Returns**

an attribute by its name

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist |

### getVectStringAttribute()

```cpp theme={null}
std::vector< std::string > ansys::dpf::DataTree::getVectStringAttribute(
    std::string const & name
) const
```

**Returns**

an attribute by its name.

**Exceptions**

| Name | Description |
| - | - |
| [DpfException](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/2025-r1/classansys_1_1dpf_1_1DpfException.md) | if the attribute doesn't exist. |

### hasAttribute()

```cpp theme={null}
bool ansys::dpf::DataTree::hasAttribute(std::string const & attribute_name) const
```

**Returns**

true if an attribute exists (accepts sub attributes by adding "/", example attribute\_name="sub\_name/attrib\_name").

### hasSub()

```cpp theme={null}
bool ansys::dpf::DataTree::hasSub(std::string const & attribute_name) const
```

**Returns**

true if a subtree exists.

### makeBoolAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeBoolAttribute(
    std::string const & name,
    bool value
)
```

create or replace an attribute.

### makeDoubleAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeDoubleAttribute(
    std::string const & name,
    double value
)
```

create or replace an attribute.

### makeIntAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeIntAttribute(
    std::string const & name,
    int value
)
```

create or replace an attribute.

### makeStringAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeStringAttribute(
    std::string const & name,
    std::string const & value
)
```

create or replace an attribute.

### makeSub()

```cpp theme={null}
DataTree ansys::dpf::DataTree::makeSub(std::string const & name)
```

create a subtree with a name. If the substree already exists, it is returned.

**Returns**

the created subtree to fill it.

### makeUnsignedIntAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeUnsignedIntAttribute(
    std::string const & name,
    unsigned int value
)
```

create or replace an attribute.

### makeVectDoubleAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeVectDoubleAttribute(
    std::string const & name,
    std::vector< double > const & value
)
```

create or replace an attribute.

### makeVectIntAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeVectIntAttribute(
    std::string const & name,
    std::vector< int > const & value
)
```

create or replace an attribute.

### makeVectStringAttribute()

```cpp theme={null}
void ansys::dpf::DataTree::makeVectStringAttribute(
    std::string const & name,
    std::vector< std::string > const & value
)
```

create or replace an attribute.

### writeToJson()

```cpp theme={null}
void ansys::dpf::DataTree::writeToJson(std::ostream & stream) const
```

Write the attributes and the subtrees of this data tree in a json like format in a c++ standard output stream (example: std::ofstream, std::ostringstream).

### writeToTxt()

```cpp theme={null}
void ansys::dpf::DataTree::writeToTxt(std::ostream & stream) const
```

Write the attributes and the subtrees of this data tree as text in a c++ standard output stream (example: std::ofstream, std::ostringstream).
