OverSim
NTreeNode Class Reference

#include <NTreeHelper.h>

Public Member Functions

bool isInScope (const Vector2D &p) const
const NodeHandlegetChildForPos (const Vector2D &pos) const
 NTreeNode (const NTreeScope &_scope)
 NTreeNode (const Vector2D &_origin, double _size)

Public Attributes

NTreeScope scope
NodeHandle parent
NodeHandle children [4]
NTreeGroupgroup
unsigned int aggChildCount [4]
NodeHandle siblings [4]
std::set< NodeHandlechildChildren [4]
simtime_t lastPing
bool parentIsRoot

Friends

bool operator== (const NTreeNode &a, const NTreeNode &b)
bool operator< (const NTreeNode &a, const NTreeNode &b)
std::ostream & operator<< (std::ostream &Stream, const NTreeNode &node)

Detailed Description

Definition at line 66 of file NTreeHelper.h.

Constructor & Destructor Documentation

NTreeNode::NTreeNode ( const NTreeScope _scope)

Definition at line 104 of file NTreeHelper.cc.

:
scope(_scope)
{
for( unsigned int i = 0; i < 4; ++i ){
aggChildCount[i] = 0;
}
group = 0;
parentIsRoot = false;
}
NTreeNode::NTreeNode ( const Vector2D _origin,
double  _size 
)

Definition at line 114 of file NTreeHelper.cc.

:
scope(_origin,_size)
{
for( unsigned int i = 0; i < 4; ++i ){
aggChildCount[i] = 0;
}
group = 0;
parentIsRoot = false;
}

Member Function Documentation

const NodeHandle & NTreeNode::getChildForPos ( const Vector2D pos) const

Definition at line 130 of file NTreeHelper.cc.

{
return children[ scope.origin.getQuadrant(pos) ];
}
bool NTreeNode::isInScope ( const Vector2D p) const

Definition at line 124 of file NTreeHelper.cc.

Referenced by getChildForPos().

{
return scope.contains(point);
}

Friends And Related Function Documentation

bool operator< ( const NTreeNode a,
const NTreeNode b 
)
friend

Definition at line 141 of file NTreeHelper.cc.

{
return a.scope < b.scope;
}
std::ostream& operator<< ( std::ostream &  Stream,
const NTreeNode node 
)
friend

Definition at line 146 of file NTreeHelper.cc.

{
Stream << node.scope << "\nParent: " << node.parent.getIp();
if( node.group ) {
Stream << "\nNode is leaf";
} else {
for( unsigned int i = 0; i < 4; ++i ){
Stream << "\nChild " << i << ": " << node.children[i];
}
}
return Stream;
}
bool operator== ( const NTreeNode a,
const NTreeNode b 
)
friend

Definition at line 136 of file NTreeHelper.cc.

{
return a.scope== b.scope;
}

Member Data Documentation

unsigned int NTreeNode::aggChildCount[4]

Definition at line 75 of file NTreeHelper.h.

Referenced by NTreeNode().

std::set<NodeHandle> NTreeNode::childChildren[4]

Definition at line 78 of file NTreeHelper.h.

NodeHandle NTreeNode::children[4]

Definition at line 71 of file NTreeHelper.h.

Referenced by getChildForPos(), and operator<<().

NTreeGroup* NTreeNode::group

Definition at line 73 of file NTreeHelper.h.

Referenced by NTree::handleAppMessage(), NTree::handleDivideCall(), NTreeNode(), and operator<<().

simtime_t NTreeNode::lastPing

Definition at line 79 of file NTreeHelper.h.

NodeHandle NTreeNode::parent

Definition at line 70 of file NTreeHelper.h.

Referenced by NTree::handleDivideCall(), and operator<<().

bool NTreeNode::parentIsRoot

Definition at line 80 of file NTreeHelper.h.

Referenced by NTreeNode().

NTreeScope NTreeNode::scope

Definition at line 69 of file NTreeHelper.h.

Referenced by getChildForPos(), isInScope(), operator<(), operator<<(), and operator==().

NodeHandle NTreeNode::siblings[4]

Definition at line 77 of file NTreeHelper.h.


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