ns-allinone-2.35/olsr/OLSR.cc
int
OLSR::degree(OLSR_nb_tuple* tuple) {
	int degree = 0;
	for (nb2hopset_t::iterator it = nb2hopset().begin(); it != nb2hopset().end(); it++) {
		OLSR_nb2hop_tuple* nb2hop_tuple = *it;
		if (nb2hop_tuple->nb_main_addr() == tuple->nb_main_addr()) {
			OLSR_nb_tuple* nb_tuple =
				state_.find_nb_tuple(nb2hop_tuple->nb_main_addr());
			if (nb_tuple == NULL)
				degree++;
		}
	}
	return degree;
}
///
/// \brief This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set.
///
/// \param tuple the neighbor tuple which has the main address of the node we are going to calculate its degree to.
/// \return the degree of the node.
///
\brief This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set.
\param tuple the neighbor tuple which has the main address of the node we are going to calculate its degree to.
\return the degree of the node.
\ brief This auxiliary function ( defined in RFC 3626 ) is used for calculating the MPR Set . \ param tuple the neighbor tuple which has the main address of the node we are going to calculate its degree to . \ return the degree of the node .
int
OLSR::degree(OLSR_nb_tuple* tuple) {
	int degree = 0;
	for (nb2hopset_t::iterator it = nb2hopset().begin(); it != nb2hopset().end(); it++) {
		OLSR_nb2hop_tuple* nb2hop_tuple = *it;
		if (nb2hop_tuple->nb_main_addr() == tuple->nb_main_addr()) {
			OLSR_nb_tuple* nb_tuple =
				state_.find_nb_tuple(nb2hop_tuple->nb_main_addr());
			if (nb_tuple == NULL)
				degree++;
		}
	}
	return degree;
}
int OLSR :: degree ( OLSR_nb_tuple * tuple ) { int degree = 0 ; for ( nb2hopset_t :: iterator it = nb2hopset ( ) . begin ( ) ; it != nb2hopset ( ) . end ( ) ; it ++ ) { OLSR_nb2hop_tuple * nb2hop_tuple = * it ; if ( nb2hop_tuple -> nb_main_addr ( ) == tuple -> nb_main_addr ( ) ) { OLSR_nb_tuple * nb_tuple = state_ . find_nb_tuple ( nb2hop_tuple -> nb_main_addr ( ) ) ; if ( nb_tuple == NULL ) degree ++ ; } } return degree ; }
\brief This auxiliary function (defined in RFC 3626) is used for calculating the MPR Set.
\ brief This auxiliary function ( defined in RFC 3626 ) is used for calculating the MPR Set .