blob: 683e6e5a39e52d15d306324af818488d6103edbb [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&
Junxiao Shi6e694322014-04-03 10:27:13 -070031 getNInInterests() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070032
33 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070034 getNInInterests();
Junxiao Shi7860d482014-02-21 23:57:20 -070035
36 /// incoming Data (total packets since Face establishment)
37 const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070038 getNInDatas() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070039
40 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070041 getNInDatas();
Junxiao Shi7860d482014-02-21 23:57:20 -070042
43 /// outgoing Interest (total packets since Face establishment)
44 const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070045 getNOutInterests() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070046
47 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070048 getNOutInterests();
Junxiao Shi7860d482014-02-21 23:57:20 -070049
50 /// outgoing Data (total packets since Face establishment)
51 const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070052 getNOutDatas() const;
Junxiao Shi7860d482014-02-21 23:57:20 -070053
54 FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070055 getNOutDatas();
Junxiao Shi7860d482014-02-21 23:57:20 -070056
57private:
Junxiao Shi6e694322014-04-03 10:27:13 -070058 FaceCounter m_nInInterests;
59 FaceCounter m_nInDatas;
60 FaceCounter m_outInterests;
61 FaceCounter m_outDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -070062};
63
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000064inline
65FaceCounters::FaceCounters()
Junxiao Shi6e694322014-04-03 10:27:13 -070066 : m_nInInterests(0)
67 , m_nInDatas(0)
68 , m_outInterests(0)
69 , m_outDatas(0)
Alexander Afanasyev7e698e62014-03-07 16:48:35 +000070{
71}
Junxiao Shi7860d482014-02-21 23:57:20 -070072
73inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070074FaceCounters::getNInInterests() const
Junxiao Shi7860d482014-02-21 23:57:20 -070075{
Junxiao Shi6e694322014-04-03 10:27:13 -070076 return m_nInInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -070077}
78
79inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070080FaceCounters::getNInInterests()
Junxiao Shi7860d482014-02-21 23:57:20 -070081{
Junxiao Shi6e694322014-04-03 10:27:13 -070082 return m_nInInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -070083}
84
85inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070086FaceCounters::getNInDatas() const
Junxiao Shi7860d482014-02-21 23:57:20 -070087{
Junxiao Shi6e694322014-04-03 10:27:13 -070088 return m_nInDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -070089}
90
91inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070092FaceCounters::getNInDatas()
Junxiao Shi7860d482014-02-21 23:57:20 -070093{
Junxiao Shi6e694322014-04-03 10:27:13 -070094 return m_nInDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -070095}
96
97inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -070098FaceCounters::getNOutInterests() const
Junxiao Shi7860d482014-02-21 23:57:20 -070099{
Junxiao Shi6e694322014-04-03 10:27:13 -0700100 return m_outInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -0700101}
102
103inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700104FaceCounters::getNOutInterests()
Junxiao Shi7860d482014-02-21 23:57:20 -0700105{
Junxiao Shi6e694322014-04-03 10:27:13 -0700106 return m_outInterests;
Junxiao Shi7860d482014-02-21 23:57:20 -0700107}
108
109inline const FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700110FaceCounters::getNOutDatas() const
Junxiao Shi7860d482014-02-21 23:57:20 -0700111{
Junxiao Shi6e694322014-04-03 10:27:13 -0700112 return m_outDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -0700113}
114
115inline FaceCounter&
Junxiao Shi6e694322014-04-03 10:27:13 -0700116FaceCounters::getNOutDatas()
Junxiao Shi7860d482014-02-21 23:57:20 -0700117{
Junxiao Shi6e694322014-04-03 10:27:13 -0700118 return m_outDatas;
Junxiao Shi7860d482014-02-21 23:57:20 -0700119}
120
121
122} // namespace nfd
123
124#endif // NFD_FACE_FACE_COUNTER_HPP