casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
VLAFilterSet.h
Go to the documentation of this file.
00001 //# VLAFilterSet.h: 
00002 //# Copyright (C) 1999,2000
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
00028 
00029 #ifndef NRAO_VLAFILTERSET_H
00030 #define NRAO_VLAFILTERSET_H
00031 
00032 #include <casa/aips.h>
00033 #include <casa/Containers/Block.h>
00034 
00035 #include <casa/namespace.h>
00036 class VLALogicalRecord;
00037 class VLAFilter;
00038 
00039 // <summary></summary>
00040 
00041 // <use visibility=export>
00042 
00043 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
00044 // </reviewed>
00045 
00046 // <prerequisite>
00047 //   <li> SomeClass
00048 //   <li> SomeOtherClass
00049 //   <li> some concept
00050 // </prerequisite>
00051 //
00052 // <etymology>
00053 // </etymology>
00054 //
00055 // <synopsis>
00056 // </synopsis>
00057 //
00058 // <example>
00059 // </example>
00060 //
00061 // <motivation>
00062 // </motivation>
00063 //
00064 // <templating arg=T>
00065 //    <li>
00066 //    <li>
00067 // </templating>
00068 //
00069 // <thrown>
00070 //    <li>
00071 //    <li>
00072 // </thrown>
00073 //
00074 // <todo asof="yyyy/mm/dd">
00075 //   <li> add this feature
00076 //   <li> fix this bug
00077 //   <li> start discussion of this possible extension
00078 // </todo>
00079 
00080 class VLAFilterSet
00081 {
00082 public:
00083   // The default constructor creates a filter set that does not contan any
00084   // filters. Using the passThru function without any filters always returns
00085   // True;
00086   VLAFilterSet();
00087   
00088   // The copy constructor uses copy semantics.
00089   VLAFilterSet(const VLAFilterSet& other);
00090   
00091   // The destructor is trivial
00092   virtual ~VLAFilterSet();
00093   
00094   // The assignment operator uses copy semantics.
00095   VLAFilterSet& operator=(const VLAFilterSet& other);
00096   
00097   // Adds the specified filter to the set.
00098   void addFilter(const VLAFilter& filter);
00099   
00100   // Adds the specified filter from the set. Throws an exception if which is
00101   // not less than the value returned by nelements().
00102   void removeFilter(const uInt which);
00103 
00104   // Returns the number of filters in the set.
00105   uInt nelements() const;
00106 
00107   // Returns a reference to the specified filter
00108   const VLAFilter& filter(const uInt which) const;
00109 
00110   // returns True if the supplied record meets the filter criteria for all the
00111   // filters that are contained within in this filter set. Also returns True if
00112   // there are no filters in the set.
00113   virtual Bool passThru(const VLALogicalRecord& record) const;
00114   
00115   // Function which checks the internal data of this class for correct
00116   // dimensionality and consistant values. Returns True if everything is fine
00117   // otherwise returns False.
00118   virtual Bool ok() const;
00119   
00120 private:
00121   //# deletes all the filters in the current filter set.
00122   void deleteAllFilters();
00123   //# copies all the filters from the specified set to the current one.
00124   void copyFilters(const VLAFilterSet& other);
00125 
00126   PtrBlock<VLAFilter*> itsFilters;
00127 };
00128 
00129 inline uInt VLAFilterSet::nelements() const {
00130   return itsFilters.nelements();
00131 }
00132 
00133 #endif