LCOV - code coverage report
Current view: top level - alma/Enumerations - CFrequencyReferenceCode.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 19 98 19.4 %
Date: 2024-10-04 16:51:10 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 CFrequencyReferenceCode.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CFrequencyReferenceCode.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CFrequencyReferenceCode::version() {
      41           0 :         return FrequencyReferenceCodeMod::version;
      42             :         }
      43             :         
      44           0 : string CFrequencyReferenceCode::revision () {
      45           0 :         return FrequencyReferenceCodeMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CFrequencyReferenceCode::size() {
      49           0 :         return 8;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CFrequencyReferenceCode::sLABREST = "LABREST";
      54             :         
      55             : const std::string& CFrequencyReferenceCode::sLSRD = "LSRD";
      56             :         
      57             : const std::string& CFrequencyReferenceCode::sLSRK = "LSRK";
      58             :         
      59             : const std::string& CFrequencyReferenceCode::sBARY = "BARY";
      60             :         
      61             : const std::string& CFrequencyReferenceCode::sREST = "REST";
      62             :         
      63             : const std::string& CFrequencyReferenceCode::sGEO = "GEO";
      64             :         
      65             : const std::string& CFrequencyReferenceCode::sGALACTO = "GALACTO";
      66             :         
      67             : const std::string& CFrequencyReferenceCode::sTOPO = "TOPO";
      68             :         
      69          83 : const std::vector<std::string> CFrequencyReferenceCode::names() {
      70          83 :     std::vector<std::string> enumSet;
      71             :     
      72          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sLABREST);
      73             :     
      74          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sLSRD);
      75             :     
      76          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sLSRK);
      77             :     
      78          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sBARY);
      79             :     
      80          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sREST);
      81             :     
      82          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sGEO);
      83             :     
      84          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sGALACTO);
      85             :     
      86          83 :     enumSet.insert(enumSet.end(), CFrequencyReferenceCode::sTOPO);
      87             :         
      88          83 :     return enumSet;
      89           0 : }
      90             : 
      91           0 : std::string CFrequencyReferenceCode::name(const FrequencyReferenceCodeMod::FrequencyReferenceCode& f) {
      92           0 :     switch (f) {
      93             :     
      94           0 :     case FrequencyReferenceCodeMod::LABREST:
      95           0 :       return CFrequencyReferenceCode::sLABREST;
      96             :     
      97           0 :     case FrequencyReferenceCodeMod::LSRD:
      98           0 :       return CFrequencyReferenceCode::sLSRD;
      99             :     
     100           0 :     case FrequencyReferenceCodeMod::LSRK:
     101           0 :       return CFrequencyReferenceCode::sLSRK;
     102             :     
     103           0 :     case FrequencyReferenceCodeMod::BARY:
     104           0 :       return CFrequencyReferenceCode::sBARY;
     105             :     
     106           0 :     case FrequencyReferenceCodeMod::REST:
     107           0 :       return CFrequencyReferenceCode::sREST;
     108             :     
     109           0 :     case FrequencyReferenceCodeMod::GEO:
     110           0 :       return CFrequencyReferenceCode::sGEO;
     111             :     
     112           0 :     case FrequencyReferenceCodeMod::GALACTO:
     113           0 :       return CFrequencyReferenceCode::sGALACTO;
     114             :     
     115           0 :     case FrequencyReferenceCodeMod::TOPO:
     116           0 :       return CFrequencyReferenceCode::sTOPO;
     117             :         
     118             :     }
     119             :     // Impossible siutation but....who knows with C++ enums
     120           0 :     throw badInt((int) f);
     121             : }
     122             : 
     123          83 : FrequencyReferenceCodeMod::FrequencyReferenceCode CFrequencyReferenceCode::newFrequencyReferenceCode(const std::string& name) {
     124             :                 
     125          83 :     if (name == CFrequencyReferenceCode::sLABREST) {
     126          83 :         return FrequencyReferenceCodeMod::LABREST;
     127             :     }
     128             :         
     129           0 :     if (name == CFrequencyReferenceCode::sLSRD) {
     130           0 :         return FrequencyReferenceCodeMod::LSRD;
     131             :     }
     132             :         
     133           0 :     if (name == CFrequencyReferenceCode::sLSRK) {
     134           0 :         return FrequencyReferenceCodeMod::LSRK;
     135             :     }
     136             :         
     137           0 :     if (name == CFrequencyReferenceCode::sBARY) {
     138           0 :         return FrequencyReferenceCodeMod::BARY;
     139             :     }
     140             :         
     141           0 :     if (name == CFrequencyReferenceCode::sREST) {
     142           0 :         return FrequencyReferenceCodeMod::REST;
     143             :     }
     144             :         
     145           0 :     if (name == CFrequencyReferenceCode::sGEO) {
     146           0 :         return FrequencyReferenceCodeMod::GEO;
     147             :     }
     148             :         
     149           0 :     if (name == CFrequencyReferenceCode::sGALACTO) {
     150           0 :         return FrequencyReferenceCodeMod::GALACTO;
     151             :     }
     152             :         
     153           0 :     if (name == CFrequencyReferenceCode::sTOPO) {
     154           0 :         return FrequencyReferenceCodeMod::TOPO;
     155             :     }
     156             :     
     157           0 :     throw badString(name);
     158             : }
     159             : 
     160           0 : FrequencyReferenceCodeMod::FrequencyReferenceCode CFrequencyReferenceCode::literal(const std::string& name) {
     161             :                 
     162           0 :     if (name == CFrequencyReferenceCode::sLABREST) {
     163           0 :         return FrequencyReferenceCodeMod::LABREST;
     164             :     }
     165             :         
     166           0 :     if (name == CFrequencyReferenceCode::sLSRD) {
     167           0 :         return FrequencyReferenceCodeMod::LSRD;
     168             :     }
     169             :         
     170           0 :     if (name == CFrequencyReferenceCode::sLSRK) {
     171           0 :         return FrequencyReferenceCodeMod::LSRK;
     172             :     }
     173             :         
     174           0 :     if (name == CFrequencyReferenceCode::sBARY) {
     175           0 :         return FrequencyReferenceCodeMod::BARY;
     176             :     }
     177             :         
     178           0 :     if (name == CFrequencyReferenceCode::sREST) {
     179           0 :         return FrequencyReferenceCodeMod::REST;
     180             :     }
     181             :         
     182           0 :     if (name == CFrequencyReferenceCode::sGEO) {
     183           0 :         return FrequencyReferenceCodeMod::GEO;
     184             :     }
     185             :         
     186           0 :     if (name == CFrequencyReferenceCode::sGALACTO) {
     187           0 :         return FrequencyReferenceCodeMod::GALACTO;
     188             :     }
     189             :         
     190           0 :     if (name == CFrequencyReferenceCode::sTOPO) {
     191           0 :         return FrequencyReferenceCodeMod::TOPO;
     192             :     }
     193             :     
     194           0 :     throw badString(name);
     195             : }
     196             : 
     197          83 : FrequencyReferenceCodeMod::FrequencyReferenceCode CFrequencyReferenceCode::from_int(unsigned int i) {
     198          83 :         vector<string> names_ = names();
     199          83 :         if (i >= names_.size()) throw badInt(i);
     200         166 :         return newFrequencyReferenceCode(names_.at(i));
     201          83 : }
     202             : 
     203           0 : string CFrequencyReferenceCode::badString(const string& name) {
     204           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'FrequencyReferenceCode'.";
     205             : }
     206             : 
     207           0 : string CFrequencyReferenceCode::badInt(unsigned int i) {
     208           0 :         ostringstream oss ;
     209           0 :         oss << "'" << i << "' is out of range for the enumeration 'FrequencyReferenceCode'.";
     210           0 :         return oss.str();
     211           0 : }
     212             : 
     213             : namespace FrequencyReferenceCodeMod {
     214           0 :         std::ostream & operator << ( std::ostream & out, const FrequencyReferenceCode& value) {
     215           0 :                 out << CFrequencyReferenceCode::name(value);
     216           0 :                 return out;
     217             :         }
     218             : 
     219           0 :         std::istream & operator >> ( std::istream & in , FrequencyReferenceCode& value ) {
     220           0 :                 in.clear();
     221           0 :                 string s ; 
     222           0 :                 in >> s;
     223             :                 try {
     224           0 :                 value = CFrequencyReferenceCode::literal(s);
     225             :                 }
     226           0 :                 catch (string & m) {
     227           0 :                 in.setstate(ios::failbit);
     228           0 :                 }
     229           0 :                 return in;
     230           0 :         }
     231             : }
     232             : 

Generated by: LCOV version 1.16