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 CAssociatedCalNature.cpp 34 : */ 35 : #include <sstream> 36 : #include <alma/Enumerations/CAssociatedCalNature.h> 37 : #include <string> 38 : using namespace std; 39 : 40 0 : int CAssociatedCalNature::version() { 41 0 : return AssociatedCalNatureMod::version; 42 : } 43 : 44 0 : string CAssociatedCalNature::revision () { 45 0 : return AssociatedCalNatureMod::revision; 46 : } 47 : 48 0 : unsigned int CAssociatedCalNature::size() { 49 0 : return 1; 50 : } 51 : 52 : 53 : const std::string& CAssociatedCalNature::sASSOCIATED_EXECBLOCK = "ASSOCIATED_EXECBLOCK"; 54 : 55 94 : const std::vector<std::string> CAssociatedCalNature::names() { 56 94 : std::vector<std::string> enumSet; 57 : 58 94 : enumSet.insert(enumSet.end(), CAssociatedCalNature::sASSOCIATED_EXECBLOCK); 59 : 60 94 : return enumSet; 61 0 : } 62 : 63 94 : std::string CAssociatedCalNature::name(const AssociatedCalNatureMod::AssociatedCalNature& f) { 64 94 : switch (f) { 65 : 66 94 : case AssociatedCalNatureMod::ASSOCIATED_EXECBLOCK: 67 94 : return CAssociatedCalNature::sASSOCIATED_EXECBLOCK; 68 : 69 : } 70 : // Impossible siutation but....who knows with C++ enums 71 0 : throw badInt((int) f); 72 : } 73 : 74 141 : AssociatedCalNatureMod::AssociatedCalNature CAssociatedCalNature::newAssociatedCalNature(const std::string& name) { 75 : 76 141 : if (name == CAssociatedCalNature::sASSOCIATED_EXECBLOCK) { 77 141 : return AssociatedCalNatureMod::ASSOCIATED_EXECBLOCK; 78 : } 79 : 80 0 : throw badString(name); 81 : } 82 : 83 47 : AssociatedCalNatureMod::AssociatedCalNature CAssociatedCalNature::literal(const std::string& name) { 84 : 85 47 : if (name == CAssociatedCalNature::sASSOCIATED_EXECBLOCK) { 86 47 : return AssociatedCalNatureMod::ASSOCIATED_EXECBLOCK; 87 : } 88 : 89 0 : throw badString(name); 90 : } 91 : 92 94 : AssociatedCalNatureMod::AssociatedCalNature CAssociatedCalNature::from_int(unsigned int i) { 93 94 : vector<string> names_ = names(); 94 94 : if (i >= names_.size()) throw badInt(i); 95 188 : return newAssociatedCalNature(names_.at(i)); 96 94 : } 97 : 98 0 : string CAssociatedCalNature::badString(const string& name) { 99 0 : return "'"+name+"' does not correspond to any literal in the enumeration 'AssociatedCalNature'."; 100 : } 101 : 102 0 : string CAssociatedCalNature::badInt(unsigned int i) { 103 0 : ostringstream oss ; 104 0 : oss << "'" << i << "' is out of range for the enumeration 'AssociatedCalNature'."; 105 0 : return oss.str(); 106 0 : } 107 : 108 : namespace AssociatedCalNatureMod { 109 0 : std::ostream & operator << ( std::ostream & out, const AssociatedCalNature& value) { 110 0 : out << CAssociatedCalNature::name(value); 111 0 : return out; 112 : } 113 : 114 0 : std::istream & operator >> ( std::istream & in , AssociatedCalNature& value ) { 115 0 : in.clear(); 116 0 : string s ; 117 0 : in >> s; 118 : try { 119 0 : value = CAssociatedCalNature::literal(s); 120 : } 121 0 : catch (string & m) { 122 0 : in.setstate(ios::failbit); 123 0 : } 124 0 : return in; 125 0 : } 126 : } 127 :