2 ==================================================================================
4 Copyright (c) 2018-2019 AT&T Intellectual Property.
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17 ==================================================================================
20 #ifndef SLIDING_WINDOW_
21 #define SLIDING_WINDOW_
29 #define MIN_WINDOW_SIZE 1 // in seconds
30 #define MAX_WINDOW_SIZE 604800 // in seconds 1 week
32 class sliding_window {
35 sliding_window(unsigned int);
36 bool update_window (unsigned int);
37 std::string display_window(void);
38 bool resize_window(unsigned int);
39 std::string get_error(void) { return error_string ;};
40 unsigned int net_events;
44 std::vector<unsigned int> sliding_window_;
45 unsigned int head, tail, window_size_;
46 std::chrono::time_point<std::chrono::steady_clock> leading_edge_;
47 std::string error_string;