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

Generated by: LCOV version 1.16