Kite - Detailed Router


RoutingEventLoop.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2008-2013, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | K i t e - D e t a i l e d R o u t e r |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./kite/RoutingEventLoop.h" |
14 // +-----------------------------------------------------------------+
15 
16 
17 #ifndef KITE_ROUTING_EVENT_LOOP_H
18 #define KITE_ROUTING_EVENT_LOOP_H
19 
20 #include <vector>
21 
22 
23 namespace Kite {
24 
25  class RoutingEvent;
26 
27 
28 // -------------------------------------------------------------------
29 // Class : "RoutingEventLoop".
30 
31 
33  public:
34  class Element {
35  public:
36  inline Element ( size_t id=0, size_t timestamp=0 );
37  public:
38  size_t _id;
39  size_t _timestamp;
40  int _count;
41  };
42  class CompareByTimestamp {
43  public:
44  inline bool operator() ( const Element& lhs, const Element& rhs );
45  };
46  public:
47  RoutingEventLoop ( size_t depth=10, int limit=20 );
48  inline bool isLooping () const;
49  inline int getMaxCount () const;
50  inline const std::vector<Element>& getElements () const;
51  void update ( size_t id );
52  void erase ( size_t id );
53  private:
54  std::vector<Element> _elements;
55  size_t _depth;
56  int _maxCount;
57  int _countLimit;
58  bool _isLooping;
59  };
60 
61 
62  inline RoutingEventLoop::Element::Element ( size_t id, size_t timestamp )
63  : _id(id), _timestamp(timestamp), _count(1)
64  { }
65 
66 
67  inline bool RoutingEventLoop::CompareByTimestamp::operator() ( const RoutingEventLoop::Element& lhs, const RoutingEventLoop::Element& rhs )
68  { return lhs._timestamp > rhs._timestamp; }
69 
70 
71  inline bool RoutingEventLoop::isLooping () const { return _isLooping; }
72  inline int RoutingEventLoop::getMaxCount () const { return _maxCount; }
73  inline const std::vector<RoutingEventLoop::Element>&
74  RoutingEventLoop::getElements () const { return _elements; }
75 
76 
77 
78 } // Kite namespace.
79 
80 
81 //INSPECTOR_P_SUPPORT(Kite::RoutingEvent);
82 
83 
84 #endif // KITE_ROUTING_EVENT_LOOP_H
int getMaxCount() const
Definition: RoutingEventLoop.h:72
void erase(size_t id)
Definition: RoutingEventLoop.cpp:65
bool isLooping() const
Definition: RoutingEventLoop.h:71
RoutingEventLoop(size_t depth=10, int limit=20)
Definition: RoutingEventLoop.cpp:31
Simple loop dectector for RoutingEvent.
Definition: RoutingEventLoop.h:32
const std::vector< Element > & getElements() const
Definition: RoutingEventLoop.h:74
void update(size_t id)
Definition: RoutingEventLoop.cpp:40
The namespace dedicated to Kite.
Definition: Constants.h:22


Generated by doxygen 1.8.14 on Mon Apr 27 2020 Return to top of page
Kite - Detailed Router Copyright © 2008-2016 UPMC. All rights reserved