OverSim
SimpleUnderlayNCS Class Reference

.h More...

#include <SimpleUnderlayNCS.h>

Inheritance diagram for SimpleUnderlayNCS:
AbstractNcs

Public Member Functions

 SimpleUnderlayNCS ()
virtual ~SimpleUnderlayNCS ()
virtual void init (NeighborCache *neighorCache)
 .h
virtual AbstractNcsNodeInfogetUnvalidNcsInfo () const
virtual bool isAdapting ()
AbstractNcsNodeInfocreateNcsInfo (const std::vector< double > &coords) const
Prox getCoordinateBasedProx (const AbstractNcsNodeInfo &info) const
virtual const AbstractNcsNodeInfogetOwnNcsInfo () const
- Public Member Functions inherited from AbstractNcs
virtual ~AbstractNcs ()
virtual bool isReady ()
virtual void processCoordinates (const simtime_t &rtt, const AbstractNcsNodeInfo &nodeInfo)
virtual void handleTimerEvent (cMessage *msg)
virtual bool handleRpcCall (BaseCallMessage *msg)

Protected Attributes

NeighborCacheneighborCache
SimpleUnderlayCoordsInfoownCoords

Detailed Description

.h

Author
Daniel Lienert

Definition at line 30 of file SimpleUnderlayNCS.h.

Constructor & Destructor Documentation

SimpleUnderlayNCS::SimpleUnderlayNCS ( )
inline

Definition at line 33 of file SimpleUnderlayNCS.h.

{ ownCoords = NULL; };
virtual SimpleUnderlayNCS::~SimpleUnderlayNCS ( )
inlinevirtual

Definition at line 34 of file SimpleUnderlayNCS.h.

{ delete ownCoords; };

Member Function Documentation

AbstractNcsNodeInfo * SimpleUnderlayNCS::createNcsInfo ( const std::vector< double > &  coords) const
virtual

Implements AbstractNcs.

Definition at line 54 of file SimpleUnderlayNCS.cc.

{
//std::stringstream tempStr;
PeerInfo* peerInfo =
getThisNode().getIp());
if(peerInfo == NULL) {
throw cRuntimeError("No PeerInfo Found");
}
SimpleNodeEntry* entry = dynamic_cast<SimpleInfo*>(peerInfo)->getEntry();
for (uint8_t i = 0; i < entry->getDim(); i++) {
info->setCoords(i, entry->getCoords(i));
}
return info;
}
Prox SimpleUnderlayNCS::getCoordinateBasedProx ( const AbstractNcsNodeInfo info) const
virtual

Implements AbstractNcs.

Definition at line 87 of file SimpleUnderlayNCS.cc.

{
//createNcsInfo(*new std::vector<double>);
return ownCoords->getDistance(abstractInfo);
}
const AbstractNcsNodeInfo & SimpleUnderlayNCS::getOwnNcsInfo ( ) const
virtual

Implements AbstractNcs.

Definition at line 81 of file SimpleUnderlayNCS.cc.

{
//return *createNcsInfo(*new std::vector<double>);
return *ownCoords;
}
AbstractNcsNodeInfo * SimpleUnderlayNCS::getUnvalidNcsInfo ( ) const
virtual

Implements AbstractNcs.

Definition at line 76 of file SimpleUnderlayNCS.cc.

{
}
void SimpleUnderlayNCS::init ( NeighborCache neighorCache)
virtual

.h

Author
Daniel Lienert

Implements AbstractNcs.

Definition at line 34 of file SimpleUnderlayNCS.cc.

{
this->neighborCache = neighorCache;
SimpleUnderlayCoordsInfo::setDimension(2); //todo set value by parameter
PeerInfo* peerInfo =
getThisNode().getIp());
if(peerInfo == NULL) {
throw cRuntimeError("No PeerInfo Found");
}
SimpleNodeEntry* entry = dynamic_cast<SimpleInfo*>(peerInfo)->getEntry();
for (uint8_t i = 0; i < entry->getDim(); i++) {
ownCoords->setCoords(i, entry->getCoords(i));
}
}
virtual bool SimpleUnderlayNCS::isAdapting ( )
inlinevirtual

Definition at line 40 of file SimpleUnderlayNCS.h.

{ return false; }

Member Data Documentation

NeighborCache* SimpleUnderlayNCS::neighborCache
protected

Definition at line 47 of file SimpleUnderlayNCS.h.

Referenced by createNcsInfo(), and init().

SimpleUnderlayCoordsInfo* SimpleUnderlayNCS::ownCoords
protected

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