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

Generated by: LCOV version 1.16