LCOV - code coverage report
Current view: top level - alma/Enumerations - CRadialVelocityReferenceCode.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 25 84 29.8 %
Date: 2024-12-11 20:54:31 Functions: 3 12 25.0 %

          Line data    Source code
       1             : 
       2             : /*
       3             :  * ALMA - Atacama Large Millimeter Array
       4             :  * (c) European Southern Observatory, 2002
       5             :  * (c) Associated Universities Inc., 2002
       6             :  * Copyright by ESO (in the framework of the ALMA collaboration),
       7             :  * Copyright by AUI (in the framework of the ALMA collaboration),
       8             :  * All rights reserved.
       9             :  * 
      10             :  * This library is free software; you can redistribute it and/or
      11             :  * modify it under the terms of the GNU Lesser General Public
      12             :  * License as published by the Free software Foundation; either
      13             :  * version 2.1 of the License, or (at your option) any later version.
      14             :  * 
      15             :  * This library is distributed in the hope that it will be useful,
      16             :  * but WITHOUT ANY WARRANTY, without even the implied warranty of
      17             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      18             :  * Lesser General Public License for more details.
      19             :  * 
      20             :  * You should have received a copy of the GNU Lesser General Public
      21             :  * License along with this library; if not, write to the Free Software
      22             :  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      23             :  * MA 02111-1307  USA
      24             :  * 
      25             :  * /////////////////////////////////////////////////////////////////
      26             :  * // WARNING!  DO NOT MODIFY THIS FILE!                          //
      27             :  * //  ---------------------------------------------------------  //
      28             :  * // | This is generated code!  Do not modify this file.       | //
      29             :  * // | Any changes will be lost when the file is re-generated. | //
      30             :  * //  ---------------------------------------------------------  //
      31             :  * /////////////////////////////////////////////////////////////////
      32             :  *
      33             :  * File CRadialVelocityReferenceCode.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CRadialVelocityReferenceCode.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CRadialVelocityReferenceCode::version() {
      41           0 :         return RadialVelocityReferenceCodeMod::version;
      42             :         }
      43             :         
      44           0 : string CRadialVelocityReferenceCode::revision () {
      45           0 :         return RadialVelocityReferenceCodeMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CRadialVelocityReferenceCode::size() {
      49           0 :         return 6;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CRadialVelocityReferenceCode::sLSRD = "LSRD";
      54             :         
      55             : const std::string& CRadialVelocityReferenceCode::sLSRK = "LSRK";
      56             :         
      57             : const std::string& CRadialVelocityReferenceCode::sGALACTO = "GALACTO";
      58             :         
      59             : const std::string& CRadialVelocityReferenceCode::sBARY = "BARY";
      60             :         
      61             : const std::string& CRadialVelocityReferenceCode::sGEO = "GEO";
      62             :         
      63             : const std::string& CRadialVelocityReferenceCode::sTOPO = "TOPO";
      64             :         
      65       20512 : const std::vector<std::string> CRadialVelocityReferenceCode::names() {
      66       20512 :     std::vector<std::string> enumSet;
      67             :     
      68       20512 :     enumSet.insert(enumSet.end(), CRadialVelocityReferenceCode::sLSRD);
      69             :     
      70       20512 :     enumSet.insert(enumSet.end(), CRadialVelocityReferenceCode::sLSRK);
      71             :     
      72       20512 :     enumSet.insert(enumSet.end(), CRadialVelocityReferenceCode::sGALACTO);
      73             :     
      74       20512 :     enumSet.insert(enumSet.end(), CRadialVelocityReferenceCode::sBARY);
      75             :     
      76       20512 :     enumSet.insert(enumSet.end(), CRadialVelocityReferenceCode::sGEO);
      77             :     
      78       20512 :     enumSet.insert(enumSet.end(), CRadialVelocityReferenceCode::sTOPO);
      79             :         
      80       20512 :     return enumSet;
      81           0 : }
      82             : 
      83           0 : std::string CRadialVelocityReferenceCode::name(const RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode& f) {
      84           0 :     switch (f) {
      85             :     
      86           0 :     case RadialVelocityReferenceCodeMod::LSRD:
      87           0 :       return CRadialVelocityReferenceCode::sLSRD;
      88             :     
      89           0 :     case RadialVelocityReferenceCodeMod::LSRK:
      90           0 :       return CRadialVelocityReferenceCode::sLSRK;
      91             :     
      92           0 :     case RadialVelocityReferenceCodeMod::GALACTO:
      93           0 :       return CRadialVelocityReferenceCode::sGALACTO;
      94             :     
      95           0 :     case RadialVelocityReferenceCodeMod::BARY:
      96           0 :       return CRadialVelocityReferenceCode::sBARY;
      97             :     
      98           0 :     case RadialVelocityReferenceCodeMod::GEO:
      99           0 :       return CRadialVelocityReferenceCode::sGEO;
     100             :     
     101           0 :     case RadialVelocityReferenceCodeMod::TOPO:
     102           0 :       return CRadialVelocityReferenceCode::sTOPO;
     103             :         
     104             :     }
     105             :     // Impossible siutation but....who knows with C++ enums
     106           0 :     throw badInt((int) f);
     107             : }
     108             : 
     109       21832 : RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode CRadialVelocityReferenceCode::newRadialVelocityReferenceCode(const std::string& name) {
     110             :                 
     111       21832 :     if (name == CRadialVelocityReferenceCode::sLSRD) {
     112       21056 :         return RadialVelocityReferenceCodeMod::LSRD;
     113             :     }
     114             :         
     115         776 :     if (name == CRadialVelocityReferenceCode::sLSRK) {
     116         672 :         return RadialVelocityReferenceCodeMod::LSRK;
     117             :     }
     118             :         
     119         104 :     if (name == CRadialVelocityReferenceCode::sGALACTO) {
     120           0 :         return RadialVelocityReferenceCodeMod::GALACTO;
     121             :     }
     122             :         
     123         104 :     if (name == CRadialVelocityReferenceCode::sBARY) {
     124          40 :         return RadialVelocityReferenceCodeMod::BARY;
     125             :     }
     126             :         
     127          64 :     if (name == CRadialVelocityReferenceCode::sGEO) {
     128           0 :         return RadialVelocityReferenceCodeMod::GEO;
     129             :     }
     130             :         
     131          64 :     if (name == CRadialVelocityReferenceCode::sTOPO) {
     132          64 :         return RadialVelocityReferenceCodeMod::TOPO;
     133             :     }
     134             :     
     135           0 :     throw badString(name);
     136             : }
     137             : 
     138           0 : RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode CRadialVelocityReferenceCode::literal(const std::string& name) {
     139             :                 
     140           0 :     if (name == CRadialVelocityReferenceCode::sLSRD) {
     141           0 :         return RadialVelocityReferenceCodeMod::LSRD;
     142             :     }
     143             :         
     144           0 :     if (name == CRadialVelocityReferenceCode::sLSRK) {
     145           0 :         return RadialVelocityReferenceCodeMod::LSRK;
     146             :     }
     147             :         
     148           0 :     if (name == CRadialVelocityReferenceCode::sGALACTO) {
     149           0 :         return RadialVelocityReferenceCodeMod::GALACTO;
     150             :     }
     151             :         
     152           0 :     if (name == CRadialVelocityReferenceCode::sBARY) {
     153           0 :         return RadialVelocityReferenceCodeMod::BARY;
     154             :     }
     155             :         
     156           0 :     if (name == CRadialVelocityReferenceCode::sGEO) {
     157           0 :         return RadialVelocityReferenceCodeMod::GEO;
     158             :     }
     159             :         
     160           0 :     if (name == CRadialVelocityReferenceCode::sTOPO) {
     161           0 :         return RadialVelocityReferenceCodeMod::TOPO;
     162             :     }
     163             :     
     164           0 :     throw badString(name);
     165             : }
     166             : 
     167       20512 : RadialVelocityReferenceCodeMod::RadialVelocityReferenceCode CRadialVelocityReferenceCode::from_int(unsigned int i) {
     168       20512 :         vector<string> names_ = names();
     169       20512 :         if (i >= names_.size()) throw badInt(i);
     170       41024 :         return newRadialVelocityReferenceCode(names_.at(i));
     171       20512 : }
     172             : 
     173           0 : string CRadialVelocityReferenceCode::badString(const string& name) {
     174           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'RadialVelocityReferenceCode'.";
     175             : }
     176             : 
     177           0 : string CRadialVelocityReferenceCode::badInt(unsigned int i) {
     178           0 :         ostringstream oss ;
     179           0 :         oss << "'" << i << "' is out of range for the enumeration 'RadialVelocityReferenceCode'.";
     180           0 :         return oss.str();
     181           0 : }
     182             : 
     183             : namespace RadialVelocityReferenceCodeMod {
     184           0 :         std::ostream & operator << ( std::ostream & out, const RadialVelocityReferenceCode& value) {
     185           0 :                 out << CRadialVelocityReferenceCode::name(value);
     186           0 :                 return out;
     187             :         }
     188             : 
     189           0 :         std::istream & operator >> ( std::istream & in , RadialVelocityReferenceCode& value ) {
     190           0 :                 in.clear();
     191           0 :                 string s ; 
     192           0 :                 in >> s;
     193             :                 try {
     194           0 :                 value = CRadialVelocityReferenceCode::literal(s);
     195             :                 }
     196           0 :                 catch (string & m) {
     197           0 :                 in.setstate(ios::failbit);
     198           0 :                 }
     199           0 :                 return in;
     200           0 :         }
     201             : }
     202             : 

Generated by: LCOV version 1.16