OverSim
GiaMessageBookkeeping.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 //
18 
24 #ifndef __GIAMESSAGEBOOKKEEPING_H_
25 #define __GIAMESSAGEBOOKKEEPING_H_
26 
27 #include <vector>
28 #include <queue>
29 #include <map>
30 
31 #include "GiaNeighbors.h"
32 #include "GiaMessage_m.h"
33 #include "GiaNode.h"
34 
35 
43 {
44  public:
45 
52 
57 
62  uint32_t getSize();
63 
68  void addMessage( GiaIDMessage* msg );
69 
74  void removeMessage( GiaIDMessage* msg );
75 
80  bool contains( GiaIDMessage* msg );
81 
88 
93 
94  protected:
95 
96 class GiaNodeQueueCompare : public std::binary_function<FullGiaNodeInfo, FullGiaNodeInfo, FullGiaNodeInfo>
97  {
98  public:
99  bool operator()(const FullGiaNodeInfo& x, const FullGiaNodeInfo& y);
100  };
101 
102  struct MessageItem
103  {
104  std::vector<GiaNode> remainNodes;
105  simtime_t timestamp;
106  };
107  std::map<OverlayKey, MessageItem> messages;
109  uint32_t timeout;
110 };
111 
112 #endif