40 #ifndef __OPENFLUID_CORE_TREE_HPP__
41 #define __OPENFLUID_CORE_TREE_HPP__
54 template<
typename K,
typename V>
61 typedef typename Children_t::iterator
iterator;
77 std::ostringstream oss;
79 if (!(oss << Key).fail())
212 auto it = m_Children.find(Key);
214 if (it == m_Children.end())
235 auto it = m_Children.find(Key);
237 if (it == m_Children.end())
259 auto it = m_Children.find(Key);
261 if (it == m_Children.end())
266 return (*it).second.getValue(DefaultVal);
280 return (m_Children.find(Key) != m_Children.end());
303 m_Children[Key].setValue(Val);
305 return m_Children[Key];
328 return m_Children[Key];
342 auto it = m_Children.find(Key);
344 if (it != m_Children.end())
346 m_Children.erase(it);
361 return m_Children.begin();
375 return m_Children.begin();
389 return m_Children.end();
403 return m_Children.end();
418 for (
auto& ChildNode : m_Children)
420 ChildNode.second.clear();
439 for (
auto& ChildNode : m_Children)
441 Size += ChildNode.second.size();
459 for (
auto& ChildNode : m_Children)
463 OutStm << std::setw(Indent);
466 OutStm <<
"[" << ChildNode.first;
467 if (ChildNode.second.hasValue())
469 OutStm <<
" -> " << ChildNode.second.getValue();
473 ChildNode.second.writeToStreamHierarchically(OutStm,Indent+4);
484 for (
auto& ChildNode : m_Children)
486 OutStm <<
"{" << ChildNode.first;
487 if (ChildNode.second.hasValue())
489 OutStm <<
"(" << ChildNode.second.getValue() <<
")";
491 ChildNode.second.writeToStreamFlat(OutStm);
Definition: FrameworkException.hpp:51
std::string keyToStr(const K &Key) const
Definition: Tree.hpp:75
void deleteChild(const K &Key)
Definition: Tree.hpp:340
void setValue(const V &Val)
Definition: Tree.hpp:151
void writeToStreamHierarchically(std::ostream &OutStm, unsigned int Indent=0) const
Definition: Tree.hpp:457
unsigned int size() const
Definition: Tree.hpp:435
void clear()
Definition: Tree.hpp:414
V getChildValue(const K &Key, const V &DefaultVal) const
Definition: Tree.hpp:257
bool m_HasValue
Definition: Tree.hpp:72
const Children_t & children() const
Definition: Tree.hpp:194
Tree< K, V > & addChild(const K &Key)
Definition: Tree.hpp:319
V getValue() const
Definition: Tree.hpp:108
Children_t::iterator iterator
Definition: Tree.hpp:61
bool hasValue() const
Definition: Tree.hpp:166
Children_t m_Children
Definition: Tree.hpp:70
Children_t & children()
Definition: Tree.hpp:180
V m_Value
Definition: Tree.hpp:68
V getValue(const V &DefaultVal) const
Definition: Tree.hpp:130
void writeToStreamFlat(std::ostream &OutStm) const
Definition: Tree.hpp:482
const Tree< K, V > & child(const K &Key) const
Definition: Tree.hpp:233
const_iterator end() const
Definition: Tree.hpp:401
Tree< K, V > & addChild(const K &Key, const V &Val)
Definition: Tree.hpp:295
iterator end()
Definition: Tree.hpp:387
const_iterator begin() const
Definition: Tree.hpp:373
bool hasChild(const K &Key) const
Definition: Tree.hpp:278
iterator begin()
Definition: Tree.hpp:359
Children_t::const_iterator const_iterator
Definition: Tree.hpp:63
Tree< K, V > & child(const K &Key)
Definition: Tree.hpp:210
std::map< K, Tree< K, V > > Children_t
Definition: Tree.hpp:59
#define OPENFLUID_API
Definition: dllexport.hpp:86
Definition: ApplicationException.hpp:47