GiaNode.cc

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
00003 //
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU General Public License
00006 // as published by the Free Software Foundation; either version 2
00007 // of the License, or (at your option) any later version.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with this program; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 //
00018 
00023 #include <OverlayKey.h>
00024 
00025 #include "GiaNode.h"
00026 
00027 
00028 // predefined gia node
00029 const GiaNode GiaNode::UNSPECIFIED_NODE;
00030 
00031 GiaNode::GiaNode()
00032 {
00033     //...
00034 }
00035 
00036 GiaNode::GiaNode(const NodeHandle& handle) : NodeHandle(handle)
00037 {
00038     //...
00039 }
00040 
00041 //TODO
00042 GiaNode::GiaNode(const NodeHandle& handle, double cap, int degree) : NodeHandle(handle)
00043 {
00044     capacity = cap;
00045 }
00046 
00047 GiaNode& GiaNode::operator=(const NodeHandle& handle)
00048 {
00049     ip = handle.getAddress();
00050     port = handle.getPort();
00051     key = handle.getKey();
00052     capacity = 0;
00053 
00054     return *this;
00055 }
00056 
00057 void GiaNode::setCapacity(double cap)
00058 {
00059     capacity = cap;
00060 }
00061 
00062 double GiaNode::getCapacity() const
00063 {
00064     return capacity;
00065 }
00066 
00067 std::ostream& operator<<(std::ostream& os, const GiaNode& node)
00068 {
00069     if(node.ip.isUnspecified() == true && node.key.isUnspecified() && node.port == -1) {
00070         os << "<unspec>";
00071     } else {
00072         os << node.ip << ":" << node.port << " "
00073            << node.key.toString() << " with capacity: "
00074            << node.capacity //<< " , degree: " << node.connectionDegree
00075             //<< " , sentTokens: " << node.sentTokens << " , receivedTokens: " << node.receivedTokens;
00076             ;
00077     }
00078     return os;
00079 }
00080 
00081 // bool GiaNode::operator==(const GiaNode& rhs) const
00082 // {
00083 //     if(this->getNodeHandle() != rhs.getNodeHandle())
00084 //         return false;
00085 //     return true;
00086 // }
00087 
00088 // bool GiaNode::operator!=(const GiaNode& rhs) const
00089 // {
00090 //     if(this->getNodeHandle() == rhs.getNodeHandle())
00091 //         return false;
00092 //     return true;
00093 // }
Generated on Wed May 26 16:21:14 2010 for OverSim by  doxygen 1.6.3