00001 /* 00002 * Copyright 2007 Baylor University 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #ifndef _DTN_PROPHET_NODE_ 00018 #define _DTN_PROPHET_NODE_ 00019 00020 #include "prophet/Node.h" 00021 #include "naming/EndpointID.h" 00022 #include <oasys/serialize/Serialize.h> 00023 #include <oasys/debug/Formatter.h> 00024 #include <oasys/util/StringBuffer.h> 00025 00026 namespace dtn { 00027 00031 class ProphetNode : public prophet::Node, 00032 public oasys::SerializableObject 00033 { 00034 public: 00035 00039 ProphetNode(const prophet::NodeParams* params = NULL); 00040 00042 ProphetNode(const ProphetNode& node); 00043 ProphetNode(const prophet::Node& node); 00045 00049 ProphetNode(const oasys::Builder&); 00050 00054 virtual ~ProphetNode() {} 00055 00059 const EndpointID& remote_eid() 00060 { 00061 remote_eid_.assign(dest_id_); return remote_eid_; 00062 } 00063 00067 ProphetNode& operator= (const ProphetNode& p) 00068 { 00069 ((prophet::Node)*this) = (prophet::Node) p; 00070 remote_eid_ = p.remote_eid_; 00071 return *this; 00072 } 00073 00078 const EndpointID& durable_key() { return remote_eid(); } 00079 00083 void serialize(oasys::SerializeAction* a); 00084 00085 protected: 00086 friend class ProphetNodeList; 00087 00091 void set_eid( const EndpointID& eid ) 00092 { 00093 set_dest_id(eid.str()); 00094 remote_eid_.assign(eid); 00095 } 00096 00097 EndpointID remote_eid_; 00098 }; // ProphetNode 00099 00100 }; // dtn 00101 00102 #endif // _DTN_PROPHET_NODE_