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 _PROPHET_LINK_LIST_H_ 00018 #define _PROPHET_LINK_LIST_H_ 00019 00020 #include <string.h> 00021 #include "ProphetLink.h" 00022 00023 namespace dtn 00024 { 00025 00026 class ProphetLinkList 00027 { 00028 public: 00032 ProphetLinkList(); 00033 00037 ~ProphetLinkList(); 00038 00042 void add(const LinkRef& l); 00043 00047 void del(const LinkRef& l); 00048 00052 const prophet::Link* find(const char* remote_eid) const; 00053 00057 const LinkRef& find_ref(const prophet::Link* link) const; 00058 00062 const LinkRef& find_ref(const char* remote_eid) const; 00063 00067 void clear(); 00068 00070 bool empty() const { return list_.empty(); } 00071 size_t size() const { return list_.size(); } 00073 00074 protected: 00075 typedef std::list<ProphetLink*> List; 00076 typedef List::iterator iterator; 00077 typedef List::const_iterator const_iterator; 00078 00082 bool find(const char* remote_eid, iterator& i); 00083 00084 List list_; 00085 static LinkRef NULL_LINK; 00086 00087 }; // class ProphetLinkList 00088 00089 }; // namespace dtn 00090 00091 #endif // _PROPHET_LINK_LIST_H_