OverSim
EuclideanNcsNodeInfo Class Reference

#include <CoordinateSystem.h>

Inheritance diagram for EuclideanNcsNodeInfo:
AbstractNcsNodeInfo GnpNpsCoordsInfo SimpleCoordsInfo SimpleUnderlayCoordsInfo VivaldiCoordsInfo

Public Member Functions

 EuclideanNcsNodeInfo ()
virtual ~EuclideanNcsNodeInfo ()
uint8_t getDimension () const
double getCoords (uint8_t i) const
const CoordsgetCoords () const
void setCoords (uint8_t i, double value)
Prox getDistance (const AbstractNcsNodeInfo &abstractInfo) const
- Public Member Functions inherited from AbstractNcsNodeInfo
virtual ~AbstractNcsNodeInfo ()
virtual bool isValid ()=0
virtual bool update (const AbstractNcsNodeInfo &info)=0
virtual operator Coords () const =0

Static Public Member Functions

static void setDimension (uint8_t dimension)

Protected Attributes

Coords coordinates

Static Protected Attributes

static uint8_t dim

Detailed Description

Definition at line 55 of file CoordinateSystem.h.

Constructor & Destructor Documentation

EuclideanNcsNodeInfo::EuclideanNcsNodeInfo ( )
inline

Definition at line 58 of file CoordinateSystem.h.

{ coordinates.resize(dim); };
virtual EuclideanNcsNodeInfo::~EuclideanNcsNodeInfo ( )
inlinevirtual

Definition at line 59 of file CoordinateSystem.h.

{ };

Member Function Documentation

double EuclideanNcsNodeInfo::getCoords ( uint8_t  i) const
inline
const Coords& EuclideanNcsNodeInfo::getCoords ( ) const
inlinevirtual
uint8_t EuclideanNcsNodeInfo::getDimension ( ) const
inline
Prox EuclideanNcsNodeInfo::getDistance ( const AbstractNcsNodeInfo abstractInfo) const
virtual

Implements AbstractNcsNodeInfo.

Reimplemented in VivaldiCoordsInfo, SimpleCoordsInfo, and SimpleUnderlayCoordsInfo.

Definition at line 30 of file CoordinateSystem.cc.

Referenced by Nps::getCoordinateBasedProx().

{
if (!dynamic_cast<const EuclideanNcsNodeInfo*>(&abstractInfo)) {
}
const EuclideanNcsNodeInfo& info =
*(static_cast<const EuclideanNcsNodeInfo*>(&abstractInfo));
double dist = 0.0;
for (uint8_t i = 0; i < info.getDimension(); ++i) {
dist += pow(getCoords(i) - info.getCoords(i), 2);
}
dist = sqrt(dist) / 1000;
// old calculation based on s not ms
// dist = sqrt(dist);
return Prox(dist, 0.7); //TODO
}
void EuclideanNcsNodeInfo::setCoords ( uint8_t  i,
double  value 
)
inline

Definition at line 73 of file CoordinateSystem.h.

Referenced by SimpleUnderlayNCS::createNcsInfo(), SimpleUnderlayNCS::init(), Vivaldi::init(), Vivaldi::processCoordinates(), and Nps::setOwnCoordinates().

{
if (i >= coordinates.size()) {
throw cRuntimeError("coordinates too small");
}
coordinates[i] = value;
};
static void EuclideanNcsNodeInfo::setDimension ( uint8_t  dimension)
inlinestatic

Definition at line 62 of file CoordinateSystem.h.

Referenced by SimpleUnderlayNCS::init(), SimpleNcs::init(), Vivaldi::init(), and Nps::init().

{ dim = dimension; };

Member Data Documentation

uint8_t EuclideanNcsNodeInfo::dim
staticprotected

Definition at line 84 of file CoordinateSystem.h.

Referenced by EuclideanNcsNodeInfo(), and setDimension().


The documentation for this class was generated from the following files: