OverSim
StrategyTreeTest Class Reference

#include <StrategyTreeTest.h>

Inheritance diagram for StrategyTreeTest:
AbstractSendStrategy

Public Member Functions

 StrategyTreeTest ()
 .cc
virtual ~StrategyTreeTest ()
virtual void handleCoordinateRpcCall (GlobalViewBuilderCall *globalViewBuilderCall)
virtual void setMyCoordinates (const AbstractNcsNodeInfo &ncsInfo)
virtual GlobalViewBuilderCallgetCoordinateMessage ()
virtual std::vector
< std::vector< double > > 
getGlobalViewData ()
 return the decodes global View Data
virtual std::string getStrategyDataStatus ()
 return a short status of the running send strategy
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 Member Functions

void setBranchCount (const NodeHandle &treeNode, int count)
int getNodeCount ()

Private Types

typedef std::pair
< TransportAddress, int > 
branchCount
typedef UNORDERED_MAP
< TransportAddress, int,
TransportAddress::hashFcn
nodeCountMap

Private Attributes

nodeCountMap branchCountMap

Additional Inherited Members

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

Detailed Description

Definition at line 40 of file StrategyTreeTest.h.

Member Typedef Documentation

typedef std::pair<TransportAddress, int> StrategyTreeTest::branchCount
private

Definition at line 44 of file StrategyTreeTest.h.

Constructor & Destructor Documentation

StrategyTreeTest::StrategyTreeTest ( )

.cc

Author
Daniel Lienert

Definition at line 27 of file StrategyTreeTest.cc.

{
// TODO Auto-generated constructor stub
}
StrategyTreeTest::~StrategyTreeTest ( )
virtual

Definition at line 31 of file StrategyTreeTest.cc.

{
// TODO Auto-generated destructor stub
}

Member Function Documentation

void StrategyTreeTest::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 80 of file StrategyTreeTest.cc.

{
nodeCountMap::const_iterator branchIterator = branchCountMap.begin();
while(branchIterator != branchCountMap.end()) {
if(currentTreeChildNodes.find(branchIterator->first) == currentTreeChildNodes.end() && branchIterator->first != thisNode) {
branchCountMap.erase(branchIterator);
}
branchIterator++;
}
}
GlobalViewBuilderCall * StrategyTreeTest::getCoordinateMessage ( )
virtual

Reimplemented from AbstractSendStrategy.

Definition at line 43 of file StrategyTreeTest.cc.

{
TreeTestStrategyCall* msg = new TreeTestStrategyCall("TreeTestStrategyCall");
msg->setBitLength(TREETESTSTRATEGYCALL_L(msg));
return msg;
}
std::vector< std::vector< double > > StrategyTreeTest::getGlobalViewData ( )
virtual

return the decodes global View Data

Implements AbstractSendStrategy.

Definition at line 113 of file StrategyTreeTest.cc.

{
std::vector<std::vector<double> > test;
return test;
}
int StrategyTreeTest::getNodeCount ( )
protected

Definition at line 95 of file StrategyTreeTest.cc.

Referenced by getCoordinateMessage(), and getStrategyDataStatus().

{
int nodeCount = 0;
nodeCountMap::const_iterator branchCountMapIterator = branchCountMap.begin();
while(branchCountMapIterator != branchCountMap.end()) {
nodeCount += branchCountMapIterator->second;
++branchCountMapIterator;
}
return nodeCount;
}
std::string StrategyTreeTest::getStrategyCombinedParams ( )
virtual

return a string of the currently used strategy params

Implements AbstractSendStrategy.

Definition at line 62 of file StrategyTreeTest.cc.

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

return a short status of the running send strategy

Reimplemented from AbstractSendStrategy.

Definition at line 53 of file StrategyTreeTest.cc.

{
std::stringstream tempStr;
tempStr << "BNC: " << getNodeCount() << " | BC: " << branchCountMap.size();
return tempStr.str();
}
void StrategyTreeTest::handleCoordinateRpcCall ( GlobalViewBuilderCall globalViewBuilderCall)
virtual

Reimplemented from AbstractSendStrategy.

Definition at line 35 of file StrategyTreeTest.cc.

{
TreeTestStrategyCall* treeTestStrategyCall = dynamic_cast<TreeTestStrategyCall*>(globalViewBuilderCall);
setBranchCount(treeTestStrategyCall->getSrcNode(),treeTestStrategyCall->getNodeCount());
}
void StrategyTreeTest::setBranchCount ( const NodeHandle treeNode,
int  count 
)
protected

Definition at line 70 of file StrategyTreeTest.cc.

Referenced by handleCoordinateRpcCall(), and setMyCoordinates().

{
if(branchCountMap.find(treeNode) != branchCountMap.end()) {
branchCountMap.find(treeNode)->second = count;
} else {
branchCountMap.insert(branchCount(treeNode, count));
}
}
void StrategyTreeTest::setMyCoordinates ( const AbstractNcsNodeInfo ncsInfo)
virtual

Reimplemented from AbstractSendStrategy.

Definition at line 109 of file StrategyTreeTest.cc.

Member Data Documentation

nodeCountMap StrategyTreeTest::branchCountMap
private

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