LCOV - code coverage report
Current view: top level - alma/Enumerations - CCalDataOrigin.cc (source / functions) Hit Total Coverage
Test: ctest_coverage.info Lines: 20 100 20.0 %
Date: 2023-11-06 10:06:49 Functions: 2 12 16.7 %

          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 CCalDataOrigin.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CCalDataOrigin.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CCalDataOrigin::version() {
      41           0 :         return CalDataOriginMod::version;
      42             :         }
      43             :         
      44           0 : string CCalDataOrigin::revision () {
      45           0 :         return CalDataOriginMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CCalDataOrigin::size() {
      49           0 :         return 9;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CCalDataOrigin::sTOTAL_POWER = "TOTAL_POWER";
      54             :         
      55             : const std::string& CCalDataOrigin::sWVR = "WVR";
      56             :         
      57             : const std::string& CCalDataOrigin::sCHANNEL_AVERAGE_AUTO = "CHANNEL_AVERAGE_AUTO";
      58             :         
      59             : const std::string& CCalDataOrigin::sCHANNEL_AVERAGE_CROSS = "CHANNEL_AVERAGE_CROSS";
      60             :         
      61             : const std::string& CCalDataOrigin::sFULL_RESOLUTION_AUTO = "FULL_RESOLUTION_AUTO";
      62             :         
      63             : const std::string& CCalDataOrigin::sFULL_RESOLUTION_CROSS = "FULL_RESOLUTION_CROSS";
      64             :         
      65             : const std::string& CCalDataOrigin::sOPTICAL_POINTING = "OPTICAL_POINTING";
      66             :         
      67             : const std::string& CCalDataOrigin::sHOLOGRAPHY = "HOLOGRAPHY";
      68             :         
      69             : const std::string& CCalDataOrigin::sNONE = "NONE";
      70             :         
      71           0 : const std::vector<std::string> CCalDataOrigin::names() {
      72           0 :     std::vector<std::string> enumSet;
      73             :     
      74           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sTOTAL_POWER);
      75             :     
      76           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sWVR);
      77             :     
      78           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sCHANNEL_AVERAGE_AUTO);
      79             :     
      80           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sCHANNEL_AVERAGE_CROSS);
      81             :     
      82           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sFULL_RESOLUTION_AUTO);
      83             :     
      84           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sFULL_RESOLUTION_CROSS);
      85             :     
      86           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sOPTICAL_POINTING);
      87             :     
      88           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sHOLOGRAPHY);
      89             :     
      90           0 :     enumSet.insert(enumSet.end(), CCalDataOrigin::sNONE);
      91             :         
      92           0 :     return enumSet;
      93             : }
      94             : 
      95         334 : std::string CCalDataOrigin::name(const CalDataOriginMod::CalDataOrigin& f) {
      96         334 :     switch (f) {
      97             :     
      98           0 :     case CalDataOriginMod::TOTAL_POWER:
      99           0 :       return CCalDataOrigin::sTOTAL_POWER;
     100             :     
     101           0 :     case CalDataOriginMod::WVR:
     102           0 :       return CCalDataOrigin::sWVR;
     103             :     
     104           0 :     case CalDataOriginMod::CHANNEL_AVERAGE_AUTO:
     105           0 :       return CCalDataOrigin::sCHANNEL_AVERAGE_AUTO;
     106             :     
     107           0 :     case CalDataOriginMod::CHANNEL_AVERAGE_CROSS:
     108           0 :       return CCalDataOrigin::sCHANNEL_AVERAGE_CROSS;
     109             :     
     110           0 :     case CalDataOriginMod::FULL_RESOLUTION_AUTO:
     111           0 :       return CCalDataOrigin::sFULL_RESOLUTION_AUTO;
     112             :     
     113         334 :     case CalDataOriginMod::FULL_RESOLUTION_CROSS:
     114         334 :       return CCalDataOrigin::sFULL_RESOLUTION_CROSS;
     115             :     
     116           0 :     case CalDataOriginMod::OPTICAL_POINTING:
     117           0 :       return CCalDataOrigin::sOPTICAL_POINTING;
     118             :     
     119           0 :     case CalDataOriginMod::HOLOGRAPHY:
     120           0 :       return CCalDataOrigin::sHOLOGRAPHY;
     121             :     
     122           0 :     case CalDataOriginMod::NONE:
     123           0 :       return CCalDataOrigin::sNONE;
     124             :         
     125             :     }
     126             :     // Impossible siutation but....who knows with C++ enums
     127           0 :     throw badInt((int) f);
     128             : }
     129             : 
     130        2741 : CalDataOriginMod::CalDataOrigin CCalDataOrigin::newCalDataOrigin(const std::string& name) {
     131             :                 
     132        2741 :     if (name == CCalDataOrigin::sTOTAL_POWER) {
     133          96 :         return CalDataOriginMod::TOTAL_POWER;
     134             :     }
     135             :         
     136        2645 :     if (name == CCalDataOrigin::sWVR) {
     137        1063 :         return CalDataOriginMod::WVR;
     138             :     }
     139             :         
     140        1582 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_AUTO) {
     141           0 :         return CalDataOriginMod::CHANNEL_AVERAGE_AUTO;
     142             :     }
     143             :         
     144        1582 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_CROSS) {
     145         338 :         return CalDataOriginMod::CHANNEL_AVERAGE_CROSS;
     146             :     }
     147             :         
     148        1244 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_AUTO) {
     149         185 :         return CalDataOriginMod::FULL_RESOLUTION_AUTO;
     150             :     }
     151             :         
     152        1059 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_CROSS) {
     153         144 :         return CalDataOriginMod::FULL_RESOLUTION_CROSS;
     154             :     }
     155             :         
     156         915 :     if (name == CCalDataOrigin::sOPTICAL_POINTING) {
     157           0 :         return CalDataOriginMod::OPTICAL_POINTING;
     158             :     }
     159             :         
     160         915 :     if (name == CCalDataOrigin::sHOLOGRAPHY) {
     161           0 :         return CalDataOriginMod::HOLOGRAPHY;
     162             :     }
     163             :         
     164         915 :     if (name == CCalDataOrigin::sNONE) {
     165         915 :         return CalDataOriginMod::NONE;
     166             :     }
     167             :     
     168           0 :     throw badString(name);
     169             : }
     170             : 
     171           0 : CalDataOriginMod::CalDataOrigin CCalDataOrigin::literal(const std::string& name) {
     172             :                 
     173           0 :     if (name == CCalDataOrigin::sTOTAL_POWER) {
     174           0 :         return CalDataOriginMod::TOTAL_POWER;
     175             :     }
     176             :         
     177           0 :     if (name == CCalDataOrigin::sWVR) {
     178           0 :         return CalDataOriginMod::WVR;
     179             :     }
     180             :         
     181           0 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_AUTO) {
     182           0 :         return CalDataOriginMod::CHANNEL_AVERAGE_AUTO;
     183             :     }
     184             :         
     185           0 :     if (name == CCalDataOrigin::sCHANNEL_AVERAGE_CROSS) {
     186           0 :         return CalDataOriginMod::CHANNEL_AVERAGE_CROSS;
     187             :     }
     188             :         
     189           0 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_AUTO) {
     190           0 :         return CalDataOriginMod::FULL_RESOLUTION_AUTO;
     191             :     }
     192             :         
     193           0 :     if (name == CCalDataOrigin::sFULL_RESOLUTION_CROSS) {
     194           0 :         return CalDataOriginMod::FULL_RESOLUTION_CROSS;
     195             :     }
     196             :         
     197           0 :     if (name == CCalDataOrigin::sOPTICAL_POINTING) {
     198           0 :         return CalDataOriginMod::OPTICAL_POINTING;
     199             :     }
     200             :         
     201           0 :     if (name == CCalDataOrigin::sHOLOGRAPHY) {
     202           0 :         return CalDataOriginMod::HOLOGRAPHY;
     203             :     }
     204             :         
     205           0 :     if (name == CCalDataOrigin::sNONE) {
     206           0 :         return CalDataOriginMod::NONE;
     207             :     }
     208             :     
     209           0 :     throw badString(name);
     210             : }
     211             : 
     212           0 : CalDataOriginMod::CalDataOrigin CCalDataOrigin::from_int(unsigned int i) {
     213           0 :         vector<string> names_ = names();
     214           0 :         if (i >= names_.size()) throw badInt(i);
     215           0 :         return newCalDataOrigin(names_.at(i));
     216             : }
     217             : 
     218           0 : string CCalDataOrigin::badString(const string& name) {
     219           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'CalDataOrigin'.";
     220             : }
     221             : 
     222           0 : string CCalDataOrigin::badInt(unsigned int i) {
     223           0 :         ostringstream oss ;
     224           0 :         oss << "'" << i << "' is out of range for the enumeration 'CalDataOrigin'.";
     225           0 :         return oss.str();
     226             : }
     227             : 
     228             : namespace CalDataOriginMod {
     229           0 :         std::ostream & operator << ( std::ostream & out, const CalDataOrigin& value) {
     230           0 :                 out << CCalDataOrigin::name(value);
     231           0 :                 return out;
     232             :         }
     233             : 
     234           0 :         std::istream & operator >> ( std::istream & in , CalDataOrigin& value ) {
     235           0 :                 in.clear();
     236           0 :                 string s ; 
     237           0 :                 in >> s;
     238             :                 try {
     239           0 :                 value = CCalDataOrigin::literal(s);
     240             :                 }
     241           0 :                 catch (string & m) {
     242           0 :                 in.setstate(ios::failbit);
     243             :                 }
     244           0 :                 return in;
     245             :         }
     246             : }
     247             : 

Generated by: LCOV version 1.16