ansys::dpf::DataTree Class Reference
Last update: 16.07.2025#include <dpf_api.h>

Public Member Functions | |
| DataTree (Client const *const client) | |
| DataTree (DataTree const &) | |
| DataTree (DataTree &&) noexcept | |
| DataTree & | operator= (DataTree const &) |
| DataTree & | operator= (DataTree &&) noexcept |
| void | fillFromJson (std::istream const &stream) const |
| void | fillFromTxt (std::istream const &stream) const |
| void | writeToTxt (std::ostream &stream) const |
| void | writeToJson (std::ostream &stream) const |
| std::vector< std::string > | getAvailableAttributeNames () const |
| std::vector< std::string > | getAvailableSubTreeNames () const |
| const DataTree | getSubByName (std::string const &name) const |
| int | getIntAttribute (std::string const &name, int default_value=0) const |
| bool | tryGetIntAttribute (std::string const &name, int &value) const |
| Get an attribute by its name. More... | |
| bool | getBoolAttribute (std::string const &name, bool default_value=false) const |
| bool | tryGetBoolAttribute (std::string const &name, bool &value) const |
| Get an attribute by its name. More... | |
| unsigned int | getUnsignedIntAttribute (std::string const &name, unsigned int default_value=0) const |
| bool | tryGetUnsignedIntAttribute (std::string const &name, unsigned int &value) const |
| double | getDoubleAttribute (std::string const &name, double default_value=0.0) const |
| bool | tryGetDoubleAttribute (std::string const &name, double &value) const |
| std::string | getStringAttribute (std::string const &name, std::string="") const |
| bool | tryGetStringAttribute (std::string const &name, std::string &value) const |
| std::vector< int > | getVectIntAttribute (std::string const &name, std::vector< int > default_value={}) const |
| bool | tryGetVectIntAttribute (std::string const &name, std::vector< int > &value) const |
| std::vector< double > | getVectDoubleAttribute (std::string const &name, std::vector< double > default_value={}) const |
| bool | tryGetVectDoubleAttribute (std::string const &name, std::vector< double > &value) const |
| std::vector< std::string > | getVectStringAttribute (std::string const &name, std::vector< std::string > default_value={}) const |
| bool | tryGetVectStringAttribute (std::string const &name, std::vector< std::string > &value) const |
| void | makeIntAttribute (std::string const &name, int value) |
| void | makeBoolAttribute (std::string const &name, bool value) |
| void | makeUnsignedIntAttribute (std::string const &name, unsigned int value) |
| void | makeDoubleAttribute (std::string const &name, double value) |
| void | makeStringAttribute (std::string const &name, std::string const &value) |
| void | makeVectIntAttribute (std::string const &name, std::vector< int > const &value) |
| void | makeVectDoubleAttribute (std::string const &name, std::vector< double > const &value) |
| void | makeVectStringAttribute (std::string const &name, std::vector< std::string > const &value) |
| DataTree | makeSub (std::string const &name) |
| void | makeSubTreeAttribute (std::string const &name, DataTree const *const sub_tree) |
| bool | hasAttribute (std::string const &attribute_name) const |
| bool | hasSub (std::string const &attribute_name) const |
Public Member Functions inherited from ansys::dpf::DpfTypes | |
| virtual bool | empty () const |
| virtual bool | hasInternalObject () const |
| virtual std::string | describe () const |
| so::API const * | callAPI () const |
| bool | isOnCommonAPI () const |
| bool | getClient (Client &client) const |
| bool | hasBeenMovedLocally () const |
| bool | isSameObject (DpfTypes const &rhs) const |
Static Public Member Functions | |
| static DataTree | emptyDataTree () |
Detailed Description
Define a DOM (Document-Object-Model) tree.
Constructor & Destructor Documentation
◆ DataTree()
| ansys::dpf::DataTree::DataTree | ( | Client const *const | client | ) |
- Parameters
-
[in] client Client instance designating the IP, port and protocol to use.
Member Function Documentation
◆ emptyDataTree()
|
static |
◆ fillFromJson()
| 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).
◆ fillFromTxt()
| 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).
◆ getAvailableAttributeNames()
| std::vector< std::string > ansys::dpf::DataTree::getAvailableAttributeNames | ( | ) | const |
- Returns
- the list of attributes names available (without recursivity in the subtrees).
◆ getAvailableSubTreeNames()
| std::vector< std::string > ansys::dpf::DataTree::getAvailableSubTreeNames | ( | ) | const |
- Returns
- the list of first rank substree names available (without recursivity in the subtrees).
◆ getBoolAttribute()
| 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.
◆ getDoubleAttribute()
| 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.
◆ getIntAttribute()
| 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.
◆ getStringAttribute()
| 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.
◆ getSubByName()
| 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()
| 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.
◆ getVectDoubleAttribute()
| 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.
◆ getVectIntAttribute()
| 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.
◆ getVectStringAttribute()
| 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.
◆ hasAttribute()
| 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()
| bool ansys::dpf::DataTree::hasSub | ( | std::string const & | attribute_name | ) | const |
- Returns
- true if a subtree exists.
◆ makeBoolAttribute()
| void ansys::dpf::DataTree::makeBoolAttribute | ( | std::string const & | name, |
| bool | value | ||
| ) |
create or replace an attribute.
◆ makeDoubleAttribute()
| void ansys::dpf::DataTree::makeDoubleAttribute | ( | std::string const & | name, |
| double | value | ||
| ) |
create or replace an attribute.
◆ makeIntAttribute()
| void ansys::dpf::DataTree::makeIntAttribute | ( | std::string const & | name, |
| int | value | ||
| ) |
create or replace an attribute.
◆ makeStringAttribute()
| void ansys::dpf::DataTree::makeStringAttribute | ( | std::string const & | name, |
| std::string const & | value | ||
| ) |
create or replace an attribute.
◆ makeSub()
| 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()
| void ansys::dpf::DataTree::makeUnsignedIntAttribute | ( | std::string const & | name, |
| unsigned int | value | ||
| ) |
create or replace an attribute.
◆ makeVectDoubleAttribute()
| void ansys::dpf::DataTree::makeVectDoubleAttribute | ( | std::string const & | name, |
| std::vector< double > const & | value | ||
| ) |
create or replace an attribute.
◆ makeVectIntAttribute()
| void ansys::dpf::DataTree::makeVectIntAttribute | ( | std::string const & | name, |
| std::vector< int > const & | value | ||
| ) |
create or replace an attribute.
◆ makeVectStringAttribute()
| void ansys::dpf::DataTree::makeVectStringAttribute | ( | std::string const & | name, |
| std::vector< std::string > const & | value | ||
| ) |
create or replace an attribute.
◆ tryGetBoolAttribute()
| 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.
◆ tryGetDoubleAttribute()
| 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.
◆ tryGetIntAttribute()
| 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.
◆ tryGetStringAttribute()
| 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.
◆ tryGetUnsignedIntAttribute()
| 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.
◆ tryGetVectDoubleAttribute()
| 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.
◆ tryGetVectIntAttribute()
| 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.
◆ tryGetVectStringAttribute()
| 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.
◆ writeToJson()
| 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()
| 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).
Public Member Functions inherited from