Line data Source code
1 : //# VLAFilterSet.h: 2 : //# Copyright (C) 1999,2000 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be addressed as follows: 20 : //# Internet email: aips2-request@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# 27 : //# $Id$ 28 : 29 : #ifndef NRAO_VLAFILTERSET_H 30 : #define NRAO_VLAFILTERSET_H 31 : 32 : #include <casacore/casa/aips.h> 33 : #include <casacore/casa/Containers/Block.h> 34 : 35 : #include <casacore/casa/namespace.h> 36 : class VLALogicalRecord; 37 : class VLAFilter; 38 : 39 : // <summary></summary> 40 : 41 : // <use visibility=export> 42 : 43 : // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 44 : // </reviewed> 45 : 46 : // <prerequisite> 47 : // <li> SomeClass 48 : // <li> SomeOtherClass 49 : // <li> some concept 50 : // </prerequisite> 51 : // 52 : // <etymology> 53 : // </etymology> 54 : // 55 : // <synopsis> 56 : // </synopsis> 57 : // 58 : // <example> 59 : // </example> 60 : // 61 : // <motivation> 62 : // </motivation> 63 : // 64 : // <templating arg=T> 65 : // <li> 66 : // <li> 67 : // </templating> 68 : // 69 : // <thrown> 70 : // <li> 71 : // <li> 72 : // </thrown> 73 : // 74 : // <todo asof="yyyy/mm/dd"> 75 : // <li> add this feature 76 : // <li> fix this bug 77 : // <li> start discussion of this possible extension 78 : // </todo> 79 : 80 : class VLAFilterSet 81 : { 82 : public: 83 : // The default constructor creates a filter set that does not contan any 84 : // filters. Using the passThru function without any filters always returns 85 : // true; 86 : VLAFilterSet(); 87 : 88 : // The copy constructor uses copy semantics. 89 : VLAFilterSet(const VLAFilterSet& other); 90 : 91 : // The destructor is trivial 92 : virtual ~VLAFilterSet(); 93 : 94 : // The assignment operator uses copy semantics. 95 : VLAFilterSet& operator=(const VLAFilterSet& other); 96 : 97 : // Adds the specified filter to the set. 98 : void addFilter(const VLAFilter& filter); 99 : 100 : // Adds the specified filter from the set. Throws an exception if which is 101 : // not less than the value returned by nelements(). 102 : void removeFilter(const casacore::uInt which); 103 : 104 : // Returns the number of filters in the set. 105 : casacore::uInt nelements() const; 106 : 107 : // Returns a reference to the specified filter 108 : const VLAFilter& filter(const casacore::uInt which) const; 109 : 110 : // returns true if the supplied record meets the filter criteria for all the 111 : // filters that are contained within in this filter set. Also returns true if 112 : // there are no filters in the set. 113 : virtual casacore::Bool passThru(const VLALogicalRecord& record) const; 114 : 115 : // casacore::Function which checks the internal data of this class for correct 116 : // dimensionality and consistant values. Returns true if everything is fine 117 : // otherwise returns false. 118 : virtual casacore::Bool ok() const; 119 : 120 : private: 121 : //# deletes all the filters in the current filter set. 122 : void deleteAllFilters(); 123 : //# copies all the filters from the specified set to the current one. 124 : void copyFilters(const VLAFilterSet& other); 125 : 126 : casacore::PtrBlock<VLAFilter*> itsFilters; 127 : }; 128 : 129 41890 : inline casacore::uInt VLAFilterSet::nelements() const { 130 41890 : return itsFilters.nelements(); 131 : } 132 : 133 : #endif