示例#1
0
    void
    flatten_tree (TypeInfo const& ti, TypeInfoSet& set)
    {
      set.insert (ti);

      for (TypeInfo::BaseIterator i = ti.begin_base ();
           i != ti.end_base ();
           i++)
      {
        flatten_tree (i->type_info (), set);
      }
    }
示例#2
0
    unsigned long
    compute_levels (TypeInfo const& ti, unsigned long cur, LevelMap& map)
    {
      unsigned long ret = cur;

      if (map.find (ti) == map.end () || map[ti] < cur) map[ti] = cur;

      for (TypeInfo::BaseIterator i = ti.begin_base ();
           i != ti.end_base ();
           i++)
      {
        unsigned long t = compute_levels (i->type_info (), cur + 1, map);
        if (t > ret) ret = t;
      }

      return ret;
    }
示例#3
0
void
print_inheritance_tree_core (std::ostream& os,
                             TypeInfo const& ti,
                             TypeIdSet& set)
{
  bool nl = false;

  for (TypeInfo::BaseIterator i = ti.begin_base ();
       i != ti.end_base ();
       i++)
  {
    TypeId tid (i->type_info ().type_id ());

    if (set.find (tid) != set.end ()) continue;

    nl = true;
    set.insert (tid);
    print_inheritance_tree_core (os, i->type_info (), set);
  }

  if (nl) os << endl;

  os << ti.type_id () << "  ";
}