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

# Class ansys::dpf::DataTree

![][C++]
![][public]

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

**Inherits from**:

* [ansys::dpf::DpfTypes](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md)

## Members

* [callAPI](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1aea34d37e0c080126eff70db34bf46597)
* [DataTree](#classansys-dpf-datatree-1a714aa51770a0ae1efb1ddd2235a5820b)
* [DataTree](#classansys-dpf-datatree-1a1c47166bd00e9a3168a9f045f6de1e0e)
* [DataTree](#classansys-dpf-datatree-1a45794f55475843de36a620e6bf8a24a6)
* [DataTree](#classansys-dpf-datatree-1ac1f6ad1c7025ca6ac20082a530e9dd06)
* [deep\_copy](#classansys-dpf-datatree-1a746e4dbff0a937ee9c71564d6674987a)
* [describe](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a9977945710983bc03d2940fa007847b2)
* [empty](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a39cd546c42518e2332be8f287db95459)
* [emptyDataTree](#classansys-dpf-datatree-1afb0171dc88164d841e4d8d1d14c8dc92)
* [fillFromJson](#classansys-dpf-datatree-1a3772c0ff3572c7f84c4c05502e425d08)
* [fillFromTxt](#classansys-dpf-datatree-1a64415f0ebdf85080a7c413edc24114d2)
* [getAvailableAttributeNames](#classansys-dpf-datatree-1a387ca479f3cfbc9108525f61b7572302)
* [getAvailableSubTreeNames](#classansys-dpf-datatree-1a2cf094e8fce213c47869123396bac585)
* [getBoolAttribute](#classansys-dpf-datatree-1a41c18162d9ba5e12d81b2a5f85d7466d)
* [getClient](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a968afd9daa0b0f13b65a2ac61369d73a)
* [getDoubleAttribute](#classansys-dpf-datatree-1a266762d4a1dfcd0a6f939a4107226fca)
* [getIntAttribute](#classansys-dpf-datatree-1aafba734273a1af1c2fd85194e05231c1)
* [getStringAttribute](#classansys-dpf-datatree-1ab465ed6523a35c0ebc9483252aea6840)
* [getSubByName](#classansys-dpf-datatree-1a5c2cf876663f094d2fd3f54c7975a111)
* [getUnsignedIntAttribute](#classansys-dpf-datatree-1a76fe3c29a72f34c67b8f3579df025dd4)
* [getVectDoubleAttribute](#classansys-dpf-datatree-1acf243a39659235e13f99dc528ee231e4)
* [getVectIntAttribute](#classansys-dpf-datatree-1ae5e9c8f83518bcb2435e9b5244c7e456)
* [getVectStringAttribute](#classansys-dpf-datatree-1af681fa5a409b85b8015af80b8d0f3bf5)
* [hasAttribute](#classansys-dpf-datatree-1a3422a0cbc6d69c9dd91ea7a5cb5869bb)
* [hasBeenMovedLocally](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a1a5634202c15404b6b24e8f50e51cb66)
* [hasInternalObject](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1ae198f89868d85c7db6dc1a934a1d3c15)
* [hasSub](#classansys-dpf-datatree-1a6d1859fee7564672cbf1a85d9d8bb492)
* [isOnCommonAPI](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1a9f9789ff61cc9d400a2a344830706b73)
* [isSameObject](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1aa64d5f8fcd7d85ad6ebf708494dbefd7)
* [makeBoolAttribute](#classansys-dpf-datatree-1a12d088c2d4aecb4d7ad4e28b400cd9c1)
* [makeDoubleAttribute](#classansys-dpf-datatree-1aa2d8b58119590de684d399072435b565)
* [makeIntAttribute](#classansys-dpf-datatree-1a00f7067a548e3ca2dc21ac63bf1f4e13)
* [makeStringAttribute](#classansys-dpf-datatree-1a82714e5e01a67de376d2e0e53bb1e126)
* [makeSub](#classansys-dpf-datatree-1aa18973ec995c9088d1d6abb65c7660ff)
* [makeSubTreeAttribute](#classansys-dpf-datatree-1a09a963609da9eb0092bf1d8658def177)
* [makeUnsignedIntAttribute](#classansys-dpf-datatree-1ae4120d3564517f8481feddb749940e32)
* [makeVectDoubleAttribute](#classansys-dpf-datatree-1a13ea47ce80b84b62943ae7048d119484)
* [makeVectIntAttribute](#classansys-dpf-datatree-1a40c87dbd75b43d54a01f6a2326952a50)
* [makeVectStringAttribute](#classansys-dpf-datatree-1aa03b920ab02e60829acc9587f9bf51fc)
* [operator=](#classansys-dpf-datatree-1a859b20aa1351b9551e1e0cf9e6350fd1)
* [operator=](#classansys-dpf-datatree-1afda6bb8faac2ce7a833928bd0a740739)
* [tryGetBoolAttribute](#classansys-dpf-datatree-1adbd30bd4c40e71abe1cbecf49023c0ab)
* [tryGetDoubleAttribute](#classansys-dpf-datatree-1a4cc6693778f3db06b93e51a398c3e716)
* [tryGetIntAttribute](#classansys-dpf-datatree-1a3e62c3b70df697e040677884529f501e)
* [tryGetStringAttribute](#classansys-dpf-datatree-1a15e1d291c77b1220d1a1df12320e2aa7)
* [tryGetUnsignedIntAttribute](#classansys-dpf-datatree-1a682e61166e908af29bfca74d9c2c0aa6)
* [tryGetVectDoubleAttribute](#classansys-dpf-datatree-1ae9e204844851300d1613bf1fc8ed33fc)
* [tryGetVectIntAttribute](#classansys-dpf-datatree-1ac81aeefaca719783f1b79e41dc5a3e68)
* [tryGetVectStringAttribute](#classansys-dpf-datatree-1a677df71a1a093b48bdad8dccf575ce15)
* [writeToJson](#classansys-dpf-datatree-1a3fc23d000373acf82b7be9d9689ff957)
* [writeToTxt](#classansys-dpf-datatree-1a2f6cbbcca9c04de9a5d1821ab1f85d38)
* [\~DataTree](#classansys-dpf-datatree-1ab23976ff8a55c6f97d5b0ad82aea1ee1)
* [\~DpfTypes](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-dpftypes.md#classansys-dpf-dpftypes-1ab7c83b6ea160c2b115e056f6c312112f)

## Friends

## Public functions

### Function DataTree

![][public]

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

**Return type**:

### Function DataTree

![][public]

```cpp theme={null}
ansys::dpf::DataTree::DataTree(Client const *const client)
```

**Parameters**:

* [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-client.md) const \*const **client**: \[in] [Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-client.md) instance designating the IP, port and protocol to use.

**Return type**:

### Function \~DataTree

![][public]

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

**Return type**:

### Function DataTree

![][public]

```cpp theme={null}
ansys::dpf::DataTree::DataTree(DataTree const &)
```

**Parameters**:

* DataTree const &

**Return type**:

### Function DataTree

![][public]

```cpp theme={null}
ansys::dpf::DataTree::DataTree(DataTree &&) noexcept
```

**Parameters**:

* DataTree &&

**Return type**:

### Function operator=

![][public]

```cpp theme={null}
DataTree & ansys::dpf::DataTree::operator=(DataTree const &)
```

**Parameters**:

* DataTree const &

**Return type**: DataTree &

### Function operator=

![][public]

```cpp theme={null}
DataTree & ansys::dpf::DataTree::operator=(DataTree &&) noexcept
```

**Parameters**:

* DataTree &&

**Return type**: DataTree &

### Function fillFromJson

![][public]
![][const]

```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](#classansys-dpf-datatree-1a3fc23d000373acf82b7be9d9689ff957)).

**Parameters**:

* std::istream const & **stream**

**Return type**: void

### Function fillFromTxt

![][public]
![][const]

```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](#classansys-dpf-datatree-1a2f6cbbcca9c04de9a5d1821ab1f85d38)).

**Parameters**:

* std::istream const & **stream**

**Return type**: void

### Function writeToTxt

![][public]
![][const]

```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).

**Parameters**:

* std::ostream & **stream**

**Return type**: void

### Function writeToJson

![][public]
![][const]

```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).

**Parameters**:

* std::ostream & **stream**

**Return type**: void

### Function getAvailableAttributeNames

![][public]
![][const]

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

**Returns**:

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

**Return type**: std::vector\< std::string >

### Function getAvailableSubTreeNames

![][public]
![][const]

```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).

**Return type**: std::vector\< std::string >

### Function getSubByName

![][public]
![][const]

```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).

**Parameters**:

* std::string const & **name**

**Return type**: const DataTree

### Function getIntAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* int **default\_value** = 0

**Return type**: int

### Function tryGetIntAttribute

![][public]
![][const]

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

Get an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* int & **value**

**Return type**: bool

### Function getBoolAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* bool **default\_value** = false

**Return type**: bool

### Function tryGetBoolAttribute

![][public]
![][const]

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

Get an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* bool & **value**

**Return type**: bool

### Function getUnsignedIntAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* unsigned int **default\_value** = 0

**Return type**: unsigned int

### Function tryGetUnsignedIntAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* unsigned int & **value**

**Return type**: bool

### Function getDoubleAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* double **default\_value** = 0.0

**Return type**: double

### Function tryGetDoubleAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* double & **value**

**Return type**: bool

### Function getStringAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* std::string = ""

**Return type**: std::string

### Function tryGetStringAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* std::string & **value**

**Return type**: bool

### Function getVectIntAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* std::vector\< int > **default\_value** = \{}

**Return type**: std::vector\< int >

### Function tryGetVectIntAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* std::vector\< int > & **value**

**Return type**: bool

### Function getVectDoubleAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* std::vector\< double > **default\_value** = \{}

**Return type**: std::vector\< double >

### Function tryGetVectDoubleAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* std::vector\< double > & **value**

**Return type**: bool

### Function getVectStringAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

**Parameters**:

* **Name**: of the attribute.
* **Default**: value of the attribute. @information: if the attribute doesn't exist, the default value is returned.

**Parameters**:

* std::string const & **name**
* std::vector\< std::string > **default\_value** = \{}

**Return type**: std::vector\< std::string >

### Function tryGetVectStringAttribute

![][public]
![][const]

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

**Returns**:

an attribute by its name.

Available since Ansys 2025R2.
**Parameters**:

* **Name**: of the attribute.
* **Output**: value of the attribute.

**Returns**:

true if the attribute exists, false otherwise.

**Parameters**:

* std::string const & **name**
* std::vector\< std::string > & **value**

**Return type**: bool

### Function makeIntAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* int **value**

**Return type**: void

### Function makeBoolAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* bool **value**

**Return type**: void

### Function makeUnsignedIntAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* unsigned int **value**

**Return type**: void

### Function makeDoubleAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* double **value**

**Return type**: void

### Function makeStringAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* std::string const & **value**

**Return type**: void

### Function makeVectIntAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* std::vector\< int > const & **value**

**Return type**: void

### Function makeVectDoubleAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* std::vector\< double > const & **value**

**Return type**: void

### Function makeVectStringAttribute

![][public]

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

create or replace an attribute.

**Parameters**:

* std::string const & **name**
* std::vector\< std::string > const & **value**

**Return type**: void

### Function makeSub

![][public]

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

**Parameters**:

* std::string const & **name**

**Return type**: DataTree

### Function makeSubTreeAttribute

![][public]

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

**Parameters**:

* std::string const & **name**
* DataTree const \*const **sub\_tree**

**Return type**: void

### Function hasAttribute

![][public]
![][const]

```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").

**Parameters**:

* std::string const & **attribute\_name**

**Return type**: bool

### Function hasSub

![][public]
![][const]

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

**Returns**:

true if a subtree exists.

**Parameters**:

* std::string const & **attribute\_name**

**Return type**: bool

### Function deep\_copy

![][public]
![][const]

```cpp theme={null}
DataTree ansys::dpf::DataTree::deep_copy(ansys::dpf::Client const *const client=nullptr) const
```

Make a deep copy on a given client.

**Parameters**:

* [ansys::dpf::Client](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-client.md) const \*const **client** = nullptr : \[in] Remote client

**Return type**: DataTree

## Public static functions

### Function emptyDataTree

![][public]
![][static]

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

Create an empty [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-datatree.md).
**Returns**:

Empty [DataTree](https://developer.synopsys.com/docs/dpf/dpf-cpp-client-library/api-reference/classansys-dpf-datatree.md).

**Return type**: DataTree

[C++]: https://img.shields.io/badge/language-C%2B%2B-blue "C++"

[const]: https://img.shields.io/badge/-const-lightblue "const"

[public]: https://img.shields.io/badge/-public-brightgreen "public"

[static]: https://img.shields.io/badge/-static-lightgrey "static"
