LCOV - code coverage report
Current view: top level - imageanalysis/IO - AsciiAnnotationFileLine.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 28 50 56.0 %
Date: 2024-12-11 20:54:31 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: casa-feedback@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         598 :         : _type(UNKNOWN_TYPE),
      34         598 :           _comment(""), _annotationBase(0),
      35         598 :           _globals() {}
      36             : 
      37             : 
      38          59 : AsciiAnnotationFileLine::AsciiAnnotationFileLine(
      39             :         const String& comment
      40          59 : ) : _type(COMMENT),
      41          59 :           _comment(comment),
      42          59 :           _annotationBase(0),
      43          59 :           _globals() {
      44          59 :         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         139 :         _annotationBase(annotationBase),
      55         139 :         _globals() {}
      56             : 
      57           0 : AsciiAnnotationFileLine::AsciiAnnotationFileLine(
      58             :         const std::map<AnnotationBase::Keyword, String>& globals
      59           0 : ) : _type(GLOBAL), _comment(""),
      60           0 :         _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