GnpNpsCoordsInfo Class Reference

#include <CoordinateSystem.h>

Inheritance diagram for GnpNpsCoordsInfo:
EuclideanNcsNodeInfo AbstractNcsNodeInfo

List of all members.

Public Member Functions

 GnpNpsCoordsInfo ()
bool isValid ()
int8_t getLayer () const
void setLayer (int8_t layer)
Prox getDistance (const AbstractNcsNodeInfo &abstractInfo) const
bool update (const AbstractNcsNodeInfo &abstractInfo)
 operator std::vector< double > () const

Protected Attributes

int8_t npsLayer

Detailed Description

Definition at line 77 of file CoordinateSystem.h.


Constructor & Destructor Documentation

GnpNpsCoordsInfo::GnpNpsCoordsInfo (  )  [inline]

Definition at line 80 of file CoordinateSystem.h.

00080 { npsLayer = -1; };


Member Function Documentation

Prox GnpNpsCoordsInfo::getDistance ( const AbstractNcsNodeInfo abstractInfo  )  const [virtual]

Implements AbstractNcsNodeInfo.

Definition at line 30 of file CoordinateSystem.cc.

Referenced by Nps::getCoordinateBasedProx().

00031 {
00032     if (!dynamic_cast<const GnpNpsCoordsInfo*>(&abstractInfo)) {
00033         return Prox::PROX_UNKNOWN;
00034     }
00035     const GnpNpsCoordsInfo& info =
00036         *(static_cast<const GnpNpsCoordsInfo*>(&abstractInfo));
00037 
00038     double dist = 0.0;
00039 
00040     for (uint8_t i = 0; i < info.getDimension(); ++i) {
00041         dist += pow(getCoords(i) - info.getCoords(i), 2);
00042     }
00043     dist = sqrt(dist);
00044 
00045     return Prox(dist, 0.7); //TODO
00046 }

int8_t GnpNpsCoordsInfo::getLayer (  )  const [inline]

Definition at line 84 of file CoordinateSystem.h.

Referenced by Nps::coordsReqRpcResponse(), Nps::getOwnLayer(), and operator<<().

00084 { return npsLayer; };

bool GnpNpsCoordsInfo::isValid (  )  [inline, virtual]

Implements AbstractNcsNodeInfo.

Definition at line 82 of file CoordinateSystem.h.

00082 { return npsLayer != -1; };

GnpNpsCoordsInfo::operator std::vector< double > (  )  const [virtual]

Implements AbstractNcsNodeInfo.

Definition at line 61 of file CoordinateSystem.cc.

00061                                                    {
00062     std::vector<double> temp;
00063     for (uint8_t i = 0; i < coordinates.size(); ++i) {
00064         temp.push_back(coordinates[i]);
00065     }
00066     temp.push_back(npsLayer);
00067 
00068     return temp;
00069 }

void GnpNpsCoordsInfo::setLayer ( int8_t  layer  )  [inline]

Definition at line 85 of file CoordinateSystem.h.

Referenced by Nps::init(), and Nps::setOwnLayer().

00085 { npsLayer = layer; };

bool GnpNpsCoordsInfo::update ( const AbstractNcsNodeInfo abstractInfo  )  [virtual]

Implements AbstractNcsNodeInfo.

Definition at line 48 of file CoordinateSystem.cc.

00049 {
00050     if (!dynamic_cast<const GnpNpsCoordsInfo*>(&abstractInfo)) return false;
00051 
00052     const GnpNpsCoordsInfo& temp =
00053         static_cast<const GnpNpsCoordsInfo&>(abstractInfo);
00054 
00055     coordinates = temp.coordinates;
00056     npsLayer = temp.npsLayer;
00057 
00058     return true;
00059 }


Member Data Documentation

int8_t GnpNpsCoordsInfo::npsLayer [protected]

The documentation for this class was generated from the following files:
Generated on Wed May 26 16:21:17 2010 for OverSim by  doxygen 1.6.3