39 #ifndef __OPENFLUID_CORE_TREE_HPP__ 40 #define __OPENFLUID_CORE_TREE_HPP__ 52 template<
typename K,
typename V>
59 typedef typename Children_t::iterator
iterator;
75 std::ostringstream oss;
77 if (!(oss << Key).fail())
199 auto it = m_Children.find(Key);
201 if (it == m_Children.end())
220 auto it = m_Children.find(Key);
222 if (it == m_Children.end())
242 auto it = m_Children.find(Key);
244 if (it == m_Children.end())
247 return (*it).second.getValue(DefaultVal);
261 return (m_Children.find(Key) != m_Children.end());
283 return m_Children[Key];
304 return m_Children[Key];
318 auto it = m_Children.find(Key);
320 if (it != m_Children.end())
321 m_Children.erase(it);
334 return m_Children.begin();
348 return m_Children.begin();
362 return m_Children.end();
374 inline const_iterator
end()
const 376 return m_Children.end();
391 for (
auto& ChildNode : m_Children)
392 ChildNode.second.clear();
410 for (
auto& ChildNode : m_Children)
411 Size += ChildNode.second.size();
428 for (
auto& ChildNode : m_Children)
431 OutStm << std::setw(Indent);
433 OutStm <<
"[" << ChildNode.first;
434 if (ChildNode.second.hasValue())
435 OutStm <<
" -> " << ChildNode.second.getValue();
438 ChildNode.second.writeToStreamHierarchically(OutStm,Indent+4);
449 for (
auto& ChildNode : m_Children)
451 OutStm <<
"{" << ChildNode.first;
452 if (ChildNode.second.hasValue())
453 OutStm <<
"(" << ChildNode.second.getValue() <<
")";
454 ChildNode.second.writeToStreamFlat(OutStm);
std::map< K, Tree< K, V > > Children_t
Definition: Tree.hpp:57
unsigned int size() const
Definition: Tree.hpp:406
Definition: FrameworkException.hpp:50
V m_Value
Definition: Tree.hpp:66
Children_t::const_iterator const_iterator
Definition: Tree.hpp:61
void clear()
Definition: Tree.hpp:387
iterator begin()
Definition: Tree.hpp:332
Children_t::iterator iterator
Definition: Tree.hpp:59
V getValue() const
Definition: Tree.hpp:103
const Children_t & children() const
Definition: Tree.hpp:181
V getChildValue(const K &Key, const V &DefaultVal) const
Definition: Tree.hpp:240
#define OPENFLUID_API
Definition: dllexport.hpp:87
bool hasChild(const K &Key) const
Definition: Tree.hpp:259
const_iterator begin() const
Definition: Tree.hpp:346
Tree< K, V > & child(const K &Key)
Definition: Tree.hpp:197
Children_t & children()
Definition: Tree.hpp:167
void deleteChild(const K &Key)
Definition: Tree.hpp:316
bool hasValue() const
Definition: Tree.hpp:153
void writeToStreamHierarchically(std::ostream &OutStm, unsigned int Indent=0) const
Definition: Tree.hpp:426
const Tree< K, V > & child(const K &Key) const
Definition: Tree.hpp:218
const_iterator end() const
Definition: Tree.hpp:374
iterator end()
Definition: Tree.hpp:360
void setValue(const V &Val)
Definition: Tree.hpp:138
Tree< K, V > & addChild(const K &Key, const V &Val)
Definition: Tree.hpp:275
V getValue(const V &DefaultVal) const
Definition: Tree.hpp:121
Tree< K, V > & addChild(const K &Key)
Definition: Tree.hpp:297
std::string keyToStr(const K &Key) const
Definition: Tree.hpp:73
void writeToStreamFlat(std::ostream &OutStm) const
Definition: Tree.hpp:447
Children_t m_Children
Definition: Tree.hpp:68
Definition: ApplicationException.hpp:47
bool m_HasValue
Definition: Tree.hpp:70