00001 #ifndef NODE_H_ 00002 #define NODE_H_ 00003 00004 #include <string> 00005 00006 using namespace std; 00007 00008 namespace dtn 00009 { 00010 namespace core 00011 { 00012 class ConvergenceLayer; 00013 00019 enum NodeType 00020 { 00021 FLOATING = 0, 00022 PERMANENT = 1 00023 }; 00024 00028 class Node 00029 { 00030 public: 00036 Node(NodeType type = PERMANENT, unsigned int rtt = 2700); 00037 00041 Node(const Node &k); 00042 00046 virtual ~Node(); 00047 00053 NodeType getType() const; 00054 00059 void setAddress(string address); 00060 00065 string getAddress() const; 00066 00067 void setPort(unsigned int port); 00068 unsigned int getPort() const; 00069 00070 /* 00071 * Set a description for the node. 00072 * @param description a description 00073 */ 00074 void setDescription(string description); 00075 00080 string getDescription() const; 00081 00086 void setURI(string uri); 00087 00092 string getURI() const; 00093 00099 void setTimeout(int timeout); 00100 00105 int getTimeout() const; 00106 00110 unsigned int getRoundTripTime() const; 00111 00117 bool decrementTimeout(int step); 00118 00125 bool equals(Node &node); 00126 00127 ConvergenceLayer* getConvergenceLayer() const; 00128 void setConvergenceLayer(ConvergenceLayer *cl); 00129 00130 void setPosition(pair<double,double> value); 00131 pair<double,double> getPosition() const; 00132 00133 private: 00134 string m_address; 00135 string m_description; 00136 string m_uri; 00137 int m_timeout; 00138 unsigned int m_rtt; 00139 NodeType m_type; 00140 unsigned int m_port; 00141 ConvergenceLayer *m_cl; 00142 00143 pair<double,double> m_position; 00144 }; 00145 } 00146 } 00147 00148 #endif /*NODE_H_*/
1.5.6