FD.io VPP  v21.01.1
Vector Packet Processing
stat_reader.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __VOM_STAT_READER_H__
17 #define __VOM_STAT_READER_H__
18 
19 #include "vom/stat_client.hpp"
20 #include <set>
21 
22 namespace VOM {
23 
24 class interface;
25 
26 /**
27  * Stat reader: single interface to get stats
28  */
30 {
31 public:
32  /**
33  * Default Constructor
34  */
35  stat_reader();
36 
37  /**
38  * Constructor
39  */
41 
42  /**
43  * Destructor
44  */
45  ~stat_reader();
46 
47  /**
48  * connection to stat object
49  */
50  virtual int connect();
51 
52  /**
53  * disconnect to stat object
54  */
55  virtual void disconnect();
56 
57  /**
58  * read stats for registered objects from stat_segment
59  * and set those stats to respective objects
60  */
61  virtual void read();
62 
63 private:
64  /**
65  * friend to interface class to call stat_register and
66  * stat_unregister methods
67  */
68  friend class interface;
69 
70  /**
71  * Register objects to get stats for
72  */
73  static void registers(const interface& itf);
74 
75  /**
76  * Unregister objects
77  */
78  static void unregisters(const interface& itf);
79 
80  /**
81  * typedef of stat_indexes
82  */
83  typedef std::set<uint32_t> stat_indexes_t;
84 
85  /**
86  * stat_client object
87  */
88  stat_client m_client;
89 
90  /**
91  * static pointer to set of registered interfaces
92  */
93  static stat_indexes_t m_stat_itf_indexes;
94 };
95 };
96 /*
97  * fd.io coding-style-patch-verification: OFF
98  *
99  * Local Variables:
100  * eval: (c-set-style "mozilla")
101  * End:
102  */
103 #endif
stat_reader()
Default Constructor.
Definition: stat_reader.cpp:23
virtual void read()
read stats for registered objects from stat_segment and set those stats to respective objects ...
Definition: stat_reader.cpp:58
virtual int connect()
connection to stat object
Definition: stat_reader.cpp:34
A representation of a stat client in VPP.
Definition: stat_client.hpp:32
~stat_reader()
Destructor.
Definition: stat_reader.cpp:31
A representation of an interface in VPP.
Definition: interface.hpp:41
The VPP Object Model (VOM) library.
Definition: acl_binding.cpp:19
Stat reader: single interface to get stats.
Definition: stat_reader.hpp:29
virtual void disconnect()
disconnect to stat object
Definition: stat_reader.cpp:40