19 #ifndef GEOSX_DATAREPOSITORY_XMLWRAPPER_HPP_ 20 #define GEOSX_DATAREPOSITORY_XMLWRAPPER_HPP_ 25 #include "rajaInterface/GEOS_RAJA_Interface.hpp" 30 #include <pugixml.hpp> 120 template<
typename T >
121 static std::enable_if_t< traits::CanStreamInto< std::istringstream, T > >
124 std::istringstream ss( value );
144 template<
typename T,
int NDIM,
typename PERMUTATION >
145 static std::enable_if_t< traits::CanStreamInto< std::istringstream, T > >
170 template<
typename T,
typename T_DEF = T >
171 static std::enable_if_t< canParseVariable< T >,
bool >
175 T_DEF
const & defVal )
177 pugi::xml_attribute xmlatt = targetNode.attribute( name.c_str() );
178 if( !xmlatt.empty() )
186 equate( rval, defVal );
200 template<
typename T >
201 static std::enable_if_t< canParseVariable< T >,
bool >
205 bool const required )
207 pugi::xml_attribute xmlatt = targetNode.attribute( name.c_str() );
209 bool const success = !(xmlatt.empty() && required);
227 template<
typename T >
228 static std::enable_if_t< !dataRepository::DefaultValue< T >::has_default_value,
bool >
244 template<
typename T >
245 static typename std::enable_if_t< dataRepository::DefaultValue< T >::has_default_value,
bool >
256 template<
typename T,
typename U >
257 static std::enable_if_t< !canParseVariable< T >,
bool >
260 GEOSX_ERROR(
"Cannot parse the given type " << LvArray::system::demangleType< T >() );
274 template<
typename T >
275 static void equate( T & lhs, T
const & rhs )
286 template<
typename T,
int NDIM,
typename PERM >
288 { lhs.template setValues< serialPolicy >( rhs ); }
static std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > StringToInputVariable(Array< T, NDIM, PERMUTATION > &array, string const &value)
Parse a string and fill an Array with the value(s) in the string.
pugi::xml_document xmlDocument
Alias for the type of xml document.
Contains functions for outputting array objects.
IS_VALID_EXPRESSION(canParseVariable, T, StringToInputVariable(std::declval< T & >(), std::string()))
pugi::xml_node xmlNode
Alias for the type of an xml node.
static std::enable_if_t< !canParseVariable< T >, bool > ReadAttributeAsType(T &, string const &, xmlNode const &, U const &)
Stub that for unreadable types that errors out.
static std::enable_if_t< canParseVariable< T >, bool > ReadAttributeAsType(T &rval, string const &name, xmlNode const &targetNode, T_DEF const &defVal)
Extract attribute in an xml tree, and translate its value into a typed variable.
~xmlWrapper()=delete
Deleted default default destructor.
static constexpr auto filePathString
constexpr variable to hold name for inserting the file path into the xml file.
static std::enable_if_t< traits::CanStreamInto< std::istringstream, T > > StringToInputVariable(T &target, string const &value)
Parse a string and fill a variable with the value(s) in the string.
static std::enable_if_t< !dataRepository::DefaultValue< T >::has_default_value, bool > ReadAttributeAsType(T &rval, string const &name, xmlNode const &targetNode, dataRepository::DefaultValue< T > const &)
Extract attribute in an xml tree, and translate its value into a typed variable.
internal::Helper< T > DefaultValue
A templated alias to hold default values.
#define GEOSX_ERROR(msg)
Raise a hard error and terminate the program.
pugi::xml_parse_result xmlResult
Alias for the type of the result from an xml parse attempt.
static std::enable_if_t< canParseVariable< T >, bool > ReadAttributeAsType(T &rval, string const &name, xmlNode const &targetNode, bool const required)
Extract attribute in an xml tree, and translate its value into a typed variable.
static std::enable_if_t< dataRepository::DefaultValue< T >::has_default_value, bool > ReadAttributeAsType(T &rval, string const &name, xmlNode const &targetNode, dataRepository::DefaultValue< T > const &defVal)
Extract attribute in an xml tree, and translate its value into a typed variable.
std::string string
String type.
xmlWrapper()=delete
Deleted default constructor.
pugi::xml_attribute xmlAttribute
Alias for the type of an xml attribute.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
static void addIncludedXML(xmlNode &targetNode)
Function to add xml nodes from included files.
pugi::xml_node_type xmlTypes
Alias for the type variant of an xml node.