blob: ba3b98e72dd700aabf6c5cd38b72b97c45e7f40b [file] [log] [blame]
Junxiao Shi7860d482014-02-21 23:57:20 -07001/* -*- 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
12namespace nfd {
13
14/** \class FaceCounter
15 * \brief represents a counter on face
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000016 *
17 * \todo This class should be noncopyable
Junxiao Shi7860d482014-02-21 23:57:20 -070018 */
19typedef uint64_t FaceCounter;
20
21
22/** \brief contains counters on face
23 */
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000024class FaceCounters : noncopyable
Junxiao Shi7860d482014-02-21 23:57:20 -070025{
26public:
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
57private:
58 FaceCounter m_inInterest;
59 FaceCounter m_inData;
60 FaceCounter m_outInterest;
61 FaceCounter m_outData;
62};
63
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000064inline
65FaceCounters::FaceCounters()
66 : m_inInterest(0)
67 , m_inData(0)
68 , m_outInterest(0)
69 , m_outData(0)
70{
71}
Junxiao Shi7860d482014-02-21 23:57:20 -070072
73inline const FaceCounter&
74FaceCounters::getInInterest() const
75{
76 return m_inInterest;
77}
78
79inline FaceCounter&
80FaceCounters::getInInterest()
81{
82 return m_inInterest;
83}
84
85inline const FaceCounter&
86FaceCounters::getInData() const
87{
88 return m_inData;
89}
90
91inline FaceCounter&
92FaceCounters::getInData()
93{
94 return m_inData;
95}
96
97inline const FaceCounter&
98FaceCounters::getOutInterest() const
99{
100 return m_outInterest;
101}
102
103inline FaceCounter&
104FaceCounters::getOutInterest()
105{
106 return m_outInterest;
107}
108
109inline const FaceCounter&
110FaceCounters::getOutData() const
111{
112 return m_outData;
113}
114
115inline FaceCounter&
116FaceCounters::getOutData()
117{
118 return m_outData;
119}
120
121
122} // namespace nfd
123
124#endif // NFD_FACE_FACE_COUNTER_HPP