OverSim
StrategyRemoveCoords Class Reference

#include <StrategyRemoveCoords.h>

Inheritance diagram for StrategyRemoveCoords:
StrategySendAll AbstractSendStrategy StrategyRemoveInaccurate StrategyRemoveRandom

Public Member Functions

 StrategyRemoveCoords ()
virtual ~StrategyRemoveCoords ()
virtual GlobalViewBuilderCallgetCoordinateMessage ()
virtual std::string getStrategyCombinedParams ()
 return a string of the currently used strategy params
- Public Member Functions inherited from StrategySendAll
 StrategySendAll ()
 .cc
virtual ~StrategySendAll ()
virtual void setMyCoordinates (const AbstractNcsNodeInfo &ncsInfo)
virtual void handleCoordinateRpcCall (GlobalViewBuilderCall *globalViewBuilderCall)
virtual std::string getStrategyDataStatus ()
 return a short status of the running send strategy
virtual std::vector
< std::vector< double > > 
getGlobalViewData ()
 return the decodes global View Data
virtual void cleanUpCoordData (const treeNodeMap &currentTreeChildNodes)
 cleanup the coordinate map and remove data of nodes which are not longer in the branch
- Public Member Functions inherited from AbstractSendStrategy
 AbstractSendStrategy ()
 .cc
virtual ~AbstractSendStrategy ()
virtual void initialize (GlobalViewBuilder *globalViewBuilder)
 set a pointer to the neighborCache to access the optional parameters for the strategies
virtual void initializeStrategy ()
 stub method to initialize the concrete strategy
virtual void setThisNode (const NodeHandle thisNode)
 Set the Nodehandle of the own node to identify the own coordinates.

Protected Member Functions

void processCoordinates (coordinatesVector *coords)
void removeCoordinatesByPercentage (coordinatesVector *coords, int percentage)
void removeCoordinatesByCoordLimit (coordinatesVector *coords, int coordLimit)
void removeCoordinatesByTrafficLimit (coordinatesVector *coords, int trafficLimit)
virtual void removeCoordinates (coordinatesVector *coords, int entrysToRemove)
- Protected Member Functions inherited from StrategySendAll
void setBranchCoordinates (const NodeHandle &node, coordinatesVector coordsVector)
 Set the CoordinatesVector to the map, identified by the sender node.
const std::vector< std::vector
< double > > 
getCombinedCoordsVector ()
 Combine the coordinates of coordData map Structure to a single Vector of coordinates.
virtual int getSizeOfCoordVector (const coordinatesVector &combinedCoordsVector)
 calculate and return the size of the used coordinate data structure return int size
virtual int getSizeOfSingleCoordinate (const coordinatesVector &combinedCoordsVector)

Additional Inherited Members

- Protected Types inherited from StrategySendAll
typedef std::vector
< std::vector< double > > 
coordinatesVector
 The coordinatesVector is a vector of coordinates, where a coordinate itself is a vector of doubles (=Dimensions)
typedef std::pair
< TransportAddress,
coordinatesVector
nodeCoordData
typedef UNORDERED_MAP
< TransportAddress,
coordinatesVector,
TransportAddress::hashFcn
coordDataMap
- Protected Attributes inherited from StrategySendAll
coordDataMap coordData

Detailed Description

Definition at line 15 of file StrategyRemoveCoords.h.

Constructor & Destructor Documentation

StrategyRemoveCoords::StrategyRemoveCoords ( )

Definition at line 11 of file StrategyRemoveCoords.cc.

{
}
StrategyRemoveCoords::~StrategyRemoveCoords ( )
virtual

Definition at line 15 of file StrategyRemoveCoords.cc.

{
// TODO Auto-generated destructor stub
}

Member Function Documentation

GlobalViewBuilderCall * StrategyRemoveCoords::getCoordinateMessage ( )
virtual

Reimplemented from StrategySendAll.

Definition at line 19 of file StrategyRemoveCoords.cc.

{
SendAllStrategyCall* msg = new SendAllStrategyCall("sendAllStrategyCall");
CoordDataContainer tmpCoordContainer;
processCoordinates(&sendCoordsVector);
tmpCoordContainer.coordinatesVector = sendCoordsVector;
lastSendCount = tmpCoordContainer.coordinatesVector.size();
msg->setCoordData(tmpCoordContainer);
msg->setBitLength(REMOVERANDOMSTRATEGYCALL_L(msg));
return msg;
}
std::string StrategyRemoveCoords::getStrategyCombinedParams ( )
virtual

return a string of the currently used strategy params

Reimplemented from StrategySendAll.

Definition at line 81 of file StrategyRemoveCoords.cc.

{
std::string strategyMode = globalViewBuilder->parProxy("gvbStrategyRemoveCoordsMode").stdstringValue();
std::stringstream tempStr;
tempStr << globalViewBuilder->parProxy("gvbSendStrategy").stdstringValue();
tempStr << "/";
tempStr << strategyMode;
tempStr << "/";
if(strategyMode == "limitCoords") {
tempStr << globalViewBuilder->parProxy("gvbStrategyRemoveCoordsCoordsLimit").longValue();
} else if (strategyMode == "limitTraffic") {
tempStr << globalViewBuilder->parProxy("gvbStrategyRemoveCoordsTrafficLimit").longValue();
} else if (strategyMode == "percentage") {
tempStr << globalViewBuilder->parProxy("gvbStrategyRemoveCoordsPercentage").longValue();
}
return tempStr.str();
}
void StrategyRemoveCoords::processCoordinates ( coordinatesVector coords)
protected

Definition at line 39 of file StrategyRemoveCoords.cc.

Referenced by getCoordinateMessage().

{
std::string strategyMode = globalViewBuilder->parProxy("gvbStrategyRemoveCoordsMode").stdstringValue();
if(strategyMode == "limitCoords") {
int coordLimit = globalViewBuilder->parProxy("gvbStrategyRemoveCoordsCoordsLimit");
removeCoordinatesByCoordLimit(coords, coordLimit);
} else if (strategyMode == "limitTraffic") {
int trafficLimit = globalViewBuilder->parProxy("gvbStrategyRemoveCoordsTrafficLimit");
removeCoordinatesByTrafficLimit(coords, trafficLimit);
} else if (strategyMode == "percentage") {
int percentage = globalViewBuilder->parProxy("gvbStrategyRemoveCoordsPercentage");
removeCoordinatesByPercentage(coords, percentage);
} else if (strategyMode == "") {
throw cRuntimeError("StrategyRemoveCoordinates::processCoordinates(): No Strategy Mode given.");
} else {
throw cRuntimeError("StrategyRemoveCoordinates::processCoordinates(): Unknown Strategy Mode given.");
}
}
void StrategyRemoveCoords::removeCoordinates ( coordinatesVector coords,
int  entrysToRemove 
)
protectedvirtual

Reimplemented in StrategyRemoveInaccurate, and StrategyRemoveRandom.

Definition at line 62 of file StrategyRemoveCoords.cc.

Referenced by removeCoordinatesByCoordLimit(), and removeCoordinatesByPercentage().

{
throw cRuntimeError("StrategyRemoveCoordinates::processCoordinates(): Choice Strategy not implemented.");
}
void StrategyRemoveCoords::removeCoordinatesByCoordLimit ( coordinatesVector coords,
int  coordLimit 
)
protected

Definition at line 71 of file StrategyRemoveCoords.cc.

Referenced by processCoordinates(), and removeCoordinatesByTrafficLimit().

{
int entrysToRemove = coords->size() - coordLimit;
removeCoordinates(coords, entrysToRemove);
}
void StrategyRemoveCoords::removeCoordinatesByPercentage ( coordinatesVector coords,
int  percentage 
)
protected

Definition at line 66 of file StrategyRemoveCoords.cc.

Referenced by processCoordinates().

{
int entrysToRemove = static_cast<int>(coords->size() * (percentage / 100));
removeCoordinates(coords, entrysToRemove);
}
void StrategyRemoveCoords::removeCoordinatesByTrafficLimit ( coordinatesVector coords,
int  trafficLimit 
)
protected

Definition at line 76 of file StrategyRemoveCoords.cc.

Referenced by processCoordinates().

{
int coordLimit = (int)(trafficLimit / getSizeOfSingleCoordinate(*coords));
removeCoordinatesByCoordLimit(coords, coordLimit);
}

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