    

 ## On this page

  

 

 # ansys::dpf::DataTree Class Reference

 Last update: 16.07.2025 

`#include <dpf_api.h>`

Inheritance diagram for ansys::dpf::DataTree:

 ![](/sites/default/files/migrate-content/dpf_cpp_client_library_2024_r1/classansys_1_1dpf_1_1DataTree.png)



## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

 [DataTree](classansys_1_1dpf_1_1DataTree.xhtml#a1c47166bd00e9a3168a9f045f6de1e0e) ([Client](classansys_1_1dpf_1_1Client.xhtml) const \*const client) <a id="a45794f55475843de36a620e6bf8a24a6" name="a45794f55475843de36a620e6bf8a24a6"></a> **DataTree** ([DataTree](classansys_1_1dpf_1_1DataTree.xhtml) const &amp;) <a id="a22b2761471e513003ccba1a65a5326b9" name="a22b2761471e513003ccba1a65a5326b9"></a> **DataTree** ([DataTree](classansys_1_1dpf_1_1DataTree.xhtml) &amp;&amp;) <a id="a859b20aa1351b9551e1e0cf9e6350fd1" name="a859b20aa1351b9551e1e0cf9e6350fd1"></a>[DataTree](classansys_1_1dpf_1_1DataTree.xhtml) &amp; **operator=** ([DataTree](classansys_1_1dpf_1_1DataTree.xhtml) const &amp;) <a id="a3e5022fe78a287ab3d2914f5d00da341" name="a3e5022fe78a287ab3d2914f5d00da341"></a>[DataTree](classansys_1_1dpf_1_1DataTree.xhtml) &amp; **operator=** ([DataTree](classansys_1_1dpf_1_1DataTree.xhtml) &amp;&amp;) void [fillFromJson](classansys_1_1dpf_1_1DataTree.xhtml#a752e23c8eba350096723fa4e677155f1) (std::istream const &amp;stream) void [fillFromTxt](classansys_1_1dpf_1_1DataTree.xhtml#aaa5fedf1b8dbe76ffb8fa0bba77f8f1e) (std::istream const &amp;stream) void [writeToTxt](classansys_1_1dpf_1_1DataTree.xhtml#a42d8bc93bc41e482a8764d4ead2f2df4) (std::ostream &amp;stream) void [writeToJson](classansys_1_1dpf_1_1DataTree.xhtml#a4f5f19ae0993ffd57aa8c333f43f139a) (std::ostream &amp;stream) std::vector&lt; std::string &gt; [getAvailableAttributeNames](classansys_1_1dpf_1_1DataTree.xhtml#a387ca479f3cfbc9108525f61b7572302) () const std::vector&lt; std::string &gt; [getAvailableSubTreeNames](classansys_1_1dpf_1_1DataTree.xhtml#a2cf094e8fce213c47869123396bac585) () const const [DataTree](classansys_1_1dpf_1_1DataTree.xhtml) [getSubByName](classansys_1_1dpf_1_1DataTree.xhtml#a5c2cf876663f094d2fd3f54c7975a111) (std::string const &amp;name) const int [getIntAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a46a3776bd7cf77093a45e314d172f680) (std::string const &amp;name) const bool [getBoolAttribute](classansys_1_1dpf_1_1DataTree.xhtml#af98385ef4774e32f1b35ff51875504f1) (std::string const &amp;name) const unsigned int [getUnsignedIntAttribute](classansys_1_1dpf_1_1DataTree.xhtml#aeaf30fcfd9747d81e734f06220f86da1) (std::string const &amp;name) const double [getDoubleAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a880be298bf672cb260e363dfbedf11ab) (std::string const &amp;name) const std::string [getStringAttribute](classansys_1_1dpf_1_1DataTree.xhtml#aa574aae0a2da672daefcb46b06557f00) (std::string const &amp;name) const std::vector&lt; int &gt; [getVectIntAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a4f338286ecc048c1072d9ba901d84fec) (std::string const &amp;name) const std::vector&lt; double &gt; [getVectDoubleAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a4254b2eb4e8e198e7a5a37a5aacd5337) (std::string const &amp;name) const std::vector&lt; std::string &gt; [getVectStringAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a35917cb2bc740594ed3dbfb6d6f4b20a) (std::string const &amp;name) const void [makeIntAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a00f7067a548e3ca2dc21ac63bf1f4e13) (std::string const &amp;name, int value) void [makeBoolAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a12d088c2d4aecb4d7ad4e28b400cd9c1) (std::string const &amp;name, bool value) void [makeUnsignedIntAttribute](classansys_1_1dpf_1_1DataTree.xhtml#ae4120d3564517f8481feddb749940e32) (std::string const &amp;name, unsigned int value) void [makeDoubleAttribute](classansys_1_1dpf_1_1DataTree.xhtml#aa2d8b58119590de684d399072435b565) (std::string const &amp;name, double value) void [makeStringAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a82714e5e01a67de376d2e0e53bb1e126) (std::string const &amp;name, std::string const &amp;value) void [makeVectIntAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a40c87dbd75b43d54a01f6a2326952a50) (std::string const &amp;name, std::vector&lt; int &gt; const &amp;value) void [makeVectDoubleAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a13ea47ce80b84b62943ae7048d119484) (std::string const &amp;name, std::vector&lt; double &gt; const &amp;value) void [makeVectStringAttribute](classansys_1_1dpf_1_1DataTree.xhtml#aa03b920ab02e60829acc9587f9bf51fc) (std::string const &amp;name, std::vector&lt; std::string &gt; const &amp;value) [DataTree](classansys_1_1dpf_1_1DataTree.xhtml) [makeSub](classansys_1_1dpf_1_1DataTree.xhtml#aa18973ec995c9088d1d6abb65c7660ff) (std::string const &amp;name) <a id="a09a963609da9eb0092bf1d8658def177" name="a09a963609da9eb0092bf1d8658def177"></a>void **makeSubTreeAttribute** (std::string const &amp;name, [DataTree](classansys_1_1dpf_1_1DataTree.xhtml) const \*const sub\_tree) bool [hasAttribute](classansys_1_1dpf_1_1DataTree.xhtml#a3422a0cbc6d69c9dd91ea7a5cb5869bb) (std::string const &amp;attribute\_name) const bool [hasSub](classansys_1_1dpf_1_1DataTree.xhtml#a6d1859fee7564672cbf1a85d9d8bb492) (std::string const &amp;attribute\_name) const ![-](/sites/default/files/migrate-content/dpf_cpp_client_library_2024_r1/closed.png) Public Member Functions inherited from [ansys::dpf::DpfTypes](classansys_1_1dpf_1_1DpfTypes.xhtml)virtual bool [empty](classansys_1_1dpf_1_1DpfTypes.xhtml#a39cd546c42518e2332be8f287db95459) () const virtual bool [hasInternalObject](classansys_1_1dpf_1_1DpfTypes.xhtml#ae198f89868d85c7db6dc1a934a1d3c15) () const virtual std::string [describe](classansys_1_1dpf_1_1DpfTypes.xhtml#a9977945710983bc03d2940fa007847b2) () const so::API const \* [callAPI](classansys_1_1dpf_1_1DpfTypes.xhtml#aea34d37e0c080126eff70db34bf46597) () const bool [isOnCommonAPI](classansys_1_1dpf_1_1DpfTypes.xhtml#a9f9789ff61cc9d400a2a344830706b73) () const bool [getClient](classansys_1_1dpf_1_1DpfTypes.xhtml#a968afd9daa0b0f13b65a2ac61369d73a) ([Client](classansys_1_1dpf_1_1Client.xhtml) &amp;client) const bool [hasBeenMovedLocally](classansys_1_1dpf_1_1DpfTypes.xhtml#a1a5634202c15404b6b24e8f50e51cb66) () const bool [isSameObject](classansys_1_1dpf_1_1DpfTypes.xhtml#aa64d5f8fcd7d85ad6ebf708494dbefd7) ([DpfTypes](classansys_1_1dpf_1_1DpfTypes.xhtml) const &amp;rhs) const ## <a id="pub-static-methods" name="pub-static-methods"></a>Static Public Member Functions

static [DataTree](classansys_1_1dpf_1_1DataTree.xhtml) [emptyDataTree](classansys_1_1dpf_1_1DataTree.xhtml#afb0171dc88164d841e4d8d1d14c8dc92) () <a id="details" name="details"></a>## Detailed Description

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



## Constructor &amp; Destructor Documentation

<a id="a1c47166bd00e9a3168a9f045f6de1e0e" name="a1c47166bd00e9a3168a9f045f6de1e0e"></a>## [◆ ](#a1c47166bd00e9a3168a9f045f6de1e0e)DataTree()

 ansys::dpf::DataTree::DataTree  ( [Client](classansys_1_1dpf_1_1Client.xhtml) const \*const  *client*) 

Parameters \[in\]client[Client](classansys_1_1dpf_1_1Client.xhtml) instance designating the IP, port and protocol to use. 



## Member Function Documentation

<a id="afb0171dc88164d841e4d8d1d14c8dc92" name="afb0171dc88164d841e4d8d1d14c8dc92"></a>## [◆ ](#afb0171dc88164d841e4d8d1d14c8dc92)emptyDataTree()

 static [DataTree](classansys_1_1dpf_1_1DataTree.xhtml) ansys::dpf::DataTree::emptyDataTree  ( )   static 

Create an empty [DataTree](classansys_1_1dpf_1_1DataTree.xhtml).

ReturnsEmpty [DataTree](classansys_1_1dpf_1_1DataTree.xhtml). 



<a id="a752e23c8eba350096723fa4e677155f1" name="a752e23c8eba350096723fa4e677155f1"></a>## [◆ ](#a752e23c8eba350096723fa4e677155f1)fillFromJson()

 void ansys::dpf::DataTree::fillFromJson  ( std::istream const &amp;  *stream*) 

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





<a id="aaa5fedf1b8dbe76ffb8fa0bba77f8f1e" name="aaa5fedf1b8dbe76ffb8fa0bba77f8f1e"></a>## [◆ ](#aaa5fedf1b8dbe76ffb8fa0bba77f8f1e)fillFromTxt()

 void ansys::dpf::DataTree::fillFromTxt  ( std::istream const &amp;  *stream*) 

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





<a id="a387ca479f3cfbc9108525f61b7572302" name="a387ca479f3cfbc9108525f61b7572302"></a>## [◆ ](#a387ca479f3cfbc9108525f61b7572302)getAvailableAttributeNames()

 std::vector&lt; std::string &gt; ansys::dpf::DataTree::getAvailableAttributeNames  ( )  const

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



<a id="a2cf094e8fce213c47869123396bac585" name="a2cf094e8fce213c47869123396bac585"></a>## [◆ ](#a2cf094e8fce213c47869123396bac585)getAvailableSubTreeNames()

 std::vector&lt; std::string &gt; ansys::dpf::DataTree::getAvailableSubTreeNames  ( )  const

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



<a id="af98385ef4774e32f1b35ff51875504f1" name="af98385ef4774e32f1b35ff51875504f1"></a>## [◆ ](#af98385ef4774e32f1b35ff51875504f1)getBoolAttribute()

 bool ansys::dpf::DataTree::getBoolAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name. Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist. 



<a id="a880be298bf672cb260e363dfbedf11ab" name="a880be298bf672cb260e363dfbedf11ab"></a>## [◆ ](#a880be298bf672cb260e363dfbedf11ab)getDoubleAttribute()

 double ansys::dpf::DataTree::getDoubleAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name. Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist. 



<a id="a46a3776bd7cf77093a45e314d172f680" name="a46a3776bd7cf77093a45e314d172f680"></a>## [◆ ](#a46a3776bd7cf77093a45e314d172f680)getIntAttribute()

 int ansys::dpf::DataTree::getIntAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name. Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist. 



<a id="aa574aae0a2da672daefcb46b06557f00" name="aa574aae0a2da672daefcb46b06557f00"></a>## [◆ ](#aa574aae0a2da672daefcb46b06557f00)getStringAttribute()

 std::string ansys::dpf::DataTree::getStringAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name. Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist. 



<a id="a5c2cf876663f094d2fd3f54c7975a111" name="a5c2cf876663f094d2fd3f54c7975a111"></a>## [◆ ](#a5c2cf876663f094d2fd3f54c7975a111)getSubByName()

 const [DataTree](classansys_1_1dpf_1_1DataTree.xhtml) ansys::dpf::DataTree::getSubByName  ( std::string const &amp;  *name*)  const

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



<a id="aeaf30fcfd9747d81e734f06220f86da1" name="aeaf30fcfd9747d81e734f06220f86da1"></a>## [◆ ](#aeaf30fcfd9747d81e734f06220f86da1)getUnsignedIntAttribute()

 unsigned int ansys::dpf::DataTree::getUnsignedIntAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name. Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist. 



<a id="a4254b2eb4e8e198e7a5a37a5aacd5337" name="a4254b2eb4e8e198e7a5a37a5aacd5337"></a>## [◆ ](#a4254b2eb4e8e198e7a5a37a5aacd5337)getVectDoubleAttribute()

 std::vector&lt; double &gt; ansys::dpf::DataTree::getVectDoubleAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name. Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist. 



<a id="a4f338286ecc048c1072d9ba901d84fec" name="a4f338286ecc048c1072d9ba901d84fec"></a>## [◆ ](#a4f338286ecc048c1072d9ba901d84fec)getVectIntAttribute()

 std::vector&lt; int &gt; ansys::dpf::DataTree::getVectIntAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist 



<a id="a35917cb2bc740594ed3dbfb6d6f4b20a" name="a35917cb2bc740594ed3dbfb6d6f4b20a"></a>## [◆ ](#a35917cb2bc740594ed3dbfb6d6f4b20a)getVectStringAttribute()

 std::vector&lt; std::string &gt; ansys::dpf::DataTree::getVectStringAttribute  ( std::string const &amp;  *name*)  const

Returnsan attribute by its name. Exceptions [DpfException](classansys_1_1dpf_1_1DpfException.xhtml)if the attribute doesn't exist. 



<a id="a3422a0cbc6d69c9dd91ea7a5cb5869bb" name="a3422a0cbc6d69c9dd91ea7a5cb5869bb"></a>## [◆ ](#a3422a0cbc6d69c9dd91ea7a5cb5869bb)hasAttribute()

 bool ansys::dpf::DataTree::hasAttribute  ( std::string const &amp;  *attribute\_name*)  const

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



<a id="a6d1859fee7564672cbf1a85d9d8bb492" name="a6d1859fee7564672cbf1a85d9d8bb492"></a>## [◆ ](#a6d1859fee7564672cbf1a85d9d8bb492)hasSub()

 bool ansys::dpf::DataTree::hasSub  ( std::string const &amp;  *attribute\_name*)  const

Returnstrue if a subtree exists. 



<a id="a12d088c2d4aecb4d7ad4e28b400cd9c1" name="a12d088c2d4aecb4d7ad4e28b400cd9c1"></a>## [◆ ](#a12d088c2d4aecb4d7ad4e28b400cd9c1)makeBoolAttribute()

 void ansys::dpf::DataTree::makeBoolAttribute  ( std::string const &amp;  *name*,    bool  *value*   ) 

create or replace an attribute.





<a id="aa2d8b58119590de684d399072435b565" name="aa2d8b58119590de684d399072435b565"></a>## [◆ ](#aa2d8b58119590de684d399072435b565)makeDoubleAttribute()

 void ansys::dpf::DataTree::makeDoubleAttribute  ( std::string const &amp;  *name*,    double  *value*   ) 

create or replace an attribute.





<a id="a00f7067a548e3ca2dc21ac63bf1f4e13" name="a00f7067a548e3ca2dc21ac63bf1f4e13"></a>## [◆ ](#a00f7067a548e3ca2dc21ac63bf1f4e13)makeIntAttribute()

 void ansys::dpf::DataTree::makeIntAttribute  ( std::string const &amp;  *name*,    int  *value*   ) 

create or replace an attribute.





<a id="a82714e5e01a67de376d2e0e53bb1e126" name="a82714e5e01a67de376d2e0e53bb1e126"></a>## [◆ ](#a82714e5e01a67de376d2e0e53bb1e126)makeStringAttribute()

 void ansys::dpf::DataTree::makeStringAttribute  ( std::string const &amp;  *name*,    std::string const &amp;  *value*   ) 

create or replace an attribute.





<a id="aa18973ec995c9088d1d6abb65c7660ff" name="aa18973ec995c9088d1d6abb65c7660ff"></a>## [◆ ](#aa18973ec995c9088d1d6abb65c7660ff)makeSub()

 [DataTree](classansys_1_1dpf_1_1DataTree.xhtml) ansys::dpf::DataTree::makeSub  ( std::string const &amp;  *name*) 

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

Returnsthe created subtree to fill it. 



<a id="ae4120d3564517f8481feddb749940e32" name="ae4120d3564517f8481feddb749940e32"></a>## [◆ ](#ae4120d3564517f8481feddb749940e32)makeUnsignedIntAttribute()

 void ansys::dpf::DataTree::makeUnsignedIntAttribute  ( std::string const &amp;  *name*,    unsigned int  *value*   ) 

create or replace an attribute.





<a id="a13ea47ce80b84b62943ae7048d119484" name="a13ea47ce80b84b62943ae7048d119484"></a>## [◆ ](#a13ea47ce80b84b62943ae7048d119484)makeVectDoubleAttribute()

 void ansys::dpf::DataTree::makeVectDoubleAttribute  ( std::string const &amp;  *name*,    std::vector&lt; double &gt; const &amp;  *value*   ) 

create or replace an attribute.





<a id="a40c87dbd75b43d54a01f6a2326952a50" name="a40c87dbd75b43d54a01f6a2326952a50"></a>## [◆ ](#a40c87dbd75b43d54a01f6a2326952a50)makeVectIntAttribute()

 void ansys::dpf::DataTree::makeVectIntAttribute  ( std::string const &amp;  *name*,    std::vector&lt; int &gt; const &amp;  *value*   ) 

create or replace an attribute.





<a id="aa03b920ab02e60829acc9587f9bf51fc" name="aa03b920ab02e60829acc9587f9bf51fc"></a>## [◆ ](#aa03b920ab02e60829acc9587f9bf51fc)makeVectStringAttribute()

 void ansys::dpf::DataTree::makeVectStringAttribute  ( std::string const &amp;  *name*,    std::vector&lt; std::string &gt; const &amp;  *value*   ) 

create or replace an attribute.





<a id="a4f5f19ae0993ffd57aa8c333f43f139a" name="a4f5f19ae0993ffd57aa8c333f43f139a"></a>## [◆ ](#a4f5f19ae0993ffd57aa8c333f43f139a)writeToJson()

 void ansys::dpf::DataTree::writeToJson  ( std::ostream &amp;  *stream*) 

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





<a id="a42d8bc93bc41e482a8764d4ead2f2df4" name="a42d8bc93bc41e482a8764d4ead2f2df4"></a>## [◆ ](#a42d8bc93bc41e482a8764d4ead2f2df4)writeToTxt()

 void ansys::dpf::DataTree::writeToTxt  ( std::ostream &amp;  *stream*) 

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