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

Generated by: LCOV version 1.16