Document and Test PropertyTree Class

In particular, add Doxygen-style documentation to the header file
and add a simple unit test for the PropertyTree class interface.

While here, also add missing headers and prefer template argument
deduction over explicit template arguments.
This commit is contained in:
Bård Skaflestad
2025-01-28 12:32:44 +01:00
parent d2b272b5f5
commit efede0a253
4 changed files with 367 additions and 30 deletions

View File

@@ -23,8 +23,14 @@
#include <boost/property_tree/json_parser.hpp>
namespace Opm
{
#include <memory>
#include <optional>
#include <ostream>
#include <string>
#include <stddef.h>
namespace Opm {
PropertyTree::PropertyTree()
: tree_(std::make_unique<boost::property_tree::ptree>())
@@ -96,23 +102,23 @@ PropertyTree& PropertyTree::operator=(const PropertyTree& tree)
return *this;
}
template std::string PropertyTree::get<std::string>(const std::string& key) const;
template std::string PropertyTree::get<std::string>(const std::string& key, const std::string& defValue) const;
template double PropertyTree::get<double>(const std::string& key) const;
template double PropertyTree::get<double>(const std::string& key, const double& defValue) const;
template float PropertyTree::get<float>(const std::string& key) const;
template float PropertyTree::get<float>(const std::string& key, const float& defValue) const;
template int PropertyTree::get<int>(const std::string& key) const;
template int PropertyTree::get<int>(const std::string& key, const int& defValue) const;
template size_t PropertyTree::get<size_t>(const std::string& key) const;
template size_t PropertyTree::get<size_t>(const std::string& key, const size_t& defValue) const;
template bool PropertyTree::get<bool>(const std::string& key) const;
template bool PropertyTree::get<bool>(const std::string& key, const bool& defValue) const;
template std::string PropertyTree::get(const std::string& key) const;
template double PropertyTree::get(const std::string& key) const;
template float PropertyTree::get(const std::string& key) const;
template int PropertyTree::get(const std::string& key) const;
template size_t PropertyTree::get(const std::string& key) const;
template bool PropertyTree::get(const std::string& key) const;
template void PropertyTree::put<std::string>(const std::string& key, const std::string& value);
template void PropertyTree::put<float>(const std::string& key, const float& value);
template void PropertyTree::put<double>(const std::string& key, const double& value);
template void PropertyTree::put<int>(const std::string& key, const int& value);
template std::string PropertyTree::get(const std::string& key, const std::string& defValue) const;
template double PropertyTree::get(const std::string& key, const double& defValue) const;
template float PropertyTree::get(const std::string& key, const float& defValue) const;
template int PropertyTree::get(const std::string& key, const int& defValue) const;
template size_t PropertyTree::get(const std::string& key, const size_t& defValue) const;
template bool PropertyTree::get(const std::string& key, const bool& defValue) const;
template void PropertyTree::put(const std::string& key, const std::string& value);
template void PropertyTree::put(const std::string& key, const float& value);
template void PropertyTree::put(const std::string& key, const double& value);
template void PropertyTree::put(const std::string& key, const int& value);
} // namespace Opm