LCOV - code coverage report
Current view: top level - imageanalysis/IO - AsciiAnnotationFileLine.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 23 44 52.3 %
Date: 2023-11-06 10:06:49 Functions: 6 10 60.0 %

          Line data    Source code
       1             : //# AsciiRegionLine.cc
       2             : //# Copyright (C) 1998,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             : 
      27             : #include <imageanalysis/IO/AsciiAnnotationFileLine.h>
      28             : 
      29             : using namespace casacore;
      30             : namespace casa {
      31             : 
      32         598 : AsciiAnnotationFileLine::AsciiAnnotationFileLine()
      33             :         : _type(UNKNOWN_TYPE),
      34             :           _comment(""), _annotationBase(0),
      35         598 :           _globals() {}
      36             : 
      37             : 
      38          59 : AsciiAnnotationFileLine::AsciiAnnotationFileLine(
      39             :         const String& comment
      40          59 : ) : _type(COMMENT),
      41             :           _comment(comment),
      42             :           _annotationBase(0),
      43          59 :           _globals() {
      44         118 :         String b = _comment;
      45          59 :         b.trim();
      46          59 :         if (! b.empty() && ! b.startsWith("#")) {
      47           0 :                 _comment = "#" + comment;
      48             :         }
      49          59 : }
      50             : 
      51         139 : AsciiAnnotationFileLine::AsciiAnnotationFileLine(
      52             :         CountedPtr<const AnnotationBase> annotationBase
      53         139 : ) : _type(ANNOTATION), _comment(""),
      54             :         _annotationBase(annotationBase),
      55         139 :         _globals() {}
      56             : 
      57           0 : AsciiAnnotationFileLine::AsciiAnnotationFileLine(
      58             :         const std::map<AnnotationBase::Keyword, String>& globals
      59           0 : ) : _type(GLOBAL), _comment(""),
      60             :         _annotationBase(0),
      61           0 :         _globals(globals) {}
      62             : 
      63             : 
      64         598 : AsciiAnnotationFileLine& AsciiAnnotationFileLine::operator= (
      65             :         const AsciiAnnotationFileLine& other
      66             : ) {
      67         598 :         if (this != &other) {
      68         598 :                 _type = other._type;
      69         598 :                 _comment = other._comment;
      70         598 :                 _annotationBase = other._annotationBase;
      71         598 :                 _globals = other._globals;
      72             :         }
      73         598 :         return *this;
      74             : }
      75             : 
      76           0 : String AsciiAnnotationFileLine::getComment() const {
      77           0 :         return _comment;
      78             : }
      79             : 
      80           0 : std::map<AnnotationBase::Keyword, String> AsciiAnnotationFileLine::getGloabalParams() const {
      81           0 :         return _globals;
      82             : }
      83             : 
      84         139 : CountedPtr<const AnnotationBase> AsciiAnnotationFileLine::getAnnotationBase() const {
      85         139 :         return _annotationBase;
      86             : }
      87             : 
      88         197 : AsciiAnnotationFileLine::Type AsciiAnnotationFileLine::getType() const {
      89         197 :         return _type;
      90             : }
      91             : 
      92           0 : ostream& AsciiAnnotationFileLine::print(ostream& os) const {
      93           0 :         switch(_type) {
      94           0 :         case COMMENT:
      95           0 :                 os << _comment;
      96           0 :                 return os;
      97           0 :         case ANNOTATION:
      98           0 :                 os << *_annotationBase;
      99           0 :                 return os;
     100           0 :         case GLOBAL:
     101           0 :                 os << "global " << _globals;
     102           0 :                 return os;
     103           0 :         default:
     104           0 :                 return os;
     105             :         }
     106             : 
     107             : }
     108             : 
     109             : }
     110             : 
     111             : 

Generated by: LCOV version 1.16