1 /* Copyright (C) 2021 Free Software Foundation, Inc.
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)
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. */
22 #include "Experiment.h"
23 #include "StringBuilder.h"
24 #include "FilterSet.h"
28 FilterSet::FilterSet (DbeView *_dbev, Experiment *_exp)
33 dfilter = new Vector<FilterNumeric *>;
35 f = new FilterNumeric (exp, "sample", GTXT ("Samples"));
36 f->prop_name = NTXT ("SAMPLE_MAP");
38 f = new FilterNumeric (exp, "thread", GTXT ("Threads"));
39 f->prop_name = NTXT ("THRID");
41 f = new FilterNumeric (exp, "LWP", GTXT ("LWPs"));
42 f->prop_name = NTXT ("LWPID");
44 f = new FilterNumeric (exp, "cpu", GTXT ("CPUs"));
45 f->prop_name = NTXT ("CPUID");
47 f = new FilterNumeric (exp, "gcevent", GTXT ("GCEvents"));
48 f->prop_name = NTXT ("GCEVENT_MAP");
49 dfilter->append (f); // must add new numeric below
52 FilterSet::~FilterSet ()
59 FilterSet::get_filter (int index)
61 if (index < dfilter->size () && index >= 0)
62 return dfilter->fetch (index);
67 FilterSet::get_advanced_filter ()
70 bool filtrIsFalse = false;
74 Vector<FilterNumeric*> *filts = get_all_filters ();
77 for (int i = 0; i < filts->size (); i++)
79 FilterNumeric *f = filts->fetch (i);
82 char *s = f->get_advanced_filter ();
85 if (streq (s, NTXT ("0")))
92 if (sb.length () != 0)
93 sb.append (NTXT (" && "));
102 else if (sb.length () == 0)
104 return sb.toString ();