LCOV - code coverage report
Current view: top level - nrao/VLA - VLAProjectFilter.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 0 39 0.0 %
Date: 2023-11-02 14:27:30 Functions: 0 9 0.0 %

          Line data    Source code
       1             : //# VLAProjectFilter.cc:
       2             : //# Copyright (C) 1999,2000,2001
       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             : //# $Id$
      27             : 
      28             : #include <nrao/VLA/VLAProjectFilter.h>
      29             : #include <nrao/VLA/VLALogicalRecord.h>
      30             : #include <casacore/casa/Exceptions/Error.h>
      31             : #include <casacore/casa/Logging/LogOrigin.h>
      32             : #include <casacore/casa/Logging/LogIO.h>
      33             : #include <casacore/casa/Utilities/Assert.h>
      34             : 
      35           0 : VLAProjectFilter::VLAProjectFilter()
      36           0 :   :itsProject("")
      37             : {
      38           0 :   DebugAssert(ok(), AipsError);
      39           0 : }
      40             : 
      41           0 : VLAProjectFilter::VLAProjectFilter(const String& projectName) 
      42           0 :   :itsProject(projectName)
      43             : {
      44           0 :   itsProject.upcase();
      45           0 :   DebugAssert(ok(), AipsError);
      46           0 : }
      47             : 
      48           0 : VLAProjectFilter::VLAProjectFilter(const VLAProjectFilter& other) 
      49             :   : VLAFilter(),
      50           0 :   itsProject(other.itsProject)
      51             : {
      52           0 :   DebugAssert(ok(), AipsError);
      53           0 : }
      54             : 
      55           0 : VLAProjectFilter::~VLAProjectFilter() {
      56           0 :   DebugAssert(ok(), AipsError);
      57           0 : }
      58             : 
      59           0 : VLAProjectFilter& VLAProjectFilter::operator=(const VLAProjectFilter& other) {
      60           0 :   if (this != &other) {
      61           0 :     itsProject = other.itsProject;
      62             :   }
      63           0 :   DebugAssert(ok(), AipsError);
      64           0 :   return *this;
      65             : }
      66             : 
      67           0 : Bool VLAProjectFilter::passThru(const VLALogicalRecord& record) const {
      68             : //   cerr << "This record ID: |" << record.SDA().obsId()
      69             : //        << "| \trequired ID: |" << itsProject << "|";
      70           0 :   if (itsProject.empty()) return true;
      71           0 :   const String thisProject = upcase(record.SDA().obsId());
      72           0 :   if (thisProject.matches(itsProject)) {
      73             :     //     cerr << " match" << endl;
      74           0 :     return true;
      75             :   } else {
      76             : //     cerr << " NO match" << endl;
      77           0 :     return false;
      78             :   }
      79             : }
      80             : 
      81           0 : VLAFilter* VLAProjectFilter::clone() const {
      82           0 :   DebugAssert(ok(), AipsError);
      83           0 :   VLAProjectFilter* tmpPtr = new VLAProjectFilter(*this);
      84           0 :   AlwaysAssert(tmpPtr != 0, AipsError);
      85           0 :   return tmpPtr;
      86             : }
      87             : 
      88           0 : Bool VLAProjectFilter::ok() const {
      89             :   // The LogIO class is only constructed if an error is detected for
      90             :   // performance reasons. Both function static and file static variables
      91             :   // where considered and rejected for this purpose.
      92           0 :   if (!VLAFilter::ok()) return false; 
      93           0 :   if (itsProject.length() > 6) {
      94           0 :     LogIO logErr(LogOrigin("VLAProjectFilter", "ok()"));
      95             :     logErr << LogIO::SEVERE 
      96             :            << "The project name must have no more than 6 characters"
      97           0 :            << LogIO::POST;
      98           0 :     return false;
      99             :   }
     100           0 :   return true;
     101             : }
     102             : 
     103             : // Local Variables: 
     104             : // compile-command: "gmake VLAProjectFilter"
     105             : // End: 

Generated by: LCOV version 1.16