iFun Engine API  1.0.0-b6053
Great Technology for Great Games
counter.h
Go to the documentation of this file.
1 // Copyright (C) 2013-2020 iFunFactory Inc. All Rights Reserved.
2 //
3 // This work is confidential and proprietary to iFunFactory Inc. and
4 // must not be used, disclosed, copied, or distributed without the prior
5 // consent of iFunFactory Inc.
6 
9 #ifndef INCLUDE_FUNAPI_MANAGEMENT_COUNTER_H_
10 #define INCLUDE_FUNAPI_MANAGEMENT_COUNTER_H_
11 
12 #include <boost/asio/ip/address.hpp>
13 #include <funapi/common/json.h>
15 #include <funapi/types.h>
16 
17 
18 namespace fun {
19 
20 typedef boost::function<
21  http::StatusCode(const string &, const string &, Json *)> CounterCallback;
22 
23 
24 FUNAPI_DLL_VISIBILITY
25 void UpdateCounter(const string &counter_type,
26  const string &counter_path,
27  const int32_t &value);
28 
29 
30 FUNAPI_DLL_VISIBILITY
31 void UpdateCounter(const string &counter_type,
32  const string &counter_path,
33  const int64_t &value);
34 
35 
36 FUNAPI_DLL_VISIBILITY
37 void UpdateCounter(const string &counter_type,
38  const string &counter_path,
39  const double &value);
40 
41 
42 FUNAPI_DLL_VISIBILITY
43 void UpdateCounter(const string &counter_type,
44  const string &counter_path,
45  const string &value);
46 
47 
48 FUNAPI_DLL_VISIBILITY
49 void UpdateCounter(const string &counter_type,
50  const string &counter_path,
51  const string &description,
52  const int32_t &value);
53 
54 
55 FUNAPI_DLL_VISIBILITY
56 void UpdateCounter(const string &counter_type,
57  const string &counter_path,
58  const string &description,
59  const int64_t &value);
60 
61 
62 FUNAPI_DLL_VISIBILITY
63 void UpdateCounter(const string &counter_type,
64  const string &counter_path,
65  const string &description,
66  const double &value);
67 
68 
69 FUNAPI_DLL_VISIBILITY
70 void UpdateCounter(const string &counter_type,
71  const string &counter_path,
72  const string &description,
73  const string &value);
74 
75 
76 FUNAPI_DLL_VISIBILITY
77 void IncreaseCounterBy(const string &counter_type,
78  const string &counter_path,
79  const int32_t &value);
80 
81 
82 FUNAPI_DLL_VISIBILITY
83 void DecreaseCounterBy(const string &counter_type,
84  const string &counter_path,
85  const int32_t &value);
86 
87 
88 FUNAPI_DLL_VISIBILITY
89 void IncreaseCounterBy(const string &counter_type,
90  const string &counter_path,
91  const int64_t &value);
92 
93 
94 FUNAPI_DLL_VISIBILITY
95 void DecreaseCounterBy(const string &counter_type,
96  const string &counter_path,
97  const int64_t &value);
98 
99 
100 FUNAPI_DLL_VISIBILITY
101 void IncreaseCounterBy(const string &counter_type,
102  const string &counter_path,
103  const double &value);
104 
105 
106 FUNAPI_DLL_VISIBILITY
107 void DecreaseCounterBy(const string &counter_type,
108  const string &counter_path,
109  const double &value);
110 
111 
112 FUNAPI_DLL_VISIBILITY
113 int64_t ReadCounterAsInteger(const string &counter_type,
114  const string &counter_path);
115 
116 
117 FUNAPI_DLL_VISIBILITY
118 double ReadCounterAsDouble(const string &counter_type,
119  const string &counter_path);
120 
121 
122 FUNAPI_DLL_VISIBILITY
123 string ReadCounterAsString(const string &counter_type,
124  const string &counter_path);
125 
126 
127 FUNAPI_DLL_VISIBILITY Json ReadAllCounters();
128 
129 
130 FUNAPI_DLL_VISIBILITY
131 void RegisterCallableCounter(const string &counter_type,
132  const string &counter_path,
133  const string &desc,
134  const CounterCallback &value_cb);
135 
136 
137 FUNAPI_DLL_VISIBILITY
138 void MonitorCounter(const string &counter_type,
139  const string &counter_path,
140  double threshold);
141 
142 } // namespace fun
143 
144 #endif // INCLUDE_FUNAPI_MANAGEMENT_COUNTER_H_
Definition: json.h:18