Wiselib
|
Basic Concept for Node Distance Estimation Algorithms. More...
Inherits concepts::BasicAlgorithm_concept, concepts::State_concept, and concepts::StateCallback_concept.
Public Types | |
enum | State { READY, NO_VALUE, INACTIVE, OK, FAILED } |
enum | { SUCCESS, ERR_UNSPEC, ERR_NOMEM, ERR_BUSY, ERR_NOTIMPL, ERR_NETDOWN, ERR_HOSTUNREACH } |
enum | StateValues { READY, NO_VALUE, INACTIVE } |
Public Member Functions | |
int | init () |
Reset algorithm. | |
int | destruct () |
Turn off algorithm. | |
value_t | operator() () |
Return current position. | |
int | state () |
Only State. | |
int | register_state_callback (T *obj_pnt) |
Only State Callback. | |
int | unregister_state_callback (int) |
Unregister state-changed callback. | |
Public Attributes | |
typedef | distance_t |
Define distance type. | |
typedef | node_id_t |
Define type of node ids - usually taken from Radio. |
Basic Concept for Node Distance Estimation Algorithms.
The distance algorithm calculates distances to nodes in the network. Whether only single hop or multi hop depends on the implementation. A distance can be asked for with the operator()(node_id_t) - if not known, UNKNOWN_DISTANCE is returned.
Since distances may also be unknown or not yet calculated, the distance algorithm also implements State or State Callback to indicate whether at least distance is available (state must be READY). The concrete implementation (state or state callback) is implementation dependent, and must be given in documentation. Of course, a model may implement both state and state callback.
anonymous enum [inherited] |
Reimplemented from concepts::State_concept.
enum concepts::BasicReturnValues_concept::StateValues [inherited] |
int concepts::NodeDistanceEstimation_concept::destruct | ( | ) |
int concepts::NodeDistanceEstimation_concept::init | ( | ) |
Reset algorithm.
Known position (if so) is lost, state is set back to NO_VALUE.
Reimplemented from concepts::BasicAlgorithm_concept.
value_t concepts::NodeDistanceEstimation_concept::operator() | ( | ) |
Return current position.
int concepts::NodeDistanceEstimation_concept::register_state_callback | ( | T * | obj_pnt | ) |
Only State Callback.
Register state changed callback function - method signature must be void RCV_METHOD_NAME(int state). Returns either OK or FAILED.
Reimplemented from concepts::StateCallback_concept.
int concepts::NodeDistanceEstimation_concept::state | ( | ) |
Only State.
Return current state - can either be READY, NO_VALUE, or INACTIVE.
Reimplemented from concepts::State_concept.
int concepts::StateCallback_concept::unregister_state_callback | ( | int | ) | [inherited] |
Unregister state-changed callback.
Define distance type.
Define type of node ids - usually taken from Radio.