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_BUNDLE_FACADE_H_ 00018 #define _PROPHET_BUNDLE_FACADE_H_ 00019 00020 #include <sys/types.h> 00021 #include <string> 00022 00023 namespace prophet 00024 { 00025 00031 class Bundle 00032 { 00033 public: 00037 virtual ~Bundle() {}; 00038 00040 virtual const std::string& destination_id() const = 0; 00041 virtual const std::string& source_id() const = 0; 00042 virtual u_int32_t creation_ts() const = 0; 00043 virtual u_int32_t sequence_num() const = 0; 00044 virtual u_int32_t expiration_ts() const = 0; 00045 virtual u_int size() const = 0; 00046 virtual u_int num_forward() const = 0; 00047 virtual bool custody_requested() const = 0; 00049 00051 virtual bool operator< (const Bundle& a) const 00052 { 00053 if (sequence_num() == a.sequence_num()) 00054 return destination_id() < a.destination_id(); 00055 return sequence_num() < a.sequence_num(); 00056 } 00057 virtual bool operator> (const Bundle& a) const 00058 { 00059 if (sequence_num() == a.sequence_num()) 00060 return destination_id() > a.destination_id(); 00061 return sequence_num() > a.sequence_num(); 00062 } 00063 virtual bool operator== (const Bundle& a) const 00064 { 00065 if (sequence_num() == a.sequence_num()) 00066 return destination_id() == a.destination_id(); 00067 return false; 00068 } 00070 00071 }; // class Bundle 00072 00073 }; // namespace prophet 00074 00075 #endif // _PROPHET_BUNDLE_FACADE_H_