model_server/xref/src/xrefSymbol.h.cxx
/***************************************************************************/
// The following function is called to determine whether a given invocation
// of xrefSymbol::get_link can be satisfied by looking only in the current
// pmod or whether a global scan is required.  There are three conditions
// under which a global scan is required:
//
// 1) The "force_global" flag is set.  This flag is used to support an
// unfortunate choice of linkTypes used to implement user-defined relations:
// the oodt_relation is "used_by" the source class and "is_using" the
// target class.  Since the source, target, and relation can all be in
// different pmods, a global scan is required, even though "is_using" is
// normally satisfied by looking only in the pmod of the definition of the
// symbol.  The "force_global" flag is set when xrefSymbol::get_link is
// called with the "rec" argument set to -1 (normally, a value of 0 is
// supplied and 1 is used to prevent infinite recursion when the function
// is called as part of a global scan).
//
// 2) The symbol is a "reference" symbol, i.e., it was created only to have
// a placeholder for links with a symbol in a different pmod from the one
// that contains the definition of the symbol.  Reference symbols are
// identified by either "has_def_file" being false or by their definition
// file symbol's "has_def_file" being false.  (The latter case arises to
// support group/subsystem references -- the group's symbol will likely
// be in a different pmod from the member's, and the only way to keep
// track of different symbols with the same name is to supply a "reference"
// symbol for the definition file.)
//
// 3) The linkType itself is one that indicates that a global scan is
// needed -- for instance, "used_by" requires a global scan to find all
// the symbols that reference this one.
The following function is called to determine whether a given invocation
of xrefSymbol::get_link can be satisfied by looking only in the current
pmod or whether a global scan is required.  There are three conditions
under which a global scan is required.

1) The "force_global" flag is set.  This flag is used to support an
unfortunate choice of linkTypes used to implement user-defined relations:
the oodt_relation is "used_by" the source class and "is_using" the
target class.  Since the source, target, and relation can all be in
different pmods, a global scan is required, even though "is_using" is
normally satisfied by looking only in the pmod of the definition of the
symbol.  The "force_global" flag is set when xrefSymbol::get_link is
called with the "rec" argument set to -1 (normally, a value of 0 is
supplied and 1 is used to prevent infinite recursion when the function
is called as part of a global scan).

2) The symbol is a "reference" symbol, i.e., it was created only to have
a placeholder for links with a symbol in a different pmod from the one
that contains the definition of the symbol.  Reference symbols are
identified by either "has_def_file" being false or by their definition
file symbol's "has_def_file" being false.  (The latter case arises to
support group/subsystem references -- the group's symbol will likely
be in a different pmod from the member's, and the only way to keep
track of different symbols with the same name is to supply a "reference"
symbol for the definition file.)

3) The linkType itself is one that indicates that a global scan is
needed -- for instance, "used_by" requires a global scan to find all
the symbols that reference this one.
The following function is called to determine whether a given invocation of xrefSymbol :: get_link can be satisfied by looking only in the current pmod or whether a global scan is required . There are three conditions under which a global scan is required . 1 ) The " force_global " flag is set . This flag is used to support an unfortunate choice of linkTypes used to implement user - defined relations : the oodt_relation is " used_by " the source class and " is_using " the target class . Since the source target and relation can all be in different pmods a global scan is required even though " is_using " is normally satisfied by looking only in the pmod of the definition of the symbol . The " force_global " flag is set when xrefSymbol :: get_link is called with the " rec " argument set to - 1 ( normally a value of 0 is supplied and 1 is used to prevent infinite recursion when the function is called as part of a global scan ) . 2 ) The symbol is a " reference " symbol i . e . it was created only to have a placeholder for links with a symbol in a different pmod from the one that contains the definition of the symbol . Reference symbols are identified by either " has_def_file " being false or by their definition file symbol ' s " has_def_file " being false . ( The latter case arises to support group / subsystem references -- the group ' s symbol will likely be in a different pmod from the member ' s and the only way to keep track of different symbols with the same name is to supply a " reference " symbol for the definition file . ) 3 ) The linkType itself is one that indicates that a global scan is needed -- for instance " used_by " requires a global scan to find all the symbols that reference this one .
int xrefSymbol::local_only(linkType lt, int , XrefTable* Xr)
{ 
   bool result;
   if (force_global) {
      result = false;
   }
   else {
      bool is_reference;
      if (get_has_def_file(Xr)) {
	 if (lt == is_defined_in) {	
	    is_reference = false;
	 }
	 else {
	    symbolArr def_files;
	    if (get_link(is_defined_in, def_files, 1)) {
	       symbolPtr dfs = def_files[0];
	       is_reference = !dfs.get_has_def_file();
	    }
	    else is_reference = true;
	 }
      }
      else is_reference = true;
      if (is_reference) {
	 result = false;
      }
      else result = linkTypes::local_search[lt];
   }
   return result;
}
int xrefSymbol :: local_only ( linkType lt , int , XrefTable * Xr ) { bool result ; if ( force_global ) { result = false ; } else { bool is_reference ; if ( get_has_def_file ( Xr ) ) { if ( lt == is_defined_in ) { is_reference = false ; } else { symbolArr def_files ; if ( get_link ( is_defined_in , def_files , 1 ) ) { symbolPtr dfs = def_files [ 0 ] ; is_reference = ! dfs . get_has_def_file ( ) ; } else is_reference = true ; } } else is_reference = true ; if ( is_reference ) { result = false ; } else result = linkTypes :: local_search [ lt ] ; } return result ; }
The following function is called to determine whether a given invocation
of xrefSymbol::get_link can be satisfied by looking only in the current
pmod or whether a global scan is required.
The following function is called to determine whether a given invocation of xrefSymbol :: get_link can be satisfied by looking only in the current pmod or whether a global scan is required .
/*size */ //Initialize(local_only); // prevent infinite recursion // look only in current pmod for def file symbol: