LCOV - code coverage report
Current view: top level - alma/Enumerations - CSchedulerMode.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 70 0.0 %
Date: 2024-10-04 18:58:15 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 CSchedulerMode.cpp
      34             :  */
      35             : #include <sstream>
      36             : #include <alma/Enumerations/CSchedulerMode.h>
      37             : #include <string>
      38             : using namespace std;
      39             : 
      40           0 : int CSchedulerMode::version() {
      41           0 :         return SchedulerModeMod::version;
      42             :         }
      43             :         
      44           0 : string CSchedulerMode::revision () {
      45           0 :         return SchedulerModeMod::revision;
      46             : }
      47             : 
      48           0 : unsigned int CSchedulerMode::size() {
      49           0 :         return 4;
      50             :         }
      51             :         
      52             :         
      53             : const std::string& CSchedulerMode::sDYNAMIC = "DYNAMIC";
      54             :         
      55             : const std::string& CSchedulerMode::sINTERACTIVE = "INTERACTIVE";
      56             :         
      57             : const std::string& CSchedulerMode::sMANUAL = "MANUAL";
      58             :         
      59             : const std::string& CSchedulerMode::sQUEUED = "QUEUED";
      60             :         
      61           0 : const std::vector<std::string> CSchedulerMode::names() {
      62           0 :     std::vector<std::string> enumSet;
      63             :     
      64           0 :     enumSet.insert(enumSet.end(), CSchedulerMode::sDYNAMIC);
      65             :     
      66           0 :     enumSet.insert(enumSet.end(), CSchedulerMode::sINTERACTIVE);
      67             :     
      68           0 :     enumSet.insert(enumSet.end(), CSchedulerMode::sMANUAL);
      69             :     
      70           0 :     enumSet.insert(enumSet.end(), CSchedulerMode::sQUEUED);
      71             :         
      72           0 :     return enumSet;
      73           0 : }
      74             : 
      75           0 : std::string CSchedulerMode::name(const SchedulerModeMod::SchedulerMode& f) {
      76           0 :     switch (f) {
      77             :     
      78           0 :     case SchedulerModeMod::DYNAMIC:
      79           0 :       return CSchedulerMode::sDYNAMIC;
      80             :     
      81           0 :     case SchedulerModeMod::INTERACTIVE:
      82           0 :       return CSchedulerMode::sINTERACTIVE;
      83             :     
      84           0 :     case SchedulerModeMod::MANUAL:
      85           0 :       return CSchedulerMode::sMANUAL;
      86             :     
      87           0 :     case SchedulerModeMod::QUEUED:
      88           0 :       return CSchedulerMode::sQUEUED;
      89             :         
      90             :     }
      91             :     // Impossible siutation but....who knows with C++ enums
      92           0 :     throw badInt((int) f);
      93             : }
      94             : 
      95           0 : SchedulerModeMod::SchedulerMode CSchedulerMode::newSchedulerMode(const std::string& name) {
      96             :                 
      97           0 :     if (name == CSchedulerMode::sDYNAMIC) {
      98           0 :         return SchedulerModeMod::DYNAMIC;
      99             :     }
     100             :         
     101           0 :     if (name == CSchedulerMode::sINTERACTIVE) {
     102           0 :         return SchedulerModeMod::INTERACTIVE;
     103             :     }
     104             :         
     105           0 :     if (name == CSchedulerMode::sMANUAL) {
     106           0 :         return SchedulerModeMod::MANUAL;
     107             :     }
     108             :         
     109           0 :     if (name == CSchedulerMode::sQUEUED) {
     110           0 :         return SchedulerModeMod::QUEUED;
     111             :     }
     112             :     
     113           0 :     throw badString(name);
     114             : }
     115             : 
     116           0 : SchedulerModeMod::SchedulerMode CSchedulerMode::literal(const std::string& name) {
     117             :                 
     118           0 :     if (name == CSchedulerMode::sDYNAMIC) {
     119           0 :         return SchedulerModeMod::DYNAMIC;
     120             :     }
     121             :         
     122           0 :     if (name == CSchedulerMode::sINTERACTIVE) {
     123           0 :         return SchedulerModeMod::INTERACTIVE;
     124             :     }
     125             :         
     126           0 :     if (name == CSchedulerMode::sMANUAL) {
     127           0 :         return SchedulerModeMod::MANUAL;
     128             :     }
     129             :         
     130           0 :     if (name == CSchedulerMode::sQUEUED) {
     131           0 :         return SchedulerModeMod::QUEUED;
     132             :     }
     133             :     
     134           0 :     throw badString(name);
     135             : }
     136             : 
     137           0 : SchedulerModeMod::SchedulerMode CSchedulerMode::from_int(unsigned int i) {
     138           0 :         vector<string> names_ = names();
     139           0 :         if (i >= names_.size()) throw badInt(i);
     140           0 :         return newSchedulerMode(names_.at(i));
     141           0 : }
     142             : 
     143           0 : string CSchedulerMode::badString(const string& name) {
     144           0 :         return "'"+name+"' does not correspond to any literal in the enumeration 'SchedulerMode'.";
     145             : }
     146             : 
     147           0 : string CSchedulerMode::badInt(unsigned int i) {
     148           0 :         ostringstream oss ;
     149           0 :         oss << "'" << i << "' is out of range for the enumeration 'SchedulerMode'.";
     150           0 :         return oss.str();
     151           0 : }
     152             : 
     153             : namespace SchedulerModeMod {
     154           0 :         std::ostream & operator << ( std::ostream & out, const SchedulerMode& value) {
     155           0 :                 out << CSchedulerMode::name(value);
     156           0 :                 return out;
     157             :         }
     158             : 
     159           0 :         std::istream & operator >> ( std::istream & in , SchedulerMode& value ) {
     160           0 :                 in.clear();
     161           0 :                 string s ; 
     162           0 :                 in >> s;
     163             :                 try {
     164           0 :                 value = CSchedulerMode::literal(s);
     165             :                 }
     166           0 :                 catch (string & m) {
     167           0 :                 in.setstate(ios::failbit);
     168           0 :                 }
     169           0 :                 return in;
     170           0 :         }
     171             : }
     172             : 

Generated by: LCOV version 1.16