Wiselib
Public Types | Public Member Functions | Public Attributes
concepts::NodeDistanceEstimation_concept Class Reference

Basic Concept for Node Distance Estimation Algorithms. More...

Inherits concepts::BasicAlgorithm_concept, concepts::State_concept, and concepts::StateCallback_concept.

List of all members.

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.

Detailed Description

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.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
SUCCESS 

Default return value of success.

ERR_UNSPEC 

Unspecified error value - if no other fits.

ERR_NOMEM 

Out of memory.

ERR_BUSY 

Device or resource busy - try again later.

ERR_NOTIMPL 

Function not implemented.

ERR_NETDOWN 

Network is down.

ERR_HOSTUNREACH 

No route to host.

Enumerator:
READY 

Ready for returning a value.

NO_VALUE 

There is no value available.

INACTIVE 

Not yet enabled - implementation is inactive and cannot return meaningful values.

OK 

Only State Callback. When callback registration was successful.

FAILED 

Only State Callback. When callback registration failed.

Reimplemented from concepts::State_concept.

Enumerator:
READY 

Ready for asking for data.

NO_VALUE 

Currently no data available.

INACTIVE 

Currently inactive - so no values available.


Member Function Documentation

int concepts::NodeDistanceEstimation_concept::destruct ( )

Turn off algorithm.

State is set to INACTIVE.

Reimplemented from concepts::BasicAlgorithm_concept.

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.


Member Data Documentation

Define distance type.

Define type of node ids - usually taken from Radio.


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