142 template <
typename Container>
145 std::for_each(subtags.begin(), subtags.end(), [
this](
auto &s) { this->addSubtag(s); });
This class provides a lightweight logger.
Represents an XML tag to be configured automatically.
Eigen::VectorXd getEigenVectorXdAttributeValue(const std::string &name) const
const std::string & getNamespace() const
Returns xml namespace.
bool isConfigured() const
void addSubtags(const Container &subtags)
std::string getDocumentation() const
std::string _fullName
Combination of name and namespace: _namespace + ":" + _name.
std::map< std::string, bool > _configuredNamespaces
bool hasAttribute(const std::string &attributeName) const
std::string getStringAttributeValue(const std::string &name, std::optional< std::string > default_value=std::nullopt) const
bool getBooleanAttributeValue(const std::string &name, std::optional< bool > default_value=std::nullopt) const
Occurrence getOccurrence() const
void readAttributes(const std::map< std::string, std::string > &aAttributes)
reads all attributes of this tag
typename std::vector< std::string > Namespaces
std::string _namespace
XML namespace of the tag.
const Namespaces & getNamespaces() const
XMLTag & setDocumentation(std::string_view documentation)
Adds a description of the purpose of this XML tag.
static std::string_view getOccurrenceString(Occurrence occurrence)
const std::string & getName() const
Returns name (without namespace).
typename std::vector< Attribute > Attributes
const std::string & getFullName() const
Returns full name consisting of xml namespace + ":" + name.
Occurrence
Types of occurrences of an XML tag.
void addAttributeHint(std::string name, std::string message)
Adds a hint for missing attributes, which will be displayed along the error message.
XMLTag(Listener &listener, std::string name, Occurrence occurrence, std::string xmlNamespace="")
Standard constructor.
std::map< std::string, std::string > _attributeHints
std::string _name
Name of the tag.
typename std::vector< std::shared_ptr< XMLTag > > Subtags
int getIntAttributeValue(const std::string &name, std::optional< int > default_value=std::nullopt) const
const Attributes & getAttributes() const
XMLTag & addNamespace(const std::string &namespaceName)
Adds a namespace to the tag.
const Subtags & getSubtags() const
std::vector< std::string > getAttributeNames() const
double getDoubleAttributeValue(const std::string &name, std::optional< double > default_value=std::nullopt) const
XMLTag & addAttribute(const XMLAttribute< double > &attribute)
Adds a XML attribute by making a copy of the given attribute.
XMLTag & addSubtag(const XMLTag &tag)
Adds an XML tag as subtag by making a copy of the given tag.
void areAllSubtagsConfigured() const
contains the XML configuration parser.
XMLTag getRootTag()
Returns an empty root tag with name "configuration".
std::string getName(const XMLTag::Attribute &attribute)
Returns the name of an Attribute.
std::string configure(XMLTag &tag, const precice::xml::ConfigurationContext &context, std::string_view configurationFilename)
Configures the given configuration from file configurationFilename.
Tightly coupled to the parameters of Participant()
No operation listener for tests.
void xmlTagCallback(ConfigurationContext const &context, XMLTag &callingTag) override
Callback at begin of XML tag.
void xmlEndTagCallback(ConfigurationContext const &context, XMLTag &callingTag) override
Callback at end of XML tag and at end of subtag.
Callback interface for configuration classes using XMLTag.
virtual void xmlTagCallback(ConfigurationContext const &context, XMLTag &callingTag)=0
Callback at begin of XML tag.
Listener & operator=(Listener &&)=delete
virtual void xmlEndTagCallback(ConfigurationContext const &context, XMLTag &callingTag)=0
Callback at end of XML tag and at end of subtag.
virtual ~Listener()=default