Nektar++
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Nektar::LibUtilities::SessionNode Class Reference

A single node of a format-neutral session configuration tree. More...

#include <SessionNode.h>

Public Types

typedef std::vector< std::pair< std::string, std::string > > AttributeMap
 Ordered list of (name, value) attribute pairs.
 
typedef std::vector< SessionNode > ChildList
 Ordered list of child nodes.
 

Public Member Functions

 SessionNode ()=default
 Construct an empty, unnamed node.
 
 SessionNode (std::string name, std::string text="")
 Construct a node called name, optionally carrying text.
 
const std::string & GetName () const
 Returns the name of this node, e.g. "FORCE".
 
const std::string & GetPath () const
 Returns the path of this node from the root of the tree it belongs to, e.g. "FORCING/FORCE/COEFF".
 
const std::string & GetText () const
 Returns the text carried by this node, or an empty string if it carries none.
 
bool DefinesText () const
 Returns true if this node carries a non-empty block of text.
 
std::string Describe () const
 Returns a short human-readable rendering of this node, naming its path and its attributes, for use in diagnostics.
 
bool DefinesAttribute (const std::string &name) const
 Returns true if this node has an attribute called name.
 
const std::string & GetAttribute (const std::string &name) const
 Returns the value of attribute name; a fatal error is raised if the attribute is not defined.
 
std::string GetAttribute (const std::string &name, const std::string &def) const
 Returns the value of attribute name, or def if it is not defined.
 
const AttributeMap & GetAttributes () const
 Returns all of this node's attributes, in the order they were supplied.
 
template<typename T >
T GetAttributeAs (const std::string &name) const
 Returns attribute name converted to a T; a fatal error is raised if the attribute is not defined or does not convert.
 
template<typename T >
T GetAttributeAs (const std::string &name, const T &def) const
 Returns attribute name converted to a T, or def if the attribute is not defined; a fatal error is raised if it is defined but does not convert.
 
bool DefinesChild (const std::string &name) const
 Returns true if this node has at least one child called name.
 
const SessionNode * GetChildPtr (const std::string &name) const
 Returns the first child called name, or nullptr if there is none.
 
const SessionNode & GetChild (const std::string &name) const
 Returns the first child called name; a fatal error is raised if there is none.
 
const ChildList & GetChildren () const
 Returns every child of this node, in document order.
 
std::vector< const SessionNode * > GetChildren (const std::string &name) const
 Returns every child called name, in document order.
 
const std::string & GetValue (const std::string &name) const
 Returns the text of the first child called name.
 
std::string GetValue (const std::string &name, const std::string &def) const
 Returns the text of the first child called name, or def if there is no such child.
 
template<typename T >
T GetValueAs (const std::string &name) const
 Returns the text of the first child called name converted to a T; a fatal error is raised if there is no such child or it does not convert.
 
template<typename T >
T GetValueAs (const std::string &name, const T &def) const
 Returns the text of the first child called name converted to a T, or def if there is no such child; a fatal error is raised if the child exists but does not convert.
 
const SessionNode * GetTimeLevel (const size_t timeLevel, const bool enableCheck=true) const
 Resolves the TIMELEVEL indirection used by parallel-in-time runs.
 
void AddChild (SessionNode child)
 Appends child to this node's list of children.
 
void SetAttribute (std::string name, std::string value)
 Sets attribute name to value, replacing any existing value.
 
void SetText (std::string text)
 Sets the text carried by this node.
 

Private Member Functions

void UpdatePath (const std::string &parentPath)
 Recomputes m_path from parentPath, recursing into m_children.
 
void ThrowConversionError (const std::string &kind, const std::string &name, const std::string &str) const
 Raises a fatal error describing a failed string conversion.
 

Private Attributes

std::string m_name
 Name of this node.
 
std::string m_path
 Path of this node from the root of its tree; see GetPath().
 
std::string m_text
 Text carried by this node, if any.
 
AttributeMap m_attributes
 Attributes of this node, in the order supplied.
 
ChildList m_children
 Children of this node, in the order supplied.
 

Detailed Description

A single node of a format-neutral session configuration tree.

A SessionNode is a named node carrying an optional block of text, an ordered list of named string attributes, and an ordered list of child nodes. Child names need not be unique: repeated names are how repeated entries (such as the individual FORCE entries of a FORCING section) are represented, and document order is preserved.

The point of the class is that it carries no knowledge of the format the configuration was written in. Solver components that need to read their own bespoke configuration section – forcings, mappings, couplings and so on – take a SessionNode rather than reaching into the session's XML document, so that the same components work unchanged whether the configuration arrived from an XML file, some other file format, or was assembled programmatically by an embedding application.

Trees are cheap to build and are expected to be small (configuration, not data), so nodes own their children by value and are freely copyable.

Reading a section typically looks like:

// <FORCE TYPE="Absorption">
// <COEFF> SpongeCoefficient </COEFF>
// <BOUNDARYREGIONS> 0 </BOUNDARYREGIONS>
// </FORCE>
std::string type = force.GetAttribute("TYPE");
std::string coeff = force.GetValue("COEFF");
std::string regions = force.GetValue("BOUNDARYREGIONS", "");

Accessors come in three flavours: a Defines... predicate; a form taking a default, which is used when the entry is absent; and a form taking no default, which raises a fatal error naming the node's path if the entry is absent. The ...As<T> forms additionally convert the string, raising a fatal error if the text is not a valid T.

Definition at line 120 of file SessionNode.h.

Member Typedef Documentation

◆ AttributeMap

typedef std::vector<std::pair<std::string, std::string> > Nektar::LibUtilities::SessionNode::AttributeMap

Ordered list of (name, value) attribute pairs.

Definition at line 124 of file SessionNode.h.

◆ ChildList

Ordered list of child nodes.

Definition at line 126 of file SessionNode.h.

Constructor & Destructor Documentation

◆ SessionNode() [1/2]

Nektar::LibUtilities::SessionNode::SessionNode ( )
default

Construct an empty, unnamed node.

◆ SessionNode() [2/2]

Nektar::LibUtilities::SessionNode::SessionNode ( std::string  name,
std::string  text = "" 
)
explicit

Construct a node called name, optionally carrying text.

Definition at line 212 of file SessionNode.cpp.

213 : m_name(std::move(name)), m_text(std::move(text))
214{
215 m_path = m_name;
216}
std::string m_text
Text carried by this node, if any.
std::string m_path
Path of this node from the root of its tree; see GetPath().
std::string m_name
Name of this node.

References m_name, and m_path.

Member Function Documentation

◆ AddChild()

void Nektar::LibUtilities::SessionNode::AddChild ( SessionNode  child)

Appends child to this node's list of children.

Intended for the readers that build trees and for applications assembling configuration programmatically. Note that this rewrites the paths of child and its descendants, so any pointer or reference previously obtained from child is invalidated.

Definition at line 452 of file SessionNode.cpp.

453{
454 m_children.push_back(std::move(child));
455 m_children.back().UpdatePath(m_path);
456}
ChildList m_children
Children of this node, in the order supplied.

References m_children, and m_path.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), and Nektar::SessionNodeUnitTests::BuildForcingSection().

◆ DefinesAttribute()

bool Nektar::LibUtilities::SessionNode::DefinesAttribute ( const std::string &  name) const

Returns true if this node has an attribute called name.

Definition at line 274 of file SessionNode.cpp.

275{
276 for (const auto &attr : m_attributes)
277 {
278 if (attr.first == name)
279 {
280 return true;
281 }
282 }
283 return false;
284}
AttributeMap m_attributes
Attributes of this node, in the order supplied.

References m_attributes.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), GetAttributeAs(), Nektar::AcousticSystem::v_InitObject(), and Nektar::Dummy::v_InitObject().

◆ DefinesChild()

bool Nektar::LibUtilities::SessionNode::DefinesChild ( const std::string &  name) const

◆ DefinesText()

bool Nektar::LibUtilities::SessionNode::DefinesText ( ) const

Returns true if this node carries a non-empty block of text.

Definition at line 245 of file SessionNode.cpp.

246{
247 return !m_text.empty();
248}

References m_text.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), and Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE().

◆ Describe()

std::string Nektar::LibUtilities::SessionNode::Describe ( ) const

Returns a short human-readable rendering of this node, naming its path and its attributes, for use in diagnostics.

For example: COUPLING/I [PROPERTY = "RECEIVESTEPS", VALUE = "1"]. This is deliberately not XML: it describes the node as the rest of the code sees it, whatever format it was read from.

Definition at line 253 of file SessionNode.cpp.

254{
255 std::string result = m_path;
256
257 if (!m_attributes.empty())
258 {
259 result += " [";
260 for (size_t i = 0; i < m_attributes.size(); ++i)
261 {
262 result += (i ? ", " : "") + m_attributes[i].first + " = \"" +
263 m_attributes[i].second + "\"";
264 }
265 result += "]";
266 }
267
268 return result;
269}

References m_attributes, and m_path.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE().

◆ GetAttribute() [1/2]

const std::string & Nektar::LibUtilities::SessionNode::GetAttribute ( const std::string &  name) const

Returns the value of attribute name; a fatal error is raised if the attribute is not defined.

Definition at line 289 of file SessionNode.cpp.

290{
291 for (const auto &attr : m_attributes)
292 {
293 if (attr.first == name)
294 {
295 return attr.second;
296 }
297 }
298
299 NEKERROR(ErrorUtil::efatal, "Session configuration node '" + m_path +
300 "' has no attribute '" + name + "'.");
301
302 static const std::string empty;
303 return empty;
304}
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...

References Nektar::ErrorUtil::efatal, m_attributes, m_path, and NEKERROR.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), GetAttributeAs(), Nektar::ForcingMovingBody::InitialiseFilter(), Nektar::GlobalMapping::Mapping::Load(), Nektar::Stimulus::Stimulus(), Nektar::SolverUtils::Coupling::v_Init(), Nektar::AcousticSystem::v_InitObject(), and Nektar::Dummy::v_InitObject().

◆ GetAttribute() [2/2]

std::string Nektar::LibUtilities::SessionNode::GetAttribute ( const std::string &  name,
const std::string &  def 
) const

Returns the value of attribute name, or def if it is not defined.

Definition at line 309 of file SessionNode.cpp.

311{
312 for (const auto &attr : m_attributes)
313 {
314 if (attr.first == name)
315 {
316 return attr.second;
317 }
318 }
319 return def;
320}

References m_attributes.

◆ GetAttributeAs() [1/2]

template<typename T >
T Nektar::LibUtilities::SessionNode::GetAttributeAs ( const std::string &  name) const
inline

Returns attribute name converted to a T; a fatal error is raised if the attribute is not defined or does not convert.

Definition at line 187 of file SessionNode.h.

188 {
189 T result{};
190 const std::string &str = GetAttribute(name);
191 if (!SessionNodeConvert::FromString(str, result))
192 {
193 ThrowConversionError("attribute", name, str);
194 }
195 return result;
196 }
const std::string & GetAttribute(const std::string &name) const
Returns the value of attribute name; a fatal error is raised if the attribute is not defined.
void ThrowConversionError(const std::string &kind, const std::string &name, const std::string &str) const
Raises a fatal error describing a failed string conversion.
bool FromString(const std::string &str, std::string &value)
Convert the string str into value.

References Nektar::LibUtilities::SessionNodeConvert::FromString(), GetAttribute(), and ThrowConversionError().

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE().

◆ GetAttributeAs() [2/2]

template<typename T >
T Nektar::LibUtilities::SessionNode::GetAttributeAs ( const std::string &  name,
const T &  def 
) const
inline

Returns attribute name converted to a T, or def if the attribute is not defined; a fatal error is raised if it is defined but does not convert.

Definition at line 202 of file SessionNode.h.

203 {
204 if (!DefinesAttribute(name))
205 {
206 return def;
207 }
208 return GetAttributeAs<T>(name);
209 }
bool DefinesAttribute(const std::string &name) const
Returns true if this node has an attribute called name.

References DefinesAttribute().

◆ GetAttributes()

const SessionNode::AttributeMap & Nektar::LibUtilities::SessionNode::GetAttributes ( ) const

Returns all of this node's attributes, in the order they were supplied.

Definition at line 325 of file SessionNode.cpp.

326{
327 return m_attributes;
328}

References m_attributes.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE().

◆ GetChild()

const SessionNode & Nektar::LibUtilities::SessionNode::GetChild ( const std::string &  name) const

Returns the first child called name; a fatal error is raised if there is none.

Definition at line 356 of file SessionNode.cpp.

357{
358 const SessionNode *child = GetChildPtr(name);
359
360 if (!child)
361 {
362 NEKERROR(ErrorUtil::efatal, "Session configuration node '" + m_path +
363 "' has no child '" + name + "'.");
364
365 static const SessionNode empty;
366 return empty;
367 }
368
369 return *child;
370}
SessionNode()=default
Construct an empty, unnamed node.

References Nektar::ErrorUtil::efatal, GetChildPtr(), m_path, and NEKERROR.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), GetValue(), and Nektar::Stimulus::Stimulus().

◆ GetChildPtr()

const SessionNode * Nektar::LibUtilities::SessionNode::GetChildPtr ( const std::string &  name) const

Returns the first child called name, or nullptr if there is none.

Definition at line 341 of file SessionNode.cpp.

342{
343 for (const auto &child : m_children)
344 {
345 if (child.m_name == name)
346 {
347 return &child;
348 }
349 }
350 return nullptr;
351}

References m_children.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), DefinesChild(), GetChild(), and GetValue().

◆ GetChildren() [1/2]

const SessionNode::ChildList & Nektar::LibUtilities::SessionNode::GetChildren ( ) const

◆ GetChildren() [2/2]

std::vector< const SessionNode * > Nektar::LibUtilities::SessionNode::GetChildren ( const std::string &  name) const

Returns every child called name, in document order.

Definition at line 383 of file SessionNode.cpp.

385{
386 std::vector<const SessionNode *> result;
387
388 for (const auto &child : m_children)
389 {
390 if (child.m_name == name)
391 {
392 result.push_back(&child);
393 }
394 }
395
396 return result;
397}

References m_children.

◆ GetName()

const std::string & Nektar::LibUtilities::SessionNode::GetName ( ) const

Returns the name of this node, e.g. "FORCE".

Definition at line 221 of file SessionNode.cpp.

222{
223 return m_name;
224}

References m_name.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), and Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE().

◆ GetPath()

const std::string & Nektar::LibUtilities::SessionNode::GetPath ( ) const

Returns the path of this node from the root of the tree it belongs to, e.g. "FORCING/FORCE/COEFF".

The path is maintained by AddChild() and is used to make error messages intelligible; it carries no other meaning.

Definition at line 229 of file SessionNode.cpp.

230{
231 return m_path;
232}

References m_path.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), and Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE().

◆ GetText()

const std::string & Nektar::LibUtilities::SessionNode::GetText ( ) const

Returns the text carried by this node, or an empty string if it carries none.

Definition at line 237 of file SessionNode.cpp.

238{
239 return m_text;
240}

References m_text.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE().

◆ GetTimeLevel()

const SessionNode * Nektar::LibUtilities::SessionNode::GetTimeLevel ( const size_t  timeLevel,
const bool  enableCheck = true 
) const

Resolves the TIMELEVEL indirection used by parallel-in-time runs.

A section may replace its contents with a series of TIMELEVEL children, each carrying a VALUE attribute, so that different time levels see different settings.

If this node has no TIMELEVEL children then it is itself returned, so that the common case of a section which does not vary with time level needs no special handling by the caller. Otherwise the child matching timeLevel is returned, or nullptr if none matches – meaning that this section simply does not apply at timeLevel, and the caller should skip it.

Parameters
timeLevelThe time level to select.
enableCheckIf true, a fatal error is raised, rather than nullptr returned, when this node has TIMELEVEL children but none matches timeLevel.

Definition at line 420 of file SessionNode.cpp.

422{
423 std::vector<const SessionNode *> levels = GetChildren("TIMELEVEL");
424
425 if (levels.empty())
426 {
427 return this;
428 }
429
430 for (const SessionNode *level : levels)
431 {
432 if (level->GetAttributeAs<size_t>("VALUE") == timeLevel)
433 {
434 return level;
435 }
436 }
437
438 if (enableCheck)
439 {
441 "TIMELEVEL value " + std::to_string(timeLevel) +
442 " not found in session configuration node '" + m_path +
443 "'.");
444 }
445
446 return nullptr;
447}
const ChildList & GetChildren() const
Returns every child of this node, in document order.

References Nektar::ErrorUtil::efatal, GetChildren(), m_path, and NEKERROR.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::GlobalMapping::Mapping::Load(), Nektar::SolverUtils::Forcing::Load(), and Nektar::GlobalMapping::Mapping::ReplaceField().

◆ GetValue() [1/2]

const std::string & Nektar::LibUtilities::SessionNode::GetValue ( const std::string &  name) const

Returns the text of the first child called name.

This is the dominant way of reading a configuration section, in which each setting is a child node carrying a single value, as in <COEFF> SpongeCoefficient </COEFF>. A fatal error is raised if there is no such child.

Definition at line 402 of file SessionNode.cpp.

403{
404 return GetChild(name).m_text;
405}
const SessionNode & GetChild(const std::string &name) const
Returns the first child called name; a fatal error is raised if there is none.

References GetChild(), and m_text.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SolverUtils::ForcingAbsorption::CalcAbsorption(), Nektar::ForcingMovingBody::CheckIsFromFile(), Nektar::RigidSolver::GetFilterInfo(), GetValueAs(), Nektar::RigidSolver::InitBodySolver(), Nektar::RigidSolver::LoadParameters(), Nektar::GlobalMapping::Mapping::v_InitObject(), Nektar::SolverUtils::ForcingAbsorption::v_InitObject(), Nektar::SolverUtils::ForcingBody::v_InitObject(), Nektar::ForcingQuasi1D::v_InitObject(), and Nektar::SolverUtils::ForcingLorentz::v_InitObject().

◆ GetValue() [2/2]

std::string Nektar::LibUtilities::SessionNode::GetValue ( const std::string &  name,
const std::string &  def 
) const

Returns the text of the first child called name, or def if there is no such child.

Definition at line 410 of file SessionNode.cpp.

412{
413 const SessionNode *child = GetChildPtr(name);
414 return child ? child->m_text : def;
415}

References GetChildPtr(), and m_text.

◆ GetValueAs() [1/2]

template<typename T >
T Nektar::LibUtilities::SessionNode::GetValueAs ( const std::string &  name) const
inline

Returns the text of the first child called name converted to a T; a fatal error is raised if there is no such child or it does not convert.

Definition at line 253 of file SessionNode.h.

254 {
255 T result{};
256 const std::string &str = GetValue(name);
257 if (!SessionNodeConvert::FromString(str, result))
258 {
259 ThrowConversionError("value", name, str);
260 }
261 return result;
262 }
const std::string & GetValue(const std::string &name) const
Returns the text of the first child called name.

References Nektar::LibUtilities::SessionNodeConvert::FromString(), GetValue(), and ThrowConversionError().

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::ProtocolS1::ProtocolS1(), Nektar::ProtocolS1S2::ProtocolS1S2(), Nektar::ProtocolSingle::ProtocolSingle(), Nektar::StimulusCirc::StimulusCirc(), Nektar::StimulusPoint::StimulusPoint(), Nektar::StimulusRect::StimulusRect(), Nektar::GlobalMapping::Mapping::v_InitObject(), and Nektar::SolverUtils::ForcingNoise::v_InitObject().

◆ GetValueAs() [2/2]

template<typename T >
T Nektar::LibUtilities::SessionNode::GetValueAs ( const std::string &  name,
const T &  def 
) const
inline

Returns the text of the first child called name converted to a T, or def if there is no such child; a fatal error is raised if the child exists but does not convert.

Definition at line 268 of file SessionNode.h.

269 {
270 if (!DefinesChild(name))
271 {
272 return def;
273 }
274 return GetValueAs<T>(name);
275 }
bool DefinesChild(const std::string &name) const
Returns true if this node has at least one child called name.

References DefinesChild().

◆ SetAttribute()

void Nektar::LibUtilities::SessionNode::SetAttribute ( std::string  name,
std::string  value 
)

Sets attribute name to value, replacing any existing value.

Definition at line 461 of file SessionNode.cpp.

462{
463 for (auto &attr : m_attributes)
464 {
465 if (attr.first == name)
466 {
467 attr.second = std::move(value);
468 return;
469 }
470 }
471
472 m_attributes.emplace_back(std::move(name), std::move(value));
473}

References m_attributes.

Referenced by Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BOOST_AUTO_TEST_CASE(), Nektar::SessionNodeUnitTests::BuildForcingSection(), and Nektar::LibUtilities::SessionNodeFromXml().

◆ SetText()

void Nektar::LibUtilities::SessionNode::SetText ( std::string  text)

Sets the text carried by this node.

Definition at line 478 of file SessionNode.cpp.

479{
480 m_text = std::move(text);
481}

References m_text.

◆ ThrowConversionError()

void Nektar::LibUtilities::SessionNode::ThrowConversionError ( const std::string &  kind,
const std::string &  name,
const std::string &  str 
) const
private

Raises a fatal error describing a failed string conversion.

Definition at line 499 of file SessionNode.cpp.

502{
503 NEKERROR(ErrorUtil::efatal, "Unable to interpret " + kind + " '" + name +
504 "' of session configuration node '" +
505 m_path + "': got '" + str + "'.");
506}

References Nektar::ErrorUtil::efatal, m_path, and NEKERROR.

Referenced by GetAttributeAs(), and GetValueAs().

◆ UpdatePath()

void Nektar::LibUtilities::SessionNode::UpdatePath ( const std::string &  parentPath)
private

Recomputes m_path from parentPath, recursing into m_children.

Definition at line 486 of file SessionNode.cpp.

487{
488 m_path = parentPath.empty() ? m_name : parentPath + "/" + m_name;
489
490 for (auto &child : m_children)
491 {
492 child.UpdatePath(m_path);
493 }
494}

References m_children, m_name, and m_path.

Member Data Documentation

◆ m_attributes

AttributeMap Nektar::LibUtilities::SessionNode::m_attributes
private

Attributes of this node, in the order supplied.

Definition at line 328 of file SessionNode.h.

Referenced by DefinesAttribute(), Describe(), GetAttribute(), GetAttribute(), GetAttributes(), and SetAttribute().

◆ m_children

ChildList Nektar::LibUtilities::SessionNode::m_children
private

Children of this node, in the order supplied.

Definition at line 330 of file SessionNode.h.

Referenced by AddChild(), GetChildPtr(), GetChildren(), GetChildren(), and UpdatePath().

◆ m_name

std::string Nektar::LibUtilities::SessionNode::m_name
private

Name of this node.

Definition at line 322 of file SessionNode.h.

Referenced by GetName(), SessionNode(), and UpdatePath().

◆ m_path

std::string Nektar::LibUtilities::SessionNode::m_path
private

Path of this node from the root of its tree; see GetPath().

Definition at line 324 of file SessionNode.h.

Referenced by AddChild(), Describe(), GetAttribute(), GetChild(), GetPath(), GetTimeLevel(), SessionNode(), ThrowConversionError(), and UpdatePath().

◆ m_text

std::string Nektar::LibUtilities::SessionNode::m_text
private

Text carried by this node, if any.

Definition at line 326 of file SessionNode.h.

Referenced by DefinesText(), GetText(), GetValue(), GetValue(), and SetText().