]>
Commit | Line | Data |
---|---|---|
76bdc726 | 1 | /* Copyright (C) 2021-2023 Free Software Foundation, Inc. |
bb368aad VM |
2 | Contributed by Oracle. |
3 | ||
4 | This file is part of GNU Binutils. | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3, or (at your option) | |
9 | any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, 51 Franklin Street - Fifth Floor, Boston, | |
19 | MA 02110-1301, USA. */ | |
20 | ||
21 | #ifndef _FILTER_H | |
22 | #define _FILTER_H | |
23 | ||
24 | // A sample selection specifies a set of samples the user is interested in | |
25 | // viewing as a whole. | |
26 | ||
27 | #include "vec.h" | |
28 | #include "data_pckts.h" | |
29 | ||
30 | class Experiment; | |
31 | ||
32 | class FilterNumeric | |
33 | { | |
34 | public: | |
35 | FilterNumeric (Experiment *, const char *, const char *); | |
36 | ~FilterNumeric (); | |
37 | ||
38 | // set or update the range of items first and last | |
39 | void set_range (uint64_t findex, uint64_t lindex, uint64_t total); | |
40 | ||
41 | // Return a string representation of the current ranges | |
42 | // E.g. "1-5,7,9,10,12-13,73" | |
43 | char *get_pattern (); | |
44 | ||
45 | // Return a string for the current status: %, range, ... | |
46 | // E.g. "100%" "100% [1-7]" "25% [1-4]" | |
47 | char *get_status (); | |
48 | ||
49 | char *get_advanced_filter (); | |
50 | ||
51 | // Sets selection according to the string representation | |
52 | // See above for return values and error handling | |
53 | bool set_pattern (char *, bool *); | |
54 | ||
55 | // Return true if "number" is included in selection | |
56 | bool is_selected (uint64_t number); | |
57 | ||
58 | char * | |
59 | get_cmd () | |
60 | { | |
61 | return cmd; | |
62 | }; | |
63 | ||
64 | char * | |
65 | get_name () | |
66 | { | |
67 | return name; | |
68 | }; | |
69 | ||
70 | uint64_t | |
71 | nelem () | |
72 | { | |
73 | return nitems; | |
74 | }; | |
75 | ||
76 | char *prop_name; // name in advanced filter | |
77 | ||
78 | private: | |
79 | ||
80 | typedef struct | |
81 | { | |
82 | uint64_t first; | |
83 | uint64_t last; | |
84 | } RangePair; | |
85 | ||
86 | void update_status (); | |
87 | void update_range (); | |
88 | ||
89 | // Include "range" in selection | |
90 | bool include_range (uint64_t findex, uint64_t lindex); | |
91 | ||
92 | // Parse a number from the string | |
93 | uint64_t get_next_number (char *s, char **e, bool *fail); | |
94 | ||
95 | // Data | |
96 | Vector<RangePair *> *items; // sorted array of items | |
97 | uint64_t nselected; | |
98 | uint64_t nitems; | |
99 | ||
100 | Experiment *exp; | |
101 | char *cmd; | |
102 | char *name; | |
103 | char *pattern; | |
104 | char *status; | |
105 | ||
106 | // First and Last items in selection | |
107 | uint64_t first; | |
108 | uint64_t last; | |
109 | }; | |
110 | ||
111 | #endif /* _FILTER_H */ |