OverSim
StrategySendAll Class Reference

#include <StrategySendAll.h>

Inheritance diagram for StrategySendAll:
AbstractSendStrategy StrategyRemoveCoords StrategyRemoveInaccurate StrategyRemoveRandom

Public Member Functions

 StrategySendAll ()
 .cc
virtual ~StrategySendAll ()
virtual void setMyCoordinates (const AbstractNcsNodeInfo &ncsInfo)
virtual GlobalViewBuilderCallgetCoordinateMessage ()
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
virtual std::string getStrategyCombinedParams ()
 return a string of the currently used strategy params
- 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 Types

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 Member Functions

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)

Protected Attributes

coordDataMap coordData
- Protected Attributes inherited from AbstractSendStrategy
NodeHandle thisNode
GlobalViewBuilderglobalViewBuilder
int lastSendCount
 the quantity of coordinates sent by last message

Detailed Description

Definition at line 36 of file StrategySendAll.h.

Member Typedef Documentation

typedef std::vector<std::vector<double> > StrategySendAll::coordinatesVector
protected

The coordinatesVector is a vector of coordinates, where a coordinate itself is a vector of doubles (=Dimensions)

Definition at line 57 of file StrategySendAll.h.

Definition at line 58 of file StrategySendAll.h.

Constructor & Destructor Documentation

StrategySendAll::StrategySendAll ( )

.cc

Author
Daniel Lienert

Definition at line 29 of file StrategySendAll.cc.

{
}
StrategySendAll::~StrategySendAll ( )
virtual

Definition at line 35 of file StrategySendAll.cc.

{
// TODO Auto-generated destructor stub
}

Member Function Documentation

void StrategySendAll::cleanUpCoordData ( const treeNodeMap currentTreeChildNodes)
virtual

cleanup the coordinate map and remove data of nodes which are not longer in the branch

Reimplemented from AbstractSendStrategy.

Definition at line 108 of file StrategySendAll.cc.

{
coordDataMap::const_iterator coordDataMapIterator = coordData.begin();
while(coordDataMapIterator != coordData.end()) {
if(currentTreeChildNodes.find(coordDataMapIterator->first) ==
currentTreeChildNodes.end() && coordDataMapIterator->first != thisNode) {
coordDataMapIterator = coordData.erase(coordDataMapIterator);
} else ++coordDataMapIterator;
}
}
const std::vector< std::vector< double > > StrategySendAll::getCombinedCoordsVector ( )
protected

Combine the coordinates of coordData map Structure to a single Vector of coordinates.

Returns
single vector of coordinate vectors

Definition at line 86 of file StrategySendAll.cc.

Referenced by StrategyRemoveCoords::getCoordinateMessage(), getCoordinateMessage(), and getGlobalViewData().

{
coordinatesVector combinedCoordsVector;
coordinatesVector branchCoordsVector;
coordDataMap::const_iterator coordDataMapIterator = coordData.begin();
while(coordDataMapIterator != coordData.end()) {
branchCoordsVector = coordDataMapIterator->second;
coordinatesVector::iterator vIterator;
for(vIterator=branchCoordsVector.begin(); vIterator < branchCoordsVector.end(); vIterator++) {
combinedCoordsVector.push_back(*vIterator);
}
++coordDataMapIterator;
}
return combinedCoordsVector;
}
GlobalViewBuilderCall * StrategySendAll::getCoordinateMessage ( )
virtual

Reimplemented from AbstractSendStrategy.

Reimplemented in StrategyRemoveCoords.

Definition at line 63 of file StrategySendAll.cc.

{
SendAllStrategyCall* msg = new SendAllStrategyCall("SendAllStrategyCall");
CoordDataContainer tmpCoordContainer;
lastSendCount = tmpCoordContainer.coordinatesVector.size();
msg->setCoordData(tmpCoordContainer);
msg->setBitLength(SENDALLSTRATEGYCALL_L(msg));
return msg;
}
std::vector< std::vector< double > > StrategySendAll::getGlobalViewData ( )
virtual

return the decodes global View Data

Implements AbstractSendStrategy.

Definition at line 166 of file StrategySendAll.cc.

int StrategySendAll::getSizeOfCoordVector ( const coordinatesVector combinedCoordsVector)
protectedvirtual

calculate and return the size of the used coordinate data structure return int size

Definition at line 138 of file StrategySendAll.cc.

{
int size = 0;
coordinatesVector::const_iterator vNodeIterator = combinedCoordsVector.begin();
std::vector<double>::const_iterator vCoordsIterator;
while(vNodeIterator != combinedCoordsVector.end()) {
size += sizeof((*vNodeIterator));
vCoordsIterator = (*vNodeIterator).begin();
while(vCoordsIterator != (*vNodeIterator).end()) {
size += sizeof((*vCoordsIterator));
vCoordsIterator++;
}
vNodeIterator++;
}
return size;
}
int StrategySendAll::getSizeOfSingleCoordinate ( const coordinatesVector combinedCoordsVector)
protectedvirtual

Definition at line 161 of file StrategySendAll.cc.

Referenced by StrategyRemoveCoords::removeCoordinatesByTrafficLimit().

{
return sizeof((*(*combinedCoordsVector.begin()).begin()));
}
std::string StrategySendAll::getStrategyCombinedParams ( )
virtual

return a string of the currently used strategy params

Implements AbstractSendStrategy.

Reimplemented in StrategyRemoveCoords.

Definition at line 129 of file StrategySendAll.cc.

{
std::stringstream tempStr;
tempStr << "sendAll";
return tempStr.str();
}
std::string StrategySendAll::getStrategyDataStatus ( )
virtual

return a short status of the running send strategy

Reimplemented from AbstractSendStrategy.

Definition at line 121 of file StrategySendAll.cc.

{
std::stringstream tempStr;
tempStr << "CoordCount: " << lastSendCount;
return tempStr.str();
}
void StrategySendAll::handleCoordinateRpcCall ( GlobalViewBuilderCall globalViewBuilderCall)
virtual

Reimplemented from AbstractSendStrategy.

Definition at line 79 of file StrategySendAll.cc.

{
SendAllStrategyCall* sendAllStrategyCall = dynamic_cast<SendAllStrategyCall*>(globalViewBuilderCall);
setBranchCoordinates(sendAllStrategyCall->getSrcNode(), sendAllStrategyCall->getCoordData().coordinatesVector);
}
void StrategySendAll::setBranchCoordinates ( const NodeHandle node,
coordinatesVector  coordsVector 
)
protected

Set the CoordinatesVector to the map, identified by the sender node.

Parameters
nodeNodeHandle to identify the sending node
coordsVectorcoordinatesVector with the coordinates of all nodes in this branch

Definition at line 52 of file StrategySendAll.cc.

Referenced by handleCoordinateRpcCall(), StrategyRemoveInaccurate::setMyCoordinates(), and setMyCoordinates().

{
if(coordData.find(node) != coordData.end()) {
coordData.find(node)->second = coordsVector;
} else {
coordData.insert(nodeCoordData(node, coordsVector));
}
}
void StrategySendAll::setMyCoordinates ( const AbstractNcsNodeInfo ncsInfo)
virtual

Reimplemented from AbstractSendStrategy.

Reimplemented in StrategyRemoveInaccurate.

Definition at line 41 of file StrategySendAll.cc.

{
std::vector<double> tmpDimVector = ncsInfo.getCoords();
coordinatesVector tmpCoordsVector;
tmpCoordsVector.push_back(tmpDimVector);
// i am my own branch here ...
setBranchCoordinates(thisNode, tmpCoordsVector);
}

Member Data Documentation

coordDataMap StrategySendAll::coordData
protected

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