00001 /* 00002 * Copyright 2004-2006 Intel Corporation 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 _MESSAGE_H_ 00018 #define _MESSAGE_H_ 00019 00020 #include <vector> 00021 00022 namespace dtnsim { 00023 00031 class Message { 00032 00033 public: 00034 static long total_ ; 00035 static long next() { 00036 return total_ ++ ; 00037 } 00038 00039 Message(); 00040 Message(int src, int dst, double size); 00041 00042 int id () ; 00043 void set_size(double x) { size_ = x;} 00044 double size () { return size_ ; } 00045 void rm_bytes(double len) ; 00046 int src() { return src_ ; } 00047 int dst() { return dst_ ; } 00048 00049 Message* clone() ; 00050 00051 00052 std::vector<int> hop_idx_; 00053 std::vector<double> hop_time_; 00054 00055 void add_hop(int nodeid,double time) 00056 { 00057 //hop_idx_->push_back(nodeid); hop_time_->push_back(time); 00058 } 00059 protected: 00060 00061 int id_; 00062 int src_; 00063 int dst_; 00064 double size_; 00065 double origsize_; 00066 double offset_; 00067 00068 00069 }; 00070 00071 } // namespace dtnsim 00072 00073 #endif /* _MESSAGE_H_ */ 00074 00075 00076