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& |
| 31 | getInInterest() const; |
| 32 | |
| 33 | FaceCounter& |
| 34 | getInInterest(); |
| 35 | |
| 36 | /// incoming Data (total packets since Face establishment) |
| 37 | const FaceCounter& |
| 38 | getInData() const; |
| 39 | |
| 40 | FaceCounter& |
| 41 | getInData(); |
| 42 | |
| 43 | /// outgoing Interest (total packets since Face establishment) |
| 44 | const FaceCounter& |
| 45 | getOutInterest() const; |
| 46 | |
| 47 | FaceCounter& |
| 48 | getOutInterest(); |
| 49 | |
| 50 | /// outgoing Data (total packets since Face establishment) |
| 51 | const FaceCounter& |
| 52 | getOutData() const; |
| 53 | |
| 54 | FaceCounter& |
| 55 | getOutData(); |
| 56 | |
| 57 | private: |
| 58 | FaceCounter m_inInterest; |
| 59 | FaceCounter m_inData; |
| 60 | FaceCounter m_outInterest; |
| 61 | FaceCounter m_outData; |
| 62 | }; |
| 63 | |
Alexander Afanasyev | 7e698e6 | 2014-03-07 16:48:35 +0000 | [diff] [blame^] | 64 | inline |
| 65 | FaceCounters::FaceCounters() |
| 66 | : m_inInterest(0) |
| 67 | , m_inData(0) |
| 68 | , m_outInterest(0) |
| 69 | , m_outData(0) |
| 70 | { |
| 71 | } |
Junxiao Shi | 7860d48 | 2014-02-21 23:57:20 -0700 | [diff] [blame] | 72 | |
| 73 | inline const FaceCounter& |
| 74 | FaceCounters::getInInterest() const |
| 75 | { |
| 76 | return m_inInterest; |
| 77 | } |
| 78 | |
| 79 | inline FaceCounter& |
| 80 | FaceCounters::getInInterest() |
| 81 | { |
| 82 | return m_inInterest; |
| 83 | } |
| 84 | |
| 85 | inline const FaceCounter& |
| 86 | FaceCounters::getInData() const |
| 87 | { |
| 88 | return m_inData; |
| 89 | } |
| 90 | |
| 91 | inline FaceCounter& |
| 92 | FaceCounters::getInData() |
| 93 | { |
| 94 | return m_inData; |
| 95 | } |
| 96 | |
| 97 | inline const FaceCounter& |
| 98 | FaceCounters::getOutInterest() const |
| 99 | { |
| 100 | return m_outInterest; |
| 101 | } |
| 102 | |
| 103 | inline FaceCounter& |
| 104 | FaceCounters::getOutInterest() |
| 105 | { |
| 106 | return m_outInterest; |
| 107 | } |
| 108 | |
| 109 | inline const FaceCounter& |
| 110 | FaceCounters::getOutData() const |
| 111 | { |
| 112 | return m_outData; |
| 113 | } |
| 114 | |
| 115 | inline FaceCounter& |
| 116 | FaceCounters::getOutData() |
| 117 | { |
| 118 | return m_outData; |
| 119 | } |
| 120 | |
| 121 | |
| 122 | } // namespace nfd |
| 123 | |
| 124 | #endif // NFD_FACE_FACE_COUNTER_HPP |