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 |
| 16 | */ |
| 17 | typedef uint64_t FaceCounter; |
| 18 | |
| 19 | |
| 20 | /** \brief contains counters on face |
| 21 | */ |
| 22 | class FaceCounters |
| 23 | { |
| 24 | public: |
| 25 | FaceCounters(); |
| 26 | |
| 27 | /// incoming Interest (total packets since Face establishment) |
| 28 | const FaceCounter& |
| 29 | getInInterest() const; |
| 30 | |
| 31 | FaceCounter& |
| 32 | getInInterest(); |
| 33 | |
| 34 | /// incoming Data (total packets since Face establishment) |
| 35 | const FaceCounter& |
| 36 | getInData() const; |
| 37 | |
| 38 | FaceCounter& |
| 39 | getInData(); |
| 40 | |
| 41 | /// outgoing Interest (total packets since Face establishment) |
| 42 | const FaceCounter& |
| 43 | getOutInterest() const; |
| 44 | |
| 45 | FaceCounter& |
| 46 | getOutInterest(); |
| 47 | |
| 48 | /// outgoing Data (total packets since Face establishment) |
| 49 | const FaceCounter& |
| 50 | getOutData() const; |
| 51 | |
| 52 | FaceCounter& |
| 53 | getOutData(); |
| 54 | |
| 55 | private: |
| 56 | FaceCounter m_inInterest; |
| 57 | FaceCounter m_inData; |
| 58 | FaceCounter m_outInterest; |
| 59 | FaceCounter m_outData; |
| 60 | }; |
| 61 | |
| 62 | |
| 63 | inline const FaceCounter& |
| 64 | FaceCounters::getInInterest() const |
| 65 | { |
| 66 | return m_inInterest; |
| 67 | } |
| 68 | |
| 69 | inline FaceCounter& |
| 70 | FaceCounters::getInInterest() |
| 71 | { |
| 72 | return m_inInterest; |
| 73 | } |
| 74 | |
| 75 | inline const FaceCounter& |
| 76 | FaceCounters::getInData() const |
| 77 | { |
| 78 | return m_inData; |
| 79 | } |
| 80 | |
| 81 | inline FaceCounter& |
| 82 | FaceCounters::getInData() |
| 83 | { |
| 84 | return m_inData; |
| 85 | } |
| 86 | |
| 87 | inline const FaceCounter& |
| 88 | FaceCounters::getOutInterest() const |
| 89 | { |
| 90 | return m_outInterest; |
| 91 | } |
| 92 | |
| 93 | inline FaceCounter& |
| 94 | FaceCounters::getOutInterest() |
| 95 | { |
| 96 | return m_outInterest; |
| 97 | } |
| 98 | |
| 99 | inline const FaceCounter& |
| 100 | FaceCounters::getOutData() const |
| 101 | { |
| 102 | return m_outData; |
| 103 | } |
| 104 | |
| 105 | inline FaceCounter& |
| 106 | FaceCounters::getOutData() |
| 107 | { |
| 108 | return m_outData; |
| 109 | } |
| 110 | |
| 111 | |
| 112 | } // namespace nfd |
| 113 | |
| 114 | #endif // NFD_FACE_FACE_COUNTER_HPP |