Functions

NTreeHelper.cc File Reference

#include "NTreeHelper.h"

Go to the source code of this file.

Functions

bool operator< (const NTreeScope &a, const NTreeScope &b)
bool operator== (const NTreeScope &a, const NTreeScope &b)
std::ostream & operator<< (std::ostream &Stream, const NTreeScope &scope)
bool operator< (const NTreeGroup &a, const NTreeGroup &b)
bool operator== (const NTreeGroup &a, const NTreeGroup &b)
std::ostream & operator<< (std::ostream &Stream, const NTreeGroup &group)
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)

Function Documentation

bool operator< ( const NTreeScope a,
const NTreeScope b 
)

Definition at line 47 of file NTreeHelper.cc.

{
    // for sorting only. This results in the biggest scope comming first
    if( a.size == b.size ) {
        return a.origin < b.origin;
    }
    return a.size > b.size;
}

bool operator< ( const NTreeGroup a,
const NTreeGroup b 
)

Definition at line 84 of file NTreeHelper.cc.

{
    return a.scope < b.scope;
}

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

Definition at line 141 of file NTreeHelper.cc.

{
    return a.scope < b.scope;
}

std::ostream& operator<< ( std::ostream &  Stream,
const NTreeNode node 
)

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;
}

std::ostream& operator<< ( std::ostream &  Stream,
const NTreeGroup group 
)

Definition at line 94 of file NTreeHelper.cc.

{
    Stream << group.scope << " Leader: " << group.leader;
    for( std::set<NodeHandle>::iterator it = group.members.begin(); it != group.members.end(); ++it ){
        Stream << "\n" << it->getIp();
    }
    return Stream;
}

std::ostream& operator<< ( std::ostream &  Stream,
const NTreeScope scope 
)

Definition at line 61 of file NTreeHelper.cc.

{
    Stream << "[" << scope.origin << " - " << scope.size << "]";
    return Stream;
}

bool operator== ( const NTreeScope a,
const NTreeScope b 
)

Definition at line 56 of file NTreeHelper.cc.

{
    return a.origin == b.origin && a.size == b.size;
}

bool operator== ( const NTreeGroup a,
const NTreeGroup b 
)

Definition at line 89 of file NTreeHelper.cc.

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

bool operator== ( const NTreeNode a,
const NTreeNode b 
)

Definition at line 136 of file NTreeHelper.cc.

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