LCOV - code coverage report
Current view: top level - alma/Enumerations - CBasebandName.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 48 154 31.2 %
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 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          83 : const std::vector<std::string> CBasebandName::names() {
      86          83 :     std::vector<std::string> enumSet;
      87             :     
      88          83 :     enumSet.insert(enumSet.end(), CBasebandName::sNOBB);
      89             :     
      90          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_1);
      91             :     
      92          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_2);
      93             :     
      94          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_3);
      95             :     
      96          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_4);
      97             :     
      98          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_5);
      99             :     
     100          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_6);
     101             :     
     102          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_7);
     103             :     
     104          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_8);
     105             :     
     106          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBB_ALL);
     107             :     
     108          83 :     enumSet.insert(enumSet.end(), CBasebandName::sA1C1_3BIT);
     109             :     
     110          83 :     enumSet.insert(enumSet.end(), CBasebandName::sA2C2_3BIT);
     111             :     
     112          83 :     enumSet.insert(enumSet.end(), CBasebandName::sAC_8BIT);
     113             :     
     114          83 :     enumSet.insert(enumSet.end(), CBasebandName::sB1D1_3BIT);
     115             :     
     116          83 :     enumSet.insert(enumSet.end(), CBasebandName::sB2D2_3BIT);
     117             :     
     118          83 :     enumSet.insert(enumSet.end(), CBasebandName::sBD_8BIT);
     119             :         
     120          83 :     return enumSet;
     121           0 : }
     122             : 
     123           0 : std::string CBasebandName::name(const BasebandNameMod::BasebandName& f) {
     124           0 :     switch (f) {
     125             :     
     126           0 :     case BasebandNameMod::NOBB:
     127           0 :       return CBasebandName::sNOBB;
     128             :     
     129           0 :     case BasebandNameMod::BB_1:
     130           0 :       return CBasebandName::sBB_1;
     131             :     
     132           0 :     case BasebandNameMod::BB_2:
     133           0 :       return CBasebandName::sBB_2;
     134             :     
     135           0 :     case BasebandNameMod::BB_3:
     136           0 :       return CBasebandName::sBB_3;
     137             :     
     138           0 :     case BasebandNameMod::BB_4:
     139           0 :       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         166 : BasebandNameMod::BasebandName CBasebandName::newBasebandName(const std::string& name) {
     180             :                 
     181         166 :     if (name == CBasebandName::sNOBB) {
     182         114 :         return BasebandNameMod::NOBB;
     183             :     }
     184             :         
     185          52 :     if (name == CBasebandName::sBB_1) {
     186          14 :         return BasebandNameMod::BB_1;
     187             :     }
     188             :         
     189          38 :     if (name == CBasebandName::sBB_2) {
     190          12 :         return BasebandNameMod::BB_2;
     191             :     }
     192             :         
     193          26 :     if (name == CBasebandName::sBB_3) {
     194          12 :         return BasebandNameMod::BB_3;
     195             :     }
     196             :         
     197          14 :     if (name == CBasebandName::sBB_4) {
     198          12 :         return BasebandNameMod::BB_4;
     199             :     }
     200             :         
     201           2 :     if (name == CBasebandName::sBB_5) {
     202           0 :         return BasebandNameMod::BB_5;
     203             :     }
     204             :         
     205           2 :     if (name == CBasebandName::sBB_6) {
     206           0 :         return BasebandNameMod::BB_6;
     207             :     }
     208             :         
     209           2 :     if (name == CBasebandName::sBB_7) {
     210           0 :         return BasebandNameMod::BB_7;
     211             :     }
     212             :         
     213           2 :     if (name == CBasebandName::sBB_8) {
     214           0 :         return BasebandNameMod::BB_8;
     215             :     }
     216             :         
     217           2 :     if (name == CBasebandName::sBB_ALL) {
     218           0 :         return BasebandNameMod::BB_ALL;
     219             :     }
     220             :         
     221           2 :     if (name == CBasebandName::sA1C1_3BIT) {
     222           0 :         return BasebandNameMod::A1C1_3BIT;
     223             :     }
     224             :         
     225           2 :     if (name == CBasebandName::sA2C2_3BIT) {
     226           0 :         return BasebandNameMod::A2C2_3BIT;
     227             :     }
     228             :         
     229           2 :     if (name == CBasebandName::sAC_8BIT) {
     230           1 :         return BasebandNameMod::AC_8BIT;
     231             :     }
     232             :         
     233           1 :     if (name == CBasebandName::sB1D1_3BIT) {
     234           0 :         return BasebandNameMod::B1D1_3BIT;
     235             :     }
     236             :         
     237           1 :     if (name == CBasebandName::sB2D2_3BIT) {
     238           0 :         return BasebandNameMod::B2D2_3BIT;
     239             :     }
     240             :         
     241           1 :     if (name == CBasebandName::sBD_8BIT) {
     242           1 :         return BasebandNameMod::BD_8BIT;
     243             :     }
     244             :     
     245           0 :     throw badString(name);
     246             : }
     247             : 
     248           0 : BasebandNameMod::BasebandName CBasebandName::literal(const std::string& name) {
     249             :                 
     250           0 :     if (name == CBasebandName::sNOBB) {
     251           0 :         return BasebandNameMod::NOBB;
     252             :     }
     253             :         
     254           0 :     if (name == CBasebandName::sBB_1) {
     255           0 :         return BasebandNameMod::BB_1;
     256             :     }
     257             :         
     258           0 :     if (name == CBasebandName::sBB_2) {
     259           0 :         return BasebandNameMod::BB_2;
     260             :     }
     261             :         
     262           0 :     if (name == CBasebandName::sBB_3) {
     263           0 :         return BasebandNameMod::BB_3;
     264             :     }
     265             :         
     266           0 :     if (name == CBasebandName::sBB_4) {
     267           0 :         return BasebandNameMod::BB_4;
     268             :     }
     269             :         
     270           0 :     if (name == CBasebandName::sBB_5) {
     271           0 :         return BasebandNameMod::BB_5;
     272             :     }
     273             :         
     274           0 :     if (name == CBasebandName::sBB_6) {
     275           0 :         return BasebandNameMod::BB_6;
     276             :     }
     277             :         
     278           0 :     if (name == CBasebandName::sBB_7) {
     279           0 :         return BasebandNameMod::BB_7;
     280             :     }
     281             :         
     282           0 :     if (name == CBasebandName::sBB_8) {
     283           0 :         return BasebandNameMod::BB_8;
     284             :     }
     285             :         
     286           0 :     if (name == CBasebandName::sBB_ALL) {
     287           0 :         return BasebandNameMod::BB_ALL;
     288             :     }
     289             :         
     290           0 :     if (name == CBasebandName::sA1C1_3BIT) {
     291           0 :         return BasebandNameMod::A1C1_3BIT;
     292             :     }
     293             :         
     294           0 :     if (name == CBasebandName::sA2C2_3BIT) {
     295           0 :         return BasebandNameMod::A2C2_3BIT;
     296             :     }
     297             :         
     298           0 :     if (name == CBasebandName::sAC_8BIT) {
     299           0 :         return BasebandNameMod::AC_8BIT;
     300             :     }
     301             :         
     302           0 :     if (name == CBasebandName::sB1D1_3BIT) {
     303           0 :         return BasebandNameMod::B1D1_3BIT;
     304             :     }
     305             :         
     306           0 :     if (name == CBasebandName::sB2D2_3BIT) {
     307           0 :         return BasebandNameMod::B2D2_3BIT;
     308             :     }
     309             :         
     310           0 :     if (name == CBasebandName::sBD_8BIT) {
     311           0 :         return BasebandNameMod::BD_8BIT;
     312             :     }
     313             :     
     314           0 :     throw badString(name);
     315             : }
     316             : 
     317          83 : BasebandNameMod::BasebandName CBasebandName::from_int(unsigned int i) {
     318          83 :         vector<string> names_ = names();
     319          83 :         if (i >= names_.size()) throw badInt(i);
     320         166 :         return newBasebandName(names_.at(i));
     321          83 : }
     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           0 : }
     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           0 :                 }
     349           0 :                 return in;
     350           0 :         }
     351             : }
     352             : 

Generated by: LCOV version 1.16