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());
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();
401 inline const_iterator
end()
const 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);
const Tree< K, V > & child(const K &Key) const
Definition: Tree.hpp:233
iterator end()
Definition: Tree.hpp:387
V getValue() const
Definition: Tree.hpp:108
Tree< K, V > & child(const K &Key)
Definition: Tree.hpp:210
Children_t & children()
Definition: Tree.hpp:180
std::map< K, Tree< K, V > > Children_t
Definition: Tree.hpp:59
V m_Value
Definition: Tree.hpp:68
iterator begin()
Definition: Tree.hpp:359
Children_t::const_iterator const_iterator
Definition: Tree.hpp:63
V getValue(const V &DefaultVal) const
Definition: Tree.hpp:130
Definition: FrameworkException.hpp:50
Definition: ApplicationException.hpp:47
V getChildValue(const K &Key, const V &DefaultVal) const
Definition: Tree.hpp:257
Children_t::iterator iterator
Definition: Tree.hpp:61
std::string keyToStr(const K &Key) const
Definition: Tree.hpp:75
void writeToStreamFlat(std::ostream &OutStm) const
Definition: Tree.hpp:482
const_iterator end() const
Definition: Tree.hpp:401
Tree< K, V > & addChild(const K &Key, const V &Val)
Definition: Tree.hpp:295
void deleteChild(const K &Key)
Definition: Tree.hpp:340
bool m_HasValue
Definition: Tree.hpp:72
const Children_t & children() const
Definition: Tree.hpp:194
bool hasChild(const K &Key) const
Definition: Tree.hpp:278
unsigned int size() const
Definition: Tree.hpp:435
const_iterator begin() const
Definition: Tree.hpp:373
#define OPENFLUID_API
Definition: dllexport.hpp:86
void writeToStreamHierarchically(std::ostream &OutStm, unsigned int Indent=0) const
Definition: Tree.hpp:457
Children_t m_Children
Definition: Tree.hpp:70
void clear()
Definition: Tree.hpp:414
void setValue(const V &Val)
Definition: Tree.hpp:151
bool hasValue() const
Definition: Tree.hpp:166
Tree< K, V > & addChild(const K &Key)
Definition: Tree.hpp:319