Automatic date update in version.in
[binutils-gdb.git] / gprofng / src / Filter.h
blob6f3cd16cb354bd2a29d965e2059f0b737d90ece4
1 /* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2 Contributed by Oracle.
4 This file is part of GNU Binutils.
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.
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.
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. */
21 #ifndef _FILTER_H
22 #define _FILTER_H
24 // A sample selection specifies a set of samples the user is interested in
25 // viewing as a whole.
27 #include "vec.h"
28 #include "data_pckts.h"
30 class Experiment;
32 class FilterNumeric
34 public:
35 FilterNumeric (Experiment *, const char *, const char *);
36 ~FilterNumeric ();
38 // set or update the range of items first and last
39 void set_range (uint64_t findex, uint64_t lindex, uint64_t total);
41 // Return a string representation of the current ranges
42 // E.g. "1-5,7,9,10,12-13,73"
43 char *get_pattern ();
45 // Return a string for the current status: %, range, ...
46 // E.g. "100%" "100% [1-7]" "25% [1-4]"
47 char *get_status ();
49 char *get_advanced_filter ();
51 // Sets selection according to the string representation
52 // See above for return values and error handling
53 bool set_pattern (char *, bool *);
55 // Return true if "number" is included in selection
56 bool is_selected (uint64_t number);
58 char *
59 get_cmd ()
61 return cmd;
64 char *
65 get_name ()
67 return name;
70 uint64_t
71 nelem ()
73 return nitems;
76 char *prop_name; // name in advanced filter
78 private:
80 typedef struct
82 uint64_t first;
83 uint64_t last;
84 } RangePair;
86 void update_status ();
87 void update_range ();
89 // Include "range" in selection
90 bool include_range (uint64_t findex, uint64_t lindex);
92 // Parse a number from the string
93 uint64_t get_next_number (char *s, char **e, bool *fail);
95 // Data
96 Vector<RangePair *> *items; // sorted array of items
97 uint64_t nselected;
98 uint64_t nitems;
100 Experiment *exp;
101 char *cmd;
102 char *name;
103 char *pattern;
104 char *status;
106 // First and Last items in selection
107 uint64_t first;
108 uint64_t last;
111 #endif /* _FILTER_H */