Wiselib
Public Types | Public Member Functions
wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P > Class Template Reference

Store information about a single neighbor. More...

#include <localization_neighbor_info.h>

List of all members.

Public Types

typedef OsModel_P OsModel
typedef node_id_t_P node_id_t
typedef NodeSet_P NodeSet
typedef DistanceMap_P DistanceMap
typedef Arithmatic_P Arithmatic
typedef DistanceMap::iterator NeighborIterator

Public Member Functions

 LocalizationNeighborInfo (const LocalizationNeighborInfo &rhs)
LocalizationNeighborInfooperator= (const LocalizationNeighborInfo &rhs)
void set_node (node_id_t)
construction / destruction
 LocalizationNeighborInfo (node_id_t, bool)
 Constructor of new neighbor info.
 LocalizationNeighborInfo ()
 ~LocalizationNeighborInfo ()
update/insert neighborhood
void update_neighbor (node_id_t, Arithmatic)
 Update neighborhood of this neighbor.
void update_neighbors (DistanceMap &)
 Update neighborhood of this neighbor.
reference nodes
void add_ref_node (node_id_t)
 Add a reference node.
void clear_ref_nodes (void)
 Clear reference nodes.
const NodeSetref_nodes (void) const
NodeSetref_nodes_w (void)
set data
void set_pos (const Vec< Arithmatic > &)
 Set position.
void clear_pos ()
 Clear position.
void set_hops (int)
 Set hop count.
void set_distance (Arithmatic)
 Set distance.
void set_confidence (Arithmatic)
 Set confidence.
void set_twin (bool)
 Set twin property.
void set_anchor (bool)
 Set anchor property.
special work on data
void convert_hops (Arithmatic)
 This method converts hop count into distance by multiplying the hop count by given average hop distance.
get data
node_id_t node (void)
Vec< Arithmatic > & pos (void)
int hops (void)
 This method returns the hop count.
Arithmatic distance (void)
Arithmatic confidence (void)
get special data
bool is_anchor (void)
bool is_valid (void)
 A valid neighbor has a position and distance.
bool is_twin (void)
bool has_pos (void)
bool has_distance (void)
bool is_confident (void)
 A confident neighbor has a position and distance.
neighbor information
DistanceMapneighbors (void)
bool has_neighbor (node_id_t)
bool has_neighbor_distance (node_id_t)
Arithmatic neighbor_distance (node_id_t)
 This method returns the distance to given neighbor.
iterators on neighbors
NeighborIterator begin_neighbors (void)
NeighborIterator end_neighbors (void)

Detailed Description

template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
class wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >

Store information about a single neighbor.

This class stores information about a single neighbor which is again collected in LocalizationNeighborhood.

In addition to storing general information about position, hops, distance and if it is a anchor or not, there is a lot of extra data collected.

At first, there is information about confidence and twin. Confidence is used for a weighted least squares approach. A twin is defined as a node which is (or thinks it is) nearly on the same position as the neighbor itself. Both parameters are used, e.g., in LocalizationIterLaterationModule.

Moreover the data of neighborhood is collected. This means, that there is a chance to store a two-hop neighborhood.

At least there are reference nodes. These are defined as nodes neighbors get their information about anchors from, and used by LocalizationNeighborhood to decide whether a node is sound or not.


Member Typedef Documentation

template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
typedef Arithmatic_P wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::Arithmatic
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
typedef DistanceMap_P wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::DistanceMap
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
typedef DistanceMap::iterator wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::NeighborIterator
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
typedef node_id_t_P wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::node_id_t
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
typedef NodeSet_P wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::NodeSet
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
typedef OsModel_P wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::OsModel

Constructor & Destructor Documentation

template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::LocalizationNeighborInfo ( node_id_t  node,
bool  is_anchor 
)

Constructor of new neighbor info.

Parameters:
NodeNeighbor
booltrue, if anchor. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::LocalizationNeighborInfo ( )
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::~LocalizationNeighborInfo ( )
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::LocalizationNeighborInfo ( const LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P > &  rhs) [inline]

Member Function Documentation

template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::add_ref_node ( node_id_t  node)

Add a reference node.

Parameters:
Nodereference node
See also:
LocalizationNeighborhood::is_sound
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
NeighborIterator wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::begin_neighbors ( void  ) [inline]
Returns:
writable iterator to begin of neighbors
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::clear_pos ( )

Clear position.

template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::clear_ref_nodes ( void  )

Clear reference nodes.

See also:
LocalizationNeighborhood::is_sound
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::Arithmatic wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::confidence ( void  )
Returns:
Confidence of this neighbor
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::convert_hops ( Arithmatic  hop_dist)

This method converts hop count into distance by multiplying the hop count by given average hop distance.

Parameters:
Arithmaticaverage hop distance
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::Arithmatic wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::distance ( void  )
Returns:
Distance to this neighbor
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
NeighborIterator wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::end_neighbors ( void  ) [inline]
Returns:
writable iterator to end of neighbors
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::has_distance ( void  )
Returns:
true, if there is distance to this neighbor known. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::has_neighbor ( node_id_t  node)
Parameters:
NodeNode for which is searched in neighborhood
Returns:
true, if given neighbor is part of neighborhood. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::has_neighbor_distance ( node_id_t  node)
Parameters:
NodeNode for which is searched in neighborhood
Returns:
true, if there is distance for given neighbor known. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::has_pos ( void  )
Returns:
true, if this neighbor has a position. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
int wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::hops ( void  )

This method returns the hop count.

If there is no hop count known, it returns localization::UNKNOWN_HOP_CNT

Returns:
Hop count of this neighbor
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::is_anchor ( void  )
Returns:
true, if this neighbor is an anchor. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::is_confident ( void  )

A confident neighbor has a position and distance.

Moreover it is not a twin and has a confidence != 0.

Returns:
true, if this neighbor is confident. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::is_twin ( void  )
Returns:
true, if this neighbor is a twin. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
bool wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::is_valid ( void  )

A valid neighbor has a position and distance.

Returns:
true, if this neighbor is valid. false otherwise
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::Arithmatic wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::neighbor_distance ( node_id_t  node)

This method returns the distance to given neighbor.

If there is no distance known, method returns localization::UNKNOWN_DISTANCE.

Parameters:
NodeNode for which is searched in neighborhood
Returns:
distance to given neighbor
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
DistanceMap_P & wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::neighbors ( void  )
Returns:
DistanceMap of neighborhood
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
node_id_t_P wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::node ( void  )
Returns:
Node id of this neighbor
template<typename OsModel_P, typename node_id_t_P, typename NodeSet_P, typename DistanceMap_P, typename Arithmatic_P>
LocalizationNeighborInfo& wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::operator= ( const LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P > &  rhs) [inline]
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
Vec< Arithmatic_P > & wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::pos ( void  )
Returns:
Position of this neighbor
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
const NodeSet_P & wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::ref_nodes ( void  ) const
Returns:
set of reference nodes
See also:
LocalizationNeighborhood::is_sound
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
NodeSet_P & wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::ref_nodes_w ( void  )
Returns:
writable set of reference nodes
See also:
LocalizationNeighborhood::is_sound
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::set_anchor ( bool  anchor)

Set anchor property.

Parameters:
boolif it is anchor or not
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::set_confidence ( Arithmatic  confidence)

Set confidence.

Parameters:
Arithmaticconfidence
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::set_distance ( Arithmatic  distance)

Set distance.

Parameters:
Arithmaticdistance
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::set_hops ( int  hops)

Set hop count.

Parameters:
inthop count
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::set_node ( node_id_t  node)
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::set_pos ( const Vec< Arithmatic > &  pos)

Set position.

Parameters:
Vecnew position
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::set_twin ( bool  twin)

Set twin property.

Parameters:
boolif it is twin or not
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::update_neighbor ( node_id_t  node,
Arithmatic  distance 
)

Update neighborhood of this neighbor.

If neighbor exists, it is just updated, else inserted.

Parameters:
Nodeneighbor to insert/update
Arithmaticdistance to this neighbor
See also:
update_neighbors()
template<typename OsModel_P , typename node_id_t_P , typename NodeSet_P , typename DistanceMap_P , typename Arithmatic_P >
void wiselib::LocalizationNeighborInfo< OsModel_P, node_id_t_P, NodeSet_P, DistanceMap_P, Arithmatic_P >::update_neighbors ( DistanceMap dm)

Update neighborhood of this neighbor.

If a neighbor exists, it is just updated, else inserted.

Parameters:
DistanceMapneighbors and distances to insert/update
See also:
update_neighbor()

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines