Commits
justo.gonzalez authored e6af9b18f42
1 + | //# LogFilterParallel.h: This file contains the implementation of the LogFilterParallel class. |
2 + | //# |
3 + | //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/) |
4 + | //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved. |
5 + | //# Copyright (C) European Southern Observatory, 2011, All rights reserved. |
6 + | //# |
7 + | //# This library is free software; you can redistribute it and/or |
8 + | //# modify it under the terms of the GNU Lesser General Public |
9 + | //# License as published by the Free software Foundation; either |
10 + | //# version 2.1 of the License, or (at your option) any later version. |
11 + | //# |
12 + | //# This library is distributed in the hope that it will be useful, |
13 + | //# but WITHOUT ANY WARRANTY, without even the implied warranty of |
14 + | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 + | //# Lesser General Public License for more details. |
16 + | //# |
17 + | //# You should have received a copy of the GNU Lesser General Public |
18 + | //# License along with this library; if not, write to the Free Software |
19 + | //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
20 + | //# MA 02111-1307 USA |
21 + | //# $Id: $ |
22 + | |
23 + | |
24 + | |
25 + | |
26 + | namespace casa { //# NAMESPACE CASA - BEGIN |
27 + | |
28 + | |
29 + | LogFilterParallel::LogFilterParallel (LogMessage::Priority lowest) |
30 + | : LogFilter(lowest) |
31 + | { |
32 + | filterOutVector_p.clear(); |
33 + | } |
34 + | |
35 + | |
36 + | LogFilterParallel::LogFilterParallel (const LogFilterParallel& other) |
37 + | : LogFilter(other), |
38 + | filterOutVector_p(other.filterOutVector_p) |
39 + | { |
40 + | |
41 + | } |
42 + | |
43 + | |
44 + | LogFilterParallel& LogFilterParallel::operator=(const LogFilterParallel& other) |
45 + | { |
46 + | if (this != &other) |
47 + | { |
48 + | LogFilter::operator =(other); |
49 + | filterOutVector_p = other.filterOutVector_p; |
50 + | } |
51 + | |
52 + | return *this; |
53 + | } |
54 + | |
55 + | |
56 + | LogFilterParallel::~LogFilterParallel() |
57 + | { |
58 + | filterOutVector_p.clear(); |
59 + | } |
60 + | |
61 + | |
62 + | LogFilterParallel* LogFilterParallel::clone() const |
63 + | { |
64 + | return new LogFilterParallel(*this); |
65 + | } |
66 + | |
67 + | |
68 + | Bool LogFilterParallel::pass(const LogMessage& message) const |
69 + | { |
70 + | Bool ret = False; |
71 + | Bool priorityPass = LogFilter::pass(message); |
72 + | |
73 + | if (priorityPass) |
74 + | { |
75 + | ret = True; |
76 + | for(std::vector<String>::const_iterator it = filterOutVector_p.begin(); it != filterOutVector_p.end(); ++it) |
77 + | { |
78 + | if (message.message().contains(*it)) |
79 + | { |
80 + | ret = False; |
81 + | break; |
82 + | } |
83 + | } |
84 + | } |
85 + | else |
86 + | { |
87 + | ret = False; |
88 + | } |
89 + | |
90 + | return ret; |
91 + | } |
92 + | |
93 + | |
94 + | void LogFilterParallel::filterOut(const Char *text) |
95 + | { |
96 + | filterOutVector_p.push_back(String(text)); |
97 + | } |
98 + | |
99 + | |
100 + | |
101 + | } //# NAMESPACE CASA - END |