LCOV - code coverage report
Current view: top level - alma/Enumerations - CSidebandProcessingMode.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 21 77 27.3 %
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 CSidebandProcessingMode.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CSidebandProcessingMode.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CSidebandProcessingMode::version() {
      41           0 :         return SidebandProcessingModeMod::version;
      42             :         }
      43             :         
      44           0 : string CSidebandProcessingMode::revision () {
      45           0 :         return SidebandProcessingModeMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CSidebandProcessingMode::size() {
      49           0 :         return 5;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CSidebandProcessingMode::sNONE = "NONE";
      54             :         
      55             : const std::string& CSidebandProcessingMode::sPHASE_SWITCH_SEPARATION = "PHASE_SWITCH_SEPARATION";
      56             :         
      57             : const std::string& CSidebandProcessingMode::sFREQUENCY_OFFSET_SEPARATION = "FREQUENCY_OFFSET_SEPARATION";
      58             :         
      59             : const std::string& CSidebandProcessingMode::sPHASE_SWITCH_REJECTION = "PHASE_SWITCH_REJECTION";
      60             :         
      61             : const std::string& CSidebandProcessingMode::sFREQUENCY_OFFSET_REJECTION = "FREQUENCY_OFFSET_REJECTION";
      62             :         
      63          83 : const std::vector<std::string> CSidebandProcessingMode::names() {
      64          83 :     std::vector<std::string> enumSet;
      65             :     
      66          83 :     enumSet.insert(enumSet.end(), CSidebandProcessingMode::sNONE);
      67             :     
      68          83 :     enumSet.insert(enumSet.end(), CSidebandProcessingMode::sPHASE_SWITCH_SEPARATION);
      69             :     
      70          83 :     enumSet.insert(enumSet.end(), CSidebandProcessingMode::sFREQUENCY_OFFSET_SEPARATION);
      71             :     
      72          83 :     enumSet.insert(enumSet.end(), CSidebandProcessingMode::sPHASE_SWITCH_REJECTION);
      73             :     
      74          83 :     enumSet.insert(enumSet.end(), CSidebandProcessingMode::sFREQUENCY_OFFSET_REJECTION);
      75             :         
      76          83 :     return enumSet;
      77           0 : }
      78             : 
      79           0 : std::string CSidebandProcessingMode::name(const SidebandProcessingModeMod::SidebandProcessingMode& f) {
      80           0 :     switch (f) {
      81             :     
      82           0 :     case SidebandProcessingModeMod::NONE:
      83           0 :       return CSidebandProcessingMode::sNONE;
      84             :     
      85           0 :     case SidebandProcessingModeMod::PHASE_SWITCH_SEPARATION:
      86           0 :       return CSidebandProcessingMode::sPHASE_SWITCH_SEPARATION;
      87             :     
      88           0 :     case SidebandProcessingModeMod::FREQUENCY_OFFSET_SEPARATION:
      89           0 :       return CSidebandProcessingMode::sFREQUENCY_OFFSET_SEPARATION;
      90             :     
      91           0 :     case SidebandProcessingModeMod::PHASE_SWITCH_REJECTION:
      92           0 :       return CSidebandProcessingMode::sPHASE_SWITCH_REJECTION;
      93             :     
      94           0 :     case SidebandProcessingModeMod::FREQUENCY_OFFSET_REJECTION:
      95           0 :       return CSidebandProcessingMode::sFREQUENCY_OFFSET_REJECTION;
      96             :         
      97             :     }
      98             :     // Impossible siutation but....who knows with C++ enums
      99           0 :     throw badInt((int) f);
     100             : }
     101             : 
     102         166 : SidebandProcessingModeMod::SidebandProcessingMode CSidebandProcessingMode::newSidebandProcessingMode(const std::string& name) {
     103             :                 
     104         166 :     if (name == CSidebandProcessingMode::sNONE) {
     105         164 :         return SidebandProcessingModeMod::NONE;
     106             :     }
     107             :         
     108           2 :     if (name == CSidebandProcessingMode::sPHASE_SWITCH_SEPARATION) {
     109           0 :         return SidebandProcessingModeMod::PHASE_SWITCH_SEPARATION;
     110             :     }
     111             :         
     112           2 :     if (name == CSidebandProcessingMode::sFREQUENCY_OFFSET_SEPARATION) {
     113           0 :         return SidebandProcessingModeMod::FREQUENCY_OFFSET_SEPARATION;
     114             :     }
     115             :         
     116           2 :     if (name == CSidebandProcessingMode::sPHASE_SWITCH_REJECTION) {
     117           0 :         return SidebandProcessingModeMod::PHASE_SWITCH_REJECTION;
     118             :     }
     119             :         
     120           2 :     if (name == CSidebandProcessingMode::sFREQUENCY_OFFSET_REJECTION) {
     121           2 :         return SidebandProcessingModeMod::FREQUENCY_OFFSET_REJECTION;
     122             :     }
     123             :     
     124           0 :     throw badString(name);
     125             : }
     126             : 
     127           0 : SidebandProcessingModeMod::SidebandProcessingMode CSidebandProcessingMode::literal(const std::string& name) {
     128             :                 
     129           0 :     if (name == CSidebandProcessingMode::sNONE) {
     130           0 :         return SidebandProcessingModeMod::NONE;
     131             :     }
     132             :         
     133           0 :     if (name == CSidebandProcessingMode::sPHASE_SWITCH_SEPARATION) {
     134           0 :         return SidebandProcessingModeMod::PHASE_SWITCH_SEPARATION;
     135             :     }
     136             :         
     137           0 :     if (name == CSidebandProcessingMode::sFREQUENCY_OFFSET_SEPARATION) {
     138           0 :         return SidebandProcessingModeMod::FREQUENCY_OFFSET_SEPARATION;
     139             :     }
     140             :         
     141           0 :     if (name == CSidebandProcessingMode::sPHASE_SWITCH_REJECTION) {
     142           0 :         return SidebandProcessingModeMod::PHASE_SWITCH_REJECTION;
     143             :     }
     144             :         
     145           0 :     if (name == CSidebandProcessingMode::sFREQUENCY_OFFSET_REJECTION) {
     146           0 :         return SidebandProcessingModeMod::FREQUENCY_OFFSET_REJECTION;
     147             :     }
     148             :     
     149           0 :     throw badString(name);
     150             : }
     151             : 
     152          83 : SidebandProcessingModeMod::SidebandProcessingMode CSidebandProcessingMode::from_int(unsigned int i) {
     153          83 :         vector<string> names_ = names();
     154          83 :         if (i >= names_.size()) throw badInt(i);
     155         166 :         return newSidebandProcessingMode(names_.at(i));
     156          83 : }
     157             : 
     158           0 : string CSidebandProcessingMode::badString(const string& name) {
     159           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'SidebandProcessingMode'.";
     160             : }
     161             : 
     162           0 : string CSidebandProcessingMode::badInt(unsigned int i) {
     163           0 :         ostringstream oss ;
     164           0 :         oss << "'" << i << "' is out of range for the enumeration 'SidebandProcessingMode'.";
     165           0 :         return oss.str();
     166           0 : }
     167             : 
     168             : namespace SidebandProcessingModeMod {
     169           0 :         std::ostream & operator << ( std::ostream & out, const SidebandProcessingMode& value) {
     170           0 :                 out << CSidebandProcessingMode::name(value);
     171           0 :                 return out;
     172             :         }
     173             : 
     174           0 :         std::istream & operator >> ( std::istream & in , SidebandProcessingMode& value ) {
     175           0 :                 in.clear();
     176           0 :                 string s ; 
     177           0 :                 in >> s;
     178             :                 try {
     179           0 :                 value = CSidebandProcessingMode::literal(s);
     180             :                 }
     181           0 :                 catch (string & m) {
     182           0 :                 in.setstate(ios::failbit);
     183           0 :                 }
     184           0 :                 return in;
     185           0 :         }
     186             : }
     187             : 

Generated by: LCOV version 1.16