Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 | /** | ||||
3 | * Copyright (C) 2014 Named Data Networking Project | ||||
4 | * See COPYING for copyright and distribution information. | ||||
5 | */ | ||||
6 | |||||
7 | #ifndef NFD_FACE_FACE_COUNTER_HPP | ||||
8 | #define NFD_FACE_FACE_COUNTER_HPP | ||||
9 | |||||
10 | #include "common.hpp" | ||||
11 | |||||
12 | namespace nfd { | ||||
13 | |||||
14 | /** \class FaceCounter | ||||
15 | * \brief represents a counter on face | ||||
Alexander Afanasyev | 7e698e6 | 2014-03-07 16:48:35 +0000 | [diff] [blame] | 16 | * |
17 | * \todo This class should be noncopyable | ||||
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 18 | */ |
19 | typedef uint64_t FaceCounter; | ||||
20 | |||||
21 | |||||
22 | /** \brief contains counters on face | ||||
23 | */ | ||||
Alexander Afanasyev | 7e698e6 | 2014-03-07 16:48:35 +0000 | [diff] [blame] | 24 | class FaceCounters : noncopyable |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 25 | { |
26 | public: | ||||
27 | FaceCounters(); | ||||
28 | |||||
29 | /// incoming Interest (total packets since Face establishment) | ||||
30 | const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 31 | getNInInterests() const; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 32 | |
33 | FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 34 | getNInInterests(); |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 35 | |
36 | /// incoming Data (total packets since Face establishment) | ||||
37 | const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 38 | getNInDatas() const; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 39 | |
40 | FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 41 | getNInDatas(); |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 42 | |
43 | /// outgoing Interest (total packets since Face establishment) | ||||
44 | const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 45 | getNOutInterests() const; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 46 | |
47 | FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 48 | getNOutInterests(); |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 49 | |
50 | /// outgoing Data (total packets since Face establishment) | ||||
51 | const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 52 | getNOutDatas() const; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 53 | |
54 | FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 55 | getNOutDatas(); |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 56 | |
57 | private: | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 58 | FaceCounter m_nInInterests; |
59 | FaceCounter m_nInDatas; | ||||
60 | FaceCounter m_outInterests; | ||||
61 | FaceCounter m_outDatas; | ||||
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 62 | }; |
63 | |||||
Alexander Afanasyev | 7e698e6 | 2014-03-07 16:48:35 +0000 | [diff] [blame] | 64 | inline |
65 | FaceCounters::FaceCounters() | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 66 | : m_nInInterests(0) |
67 | , m_nInDatas(0) | ||||
68 | , m_outInterests(0) | ||||
69 | , m_outDatas(0) | ||||
Alexander Afanasyev | 7e698e6 | 2014-03-07 16:48:35 +0000 | [diff] [blame] | 70 | { |
71 | } | ||||
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 72 | |
73 | inline const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 74 | FaceCounters::getNInInterests() const |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 75 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 76 | return m_nInInterests; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 77 | } |
78 | |||||
79 | inline FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 80 | FaceCounters::getNInInterests() |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 81 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 82 | return m_nInInterests; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 83 | } |
84 | |||||
85 | inline const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 86 | FaceCounters::getNInDatas() const |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 87 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 88 | return m_nInDatas; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 89 | } |
90 | |||||
91 | inline FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 92 | FaceCounters::getNInDatas() |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 93 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 94 | return m_nInDatas; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 95 | } |
96 | |||||
97 | inline const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 98 | FaceCounters::getNOutInterests() const |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 99 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 100 | return m_outInterests; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 101 | } |
102 | |||||
103 | inline FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 104 | FaceCounters::getNOutInterests() |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 105 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 106 | return m_outInterests; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 107 | } |
108 | |||||
109 | inline const FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 110 | FaceCounters::getNOutDatas() const |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 111 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 112 | return m_outDatas; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 113 | } |
114 | |||||
115 | inline FaceCounter& | ||||
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 116 | FaceCounters::getNOutDatas() |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 117 | { |
Junxiao Shi | 6e69432 | 2014-04-03 10:27:13 -0700 | [diff] [blame] | 118 | return m_outDatas; |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 119 | } |
120 | |||||
121 | |||||
122 | } // namespace nfd | ||||
123 | |||||
124 | #endif // NFD_FACE_FACE_COUNTER_HPP |