#include <CoordinateSystem.h>
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 |
Definition at line 77 of file CoordinateSystem.h.
GnpNpsCoordsInfo::GnpNpsCoordsInfo | ( | ) | [inline] |
Definition at line 80 of file CoordinateSystem.h.
00080 { npsLayer = -1; };
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 }
int8_t GnpNpsCoordsInfo::npsLayer [protected] |
Definition at line 92 of file CoordinateSystem.h.
Referenced by getLayer(), GnpNpsCoordsInfo(), isValid(), operator std::vector< double >(), setLayer(), and update().