model_server/xref/src/xrefSymbol.h.cxx
// for now only get hard assoc, should extend later for other objs.
for now only get hard assoc, should extend later for other objs.
for now only get hard assoc should extend later for other objs .
int xrefSymbol::get_equivalence_obj(symbolArr & sa , XrefTable* Xr)
{
  Initialize(xrefSymbol::get_equivalence_obj);
  int start_set_size, res_set_size;
  xrefSymbolSet s1;
  xrefSymbolSet s2;
  xrefSymbolSet *start_set;
  xrefSymbolSet *res_set;
  xrefSymbolSet *tmp_set;
  xrefSymbol *  sym1;
  symbolArr sa1;
  symbolArr mem_arr;
  start_set = &s1;
  res_set = &s2;
  s1.insert(this);
  s2.insert(this);
  do {
    tmp_set = start_set;
    start_set = res_set;
    res_set = start_set;
    start_set_size = start_set->size();
    Iterator it1(*start_set);
    while(++it1,sym1 = (xrefSymbol*) it1()){
      res_set->insert(sym1);
      linkTypes la;
      la.add(assoc_of_sym);
      la.add(sym_of_assoc);
      la.add(linknode_of_src_sym);
      la.add(trg_sym_of_linknode);
      sym1->get_links(la, sa1, Xr, 0);
      for (int i = 0; i < sa1.size(); ++i) {
	xrefSymbol * sym = sa1[i];
	res_set->insert(sym);
      }
      sa1.removeAll();
      if (sym1->get_kind() == DD_CLASS) {
	mem_arr.removeAll();
	if (sym1->get_link(is_using, mem_arr)) {
	  const int sz = mem_arr.size();
	  for (int i = 0; i < sz; ++i) {
	    xrefSymbol * mem = mem_arr[i];
	    if (is_constructor(mem->get_name(mem_arr[i].get_xref()->get_lxref())))
	      res_set->insert(mem);
	  }
        }
      }	
    }
    res_set_size = res_set->size();
  } while (start_set_size < res_set_size);
  Iterator it2(*res_set);
  while(++it2,sym1 = (xrefSymbol*) it2())
    sa.insert_last(sym1);
  return sa.size();
}
int xrefSymbol :: get_equivalence_obj ( symbolArr & sa , XrefTable * Xr ) { Initialize ( xrefSymbol :: get_equivalence_obj ) ; int start_set_size , res_set_size ; xrefSymbolSet s1 ; xrefSymbolSet s2 ; xrefSymbolSet * start_set ; xrefSymbolSet * res_set ; xrefSymbolSet * tmp_set ; xrefSymbol * sym1 ; symbolArr sa1 ; symbolArr mem_arr ; start_set = & s1 ; res_set = & s2 ; s1 . insert ( this ) ; s2 . insert ( this ) ; do { tmp_set = start_set ; start_set = res_set ; res_set = start_set ; start_set_size = start_set -> size ( ) ; Iterator it1 ( * start_set ) ; while ( ++ it1 , sym1 = ( xrefSymbol * ) it1 ( ) ) { res_set -> insert ( sym1 ) ; linkTypes la ; la . add ( assoc_of_sym ) ; la . add ( sym_of_assoc ) ; la . add ( linknode_of_src_sym ) ; la . add ( trg_sym_of_linknode ) ; sym1 -> get_links ( la , sa1 , Xr , 0 ) ; for ( int i = 0 ; i < sa1 . size ( ) ; ++ i ) { xrefSymbol * sym = sa1 [ i ] ; res_set -> insert ( sym ) ; } sa1 . removeAll ( ) ; if ( sym1 -> get_kind ( ) == DD_CLASS ) { mem_arr . removeAll ( ) ; if ( sym1 -> get_link ( is_using , mem_arr ) ) { const int sz = mem_arr . size ( ) ; for ( int i = 0 ; i < sz ; ++ i ) { xrefSymbol * mem = mem_arr [ i ] ; if ( is_constructor ( mem -> get_name ( mem_arr [ i ] . get_xref ( ) -> get_lxref ( ) ) ) ) res_set -> insert ( mem ) ; } } } } res_set_size = res_set -> size ( ) ; } while ( start_set_size < res_set_size ) ; Iterator it2 ( * res_set ) ; while ( ++ it2 , sym1 = ( xrefSymbol * ) it2 ( ) ) sa . insert_last ( sym1 ) ; return sa . size ( ) ; }
for now only get hard assoc, should extend later for other objs.
for now only get hard assoc should extend later for other objs .