ansys::dpf::DataTree Class Reference
Last update: 10.07.2023
ansys::dpf::DataTree Class Reference
#include <dpf_api.h>
Public Member Functions | |
DataTree (Client const *const client) | |
DataTree (DataTree const &) | |
DataTree (DataTree &&) | |
DataTree & | operator= (DataTree const &) |
DataTree & | operator= (DataTree &&) |
void | fillFromJson (std::istream const &stream) |
void | fillFromTxt (std::istream const &stream) |
void | writeToTxt (std::ostream &stream) |
void | writeToJson (std::ostream &stream) |
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) const |
bool | getBoolAttribute (std::string const &name) const |
unsigned int | getUnsignedIntAttribute (std::string const &name) const |
double | getDoubleAttribute (std::string const &name) const |
std::string | getStringAttribute (std::string const &name) const |
std::vector< int > | getVectIntAttribute (std::string const &name) const |
std::vector< double > | getVectDoubleAttribute (std::string const &name) const |
std::vector< std::string > | getVectStringAttribute (std::string const &name) 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 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 | ) |
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 | ) |
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 | ) | const |
- Returns
- an attribute by its name.
- Exceptions
-
DpfException if the attribute doesn't exist.
◆ getDoubleAttribute()
double ansys::dpf::DataTree::getDoubleAttribute | ( | std::string const & | name | ) | const |
- Returns
- an attribute by its name.
- Exceptions
-
DpfException if the attribute doesn't exist.
◆ getIntAttribute()
int ansys::dpf::DataTree::getIntAttribute | ( | std::string const & | name | ) | const |
- Returns
- an attribute by its name.
- Exceptions
-
DpfException if the attribute doesn't exist.
◆ getStringAttribute()
std::string ansys::dpf::DataTree::getStringAttribute | ( | std::string const & | name | ) | const |
- Returns
- an attribute by its name.
- Exceptions
-
DpfException if the attribute doesn't exist.
◆ 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 | ) | const |
- Returns
- an attribute by its name.
- Exceptions
-
DpfException if the attribute doesn't exist.
◆ getVectDoubleAttribute()
std::vector< double > ansys::dpf::DataTree::getVectDoubleAttribute | ( | std::string const & | name | ) | const |
- Returns
- an attribute by its name.
- Exceptions
-
DpfException if the attribute doesn't exist.
◆ getVectIntAttribute()
std::vector< int > ansys::dpf::DataTree::getVectIntAttribute | ( | std::string const & | name | ) | const |
- Returns
- an attribute by its name
- Exceptions
-
DpfException if the attribute doesn't exist
◆ getVectStringAttribute()
std::vector< std::string > ansys::dpf::DataTree::getVectStringAttribute | ( | std::string const & | name | ) | const |
- Returns
- an attribute by its name.
- Exceptions
-
DpfException if the attribute doesn't exist.
◆ 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.
- 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.
◆ writeToJson()
void ansys::dpf::DataTree::writeToJson | ( | std::ostream & | 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).
◆ writeToTxt()
void ansys::dpf::DataTree::writeToTxt | ( | std::ostream & | stream | ) |
Write the attributes and the subtrees of this data tree as text in a c++ standard output stream (example: std::ofstream, std::ostringstream).