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_NODE_LIST_H_ 00018 #define _PROPHET_NODE_LIST_H_ 00019 00020 #include "prophet/Node.h" 00021 #include "prophet/Table.h" 00022 #include "storage/ProphetStore.h" 00023 #include <oasys/debug/Log.h> 00024 00025 namespace dtn 00026 { 00027 00032 class ProphetNodeList 00033 { 00034 public: 00038 ProphetNodeList(); 00039 00043 virtual ~ProphetNodeList(); 00044 00048 void load(const prophet::Node* n); 00049 00053 void update(const prophet::Node* n); 00054 00058 void del(const prophet::Node* n); 00059 00063 const prophet::Node* find(const std::string& dest_id) const; 00064 00068 void clone(prophet::Table* nodes, const prophet::NodeParams* params); 00069 00074 void clear(); 00075 00077 bool empty() const { return list_.empty(); } 00078 size_t size() const { return list_.size(); } 00080 00081 protected: 00082 typedef std::list<prophet::Node*> List; 00083 typedef List::iterator iterator; 00084 typedef List::const_iterator const_iterator; 00085 00089 bool find(const std::string& dest_id, iterator& i); 00090 00091 List list_; 00092 00093 }; // class ProphetNodeList 00094 00095 }; // namespace dtn 00096 00097 #endif // _PROPHET_NODE_LIST_H_