LCOV - code coverage report
Current view: top level - alma/Enumerations - CBasebandName.cc (source / functions) Hit Total Coverage
Test: casa_coverage.info Lines: 90 149 60.4 %
Date: 2023-10-25 08:47:59 Functions: 5 12 41.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 CBasebandName.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CBasebandName.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CBasebandName::version() {
      41           0 :         return BasebandNameMod::version;
      42             :         }
      43             :         
      44           0 : string CBasebandName::revision () {
      45           0 :         return BasebandNameMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CBasebandName::size() {
      49           0 :         return 16;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CBasebandName::sNOBB = "NOBB";
      54             :         
      55             : const std::string& CBasebandName::sBB_1 = "BB_1";
      56             :         
      57             : const std::string& CBasebandName::sBB_2 = "BB_2";
      58             :         
      59             : const std::string& CBasebandName::sBB_3 = "BB_3";
      60             :         
      61             : const std::string& CBasebandName::sBB_4 = "BB_4";
      62             :         
      63             : const std::string& CBasebandName::sBB_5 = "BB_5";
      64             :         
      65             : const std::string& CBasebandName::sBB_6 = "BB_6";
      66             :         
      67             : const std::string& CBasebandName::sBB_7 = "BB_7";
      68             :         
      69             : const std::string& CBasebandName::sBB_8 = "BB_8";
      70             :         
      71             : const std::string& CBasebandName::sBB_ALL = "BB_ALL";
      72             :         
      73             : const std::string& CBasebandName::sA1C1_3BIT = "A1C1_3BIT";
      74             :         
      75             : const std::string& CBasebandName::sA2C2_3BIT = "A2C2_3BIT";
      76             :         
      77             : const std::string& CBasebandName::sAC_8BIT = "AC_8BIT";
      78             :         
      79             : const std::string& CBasebandName::sB1D1_3BIT = "B1D1_3BIT";
      80             :         
      81             : const std::string& CBasebandName::sB2D2_3BIT = "B2D2_3BIT";
      82             :         
      83             : const std::string& CBasebandName::sBD_8BIT = "BD_8BIT";
      84             :         
      85        2075 : const std::vector<std::string> CBasebandName::names() {
      86        2075 :     std::vector<std::string> enumSet;
      87             :     
      88        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sNOBB);
      89             :     
      90        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_1);
      91             :     
      92        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_2);
      93             :     
      94        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_3);
      95             :     
      96        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_4);
      97             :     
      98        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_5);
      99             :     
     100        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_6);
     101             :     
     102        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_7);
     103             :     
     104        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_8);
     105             :     
     106        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_ALL);
     107             :     
     108        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sA1C1_3BIT);
     109             :     
     110        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sA2C2_3BIT);
     111             :     
     112        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sAC_8BIT);
     113             :     
     114        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sB1D1_3BIT);
     115             :     
     116        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sB2D2_3BIT);
     117             :     
     118        2075 :     enumSet.insert(enumSet.end(), CBasebandName::sBD_8BIT);
     119             :         
     120        2075 :     return enumSet;
     121             : }
     122             : 
     123        1168 : std::string CBasebandName::name(const BasebandNameMod::BasebandName& f) {
     124        1168 :     switch (f) {
     125             :     
     126        1096 :     case BasebandNameMod::NOBB:
     127        1096 :       return CBasebandName::sNOBB;
     128             :     
     129          18 :     case BasebandNameMod::BB_1:
     130          18 :       return CBasebandName::sBB_1;
     131             :     
     132          18 :     case BasebandNameMod::BB_2:
     133          18 :       return CBasebandName::sBB_2;
     134             :     
     135          18 :     case BasebandNameMod::BB_3:
     136          18 :       return CBasebandName::sBB_3;
     137             :     
     138          18 :     case BasebandNameMod::BB_4:
     139          18 :       return CBasebandName::sBB_4;
     140             :     
     141           0 :     case BasebandNameMod::BB_5:
     142           0 :       return CBasebandName::sBB_5;
     143             :     
     144           0 :     case BasebandNameMod::BB_6:
     145           0 :       return CBasebandName::sBB_6;
     146             :     
     147           0 :     case BasebandNameMod::BB_7:
     148           0 :       return CBasebandName::sBB_7;
     149             :     
     150           0 :     case BasebandNameMod::BB_8:
     151           0 :       return CBasebandName::sBB_8;
     152             :     
     153           0 :     case BasebandNameMod::BB_ALL:
     154           0 :       return CBasebandName::sBB_ALL;
     155             :     
     156           0 :     case BasebandNameMod::A1C1_3BIT:
     157           0 :       return CBasebandName::sA1C1_3BIT;
     158             :     
     159           0 :     case BasebandNameMod::A2C2_3BIT:
     160           0 :       return CBasebandName::sA2C2_3BIT;
     161             :     
     162           0 :     case BasebandNameMod::AC_8BIT:
     163           0 :       return CBasebandName::sAC_8BIT;
     164             :     
     165           0 :     case BasebandNameMod::B1D1_3BIT:
     166           0 :       return CBasebandName::sB1D1_3BIT;
     167             :     
     168           0 :     case BasebandNameMod::B2D2_3BIT:
     169           0 :       return CBasebandName::sB2D2_3BIT;
     170             :     
     171           0 :     case BasebandNameMod::BD_8BIT:
     172           0 :       return CBasebandName::sBD_8BIT;
     173             :         
     174             :     }
     175             :     // Impossible siutation but....who knows with C++ enums
     176           0 :     throw badInt((int) f);
     177             : }
     178             : 
     179        4364 : BasebandNameMod::BasebandName CBasebandName::newBasebandName(const std::string& name) {
     180             :                 
     181        4364 :     if (name == CBasebandName::sNOBB) {
     182        2994 :         return BasebandNameMod::NOBB;
     183             :     }
     184             :         
     185        1370 :     if (name == CBasebandName::sBB_1) {
     186         302 :         return BasebandNameMod::BB_1;
     187             :     }
     188             :         
     189        1068 :     if (name == CBasebandName::sBB_2) {
     190         264 :         return BasebandNameMod::BB_2;
     191             :     }
     192             :         
     193         804 :     if (name == CBasebandName::sBB_3) {
     194         280 :         return BasebandNameMod::BB_3;
     195             :     }
     196             :         
     197         524 :     if (name == CBasebandName::sBB_4) {
     198         301 :         return BasebandNameMod::BB_4;
     199             :     }
     200             :         
     201         223 :     if (name == CBasebandName::sBB_5) {
     202           0 :         return BasebandNameMod::BB_5;
     203             :     }
     204             :         
     205         223 :     if (name == CBasebandName::sBB_6) {
     206           0 :         return BasebandNameMod::BB_6;
     207             :     }
     208             :         
     209         223 :     if (name == CBasebandName::sBB_7) {
     210           0 :         return BasebandNameMod::BB_7;
     211             :     }
     212             :         
     213         223 :     if (name == CBasebandName::sBB_8) {
     214          21 :         return BasebandNameMod::BB_8;
     215             :     }
     216             :         
     217         202 :     if (name == CBasebandName::sBB_ALL) {
     218           0 :         return BasebandNameMod::BB_ALL;
     219             :     }
     220             :         
     221         202 :     if (name == CBasebandName::sA1C1_3BIT) {
     222          16 :         return BasebandNameMod::A1C1_3BIT;
     223             :     }
     224             :         
     225         186 :     if (name == CBasebandName::sA2C2_3BIT) {
     226          16 :         return BasebandNameMod::A2C2_3BIT;
     227             :     }
     228             :         
     229         170 :     if (name == CBasebandName::sAC_8BIT) {
     230          77 :         return BasebandNameMod::AC_8BIT;
     231             :     }
     232             :         
     233          93 :     if (name == CBasebandName::sB1D1_3BIT) {
     234           0 :         return BasebandNameMod::B1D1_3BIT;
     235             :     }
     236             :         
     237          93 :     if (name == CBasebandName::sB2D2_3BIT) {
     238          16 :         return BasebandNameMod::B2D2_3BIT;
     239             :     }
     240             :         
     241          77 :     if (name == CBasebandName::sBD_8BIT) {
     242          77 :         return BasebandNameMod::BD_8BIT;
     243             :     }
     244             :     
     245           0 :     throw badString(name);
     246             : }
     247             : 
     248        8455 : BasebandNameMod::BasebandName CBasebandName::literal(const std::string& name) {
     249             :                 
     250        8455 :     if (name == CBasebandName::sNOBB) {
     251         919 :         return BasebandNameMod::NOBB;
     252             :     }
     253             :         
     254        7536 :     if (name == CBasebandName::sBB_1) {
     255        1903 :         return BasebandNameMod::BB_1;
     256             :     }
     257             :         
     258        5633 :     if (name == CBasebandName::sBB_2) {
     259        1838 :         return BasebandNameMod::BB_2;
     260             :     }
     261             :         
     262        3795 :     if (name == CBasebandName::sBB_3) {
     263        1838 :         return BasebandNameMod::BB_3;
     264             :     }
     265             :         
     266        1957 :     if (name == CBasebandName::sBB_4) {
     267        1838 :         return BasebandNameMod::BB_4;
     268             :     }
     269             :         
     270         119 :     if (name == CBasebandName::sBB_5) {
     271           0 :         return BasebandNameMod::BB_5;
     272             :     }
     273             :         
     274         119 :     if (name == CBasebandName::sBB_6) {
     275           0 :         return BasebandNameMod::BB_6;
     276             :     }
     277             :         
     278         119 :     if (name == CBasebandName::sBB_7) {
     279           0 :         return BasebandNameMod::BB_7;
     280             :     }
     281             :         
     282         119 :     if (name == CBasebandName::sBB_8) {
     283           0 :         return BasebandNameMod::BB_8;
     284             :     }
     285             :         
     286         119 :     if (name == CBasebandName::sBB_ALL) {
     287           0 :         return BasebandNameMod::BB_ALL;
     288             :     }
     289             :         
     290         119 :     if (name == CBasebandName::sA1C1_3BIT) {
     291           1 :         return BasebandNameMod::A1C1_3BIT;
     292             :     }
     293             :         
     294         118 :     if (name == CBasebandName::sA2C2_3BIT) {
     295           1 :         return BasebandNameMod::A2C2_3BIT;
     296             :     }
     297             :         
     298         117 :     if (name == CBasebandName::sAC_8BIT) {
     299          58 :         return BasebandNameMod::AC_8BIT;
     300             :     }
     301             :         
     302          59 :     if (name == CBasebandName::sB1D1_3BIT) {
     303           0 :         return BasebandNameMod::B1D1_3BIT;
     304             :     }
     305             :         
     306          59 :     if (name == CBasebandName::sB2D2_3BIT) {
     307           1 :         return BasebandNameMod::B2D2_3BIT;
     308             :     }
     309             :         
     310          58 :     if (name == CBasebandName::sBD_8BIT) {
     311          58 :         return BasebandNameMod::BD_8BIT;
     312             :     }
     313             :     
     314           0 :     throw badString(name);
     315             : }
     316             : 
     317        2075 : BasebandNameMod::BasebandName CBasebandName::from_int(unsigned int i) {
     318        4150 :         vector<string> names_ = names();
     319        2075 :         if (i >= names_.size()) throw badInt(i);
     320        4150 :         return newBasebandName(names_.at(i));
     321             : }
     322             : 
     323           0 : string CBasebandName::badString(const string& name) {
     324           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'BasebandName'.";
     325             : }
     326             : 
     327           0 : string CBasebandName::badInt(unsigned int i) {
     328           0 :         ostringstream oss ;
     329           0 :         oss << "'" << i << "' is out of range for the enumeration 'BasebandName'.";
     330           0 :         return oss.str();
     331             : }
     332             : 
     333             : namespace BasebandNameMod {
     334           0 :         std::ostream & operator << ( std::ostream & out, const BasebandName& value) {
     335           0 :                 out << CBasebandName::name(value);
     336           0 :                 return out;
     337             :         }
     338             : 
     339           0 :         std::istream & operator >> ( std::istream & in , BasebandName& value ) {
     340           0 :                 in.clear();
     341           0 :                 string s ; 
     342           0 :                 in >> s;
     343             :                 try {
     344           0 :                 value = CBasebandName::literal(s);
     345             :                 }
     346           0 :                 catch (string & m) {
     347           0 :                 in.setstate(ios::failbit);
     348             :                 }
     349           0 :                 return in;
     350             :         }
     351             : }
     352             : 

Generated by: LCOV version 1.16