39 #ifndef __OPENFLUID_CORE_TREE_HPP__ 
   40 #define __OPENFLUID_CORE_TREE_HPP__ 
   49 namespace openfluid { 
namespace core {
 
   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();
 
  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);
 
Tree< K, V > & addChild(const K &Key)
Definition: Tree.hpp:297
Children_t m_Children
Definition: Tree.hpp:68
V m_Value
Definition: Tree.hpp:66
bool m_HasValue
Definition: Tree.hpp:70
V getValue() const 
Definition: Tree.hpp:103
bool hasChild(const K &Key) const 
Definition: Tree.hpp:259
iterator end()
Definition: Tree.hpp:360
V getValue(const V &DefaultVal) const 
Definition: Tree.hpp:121
void writeToStreamFlat(std::ostream &OutStm) const 
Definition: Tree.hpp:447
void setValue(const V &Val)
Definition: Tree.hpp:138
Children_t & children()
Definition: Tree.hpp:167
void deleteChild(const K &Key)
Definition: Tree.hpp:316
bool hasValue() const 
Definition: Tree.hpp:153
const_iterator begin() const 
Definition: Tree.hpp:346
iterator begin()
Definition: Tree.hpp:332
const Children_t & children() const 
Definition: Tree.hpp:181
Definition: FrameworkException.hpp:50
V getChildValue(const K &Key, const V &DefaultVal) const 
Definition: Tree.hpp:240
Tree< K, V > & addChild(const K &Key, const V &Val)
Definition: Tree.hpp:275
void clear()
Definition: Tree.hpp:387
const_iterator end() const 
Definition: Tree.hpp:374
Children_t::const_iterator const_iterator
Definition: Tree.hpp:61
unsigned int size() const 
Definition: Tree.hpp:406
const Tree< K, V > & child(const K &Key) const 
Definition: Tree.hpp:218
std::string keyToStr(const K &Key) const 
Definition: Tree.hpp:73
std::map< K, Tree< K, V > > Children_t
Definition: Tree.hpp:57
#define OPENFLUID_API
Definition: dllexport.hpp:87
Tree< K, V > & child(const K &Key)
Definition: Tree.hpp:197
Children_t::iterator iterator
Definition: Tree.hpp:59
void writeToStreamHierarchically(std::ostream &OutStm, unsigned int Indent=0) const 
Definition: Tree.hpp:426