1 /*! 2 * \file mfront/src/AsterException.cxx 3 * \brief 4 * 5 * \author Thomas Helfer 6 * \date 09 nov 2007 7 * \copyright Copyright (C) 2006-2018 CEA/DEN, EDF R&D. All rights 8 * reserved. 9 * This project is publicly released under either the GNU GPL Licence 10 * or the CECILL-A licence. A copy of thoses licences are delivered 11 * with the sources of TFEL. CEA or EDF may also distribute this 12 * project under specific licensing conditions. 13 */ 14 15 #include"MFront/Aster/AsterException.hxx" 16 17 // fixing a bug on current glibc++ cygwin versions (19/08/2015) 18 #if defined __CYGWIN__ && (!defined _GLIBCXX_USE_C99) 19 #include<sstream> 20 namespace std{ 21 template<typename T> to_string(const T & v)22 std::string to_string(const T& v){ 23 std::ostringstream s; 24 s << v; 25 return s.str(); 26 } 27 } 28 #endif /* defined __CYGWIN__ && (!defined _GLIBCXX_USE_C99) */ 29 30 namespace aster 31 { 32 AsterException(const std::string & s)33 AsterException::AsterException(const std::string& s) 34 : msg(s) 35 {} // end of AsterException::AsterException 36 AsterException(const AsterException & e)37 AsterException::AsterException(const AsterException& e) 38 : msg(e.msg) 39 {} // end of AsterException::AsterException 40 41 const char* what() const42 AsterException::what () const noexcept 43 { 44 return msg.c_str(); 45 } // end of AsterException::what 46 47 std::string getMsg() const48 AsterException::getMsg() const noexcept 49 { 50 return msg; 51 } // end of AsterException::getMsg 52 53 AsterException::~AsterException() noexcept = default; 54 AsterInvalidNTENSValue(const unsigned short N)55 AsterInvalidNTENSValue::AsterInvalidNTENSValue(const unsigned short N) 56 : AsterException("Invalid tensor size declared '"+ 57 std::to_string(static_cast<unsigned int>(N))+"'") 58 {} // end of AsterInvalidNTENSValue::AsterInvalidNTENSValue 59 AsterInvalidNTENSValue(const AsterInvalidNTENSValue & e)60 AsterInvalidNTENSValue::AsterInvalidNTENSValue(const AsterInvalidNTENSValue& e) 61 : AsterException(e) 62 {} // end of AsterInvalidNTENSValue::AsterInvalidNTENSValue 63 64 AsterInvalidNTENSValue::~AsterInvalidNTENSValue() noexcept = default; 65 AsterInvalidDimension(const std::string & b,const unsigned short N)66 AsterInvalidDimension::AsterInvalidDimension(const std::string& b, 67 const unsigned short N) 68 : AsterException("''"+b+"' can't be used in "+ 69 std::to_string(static_cast<unsigned int>(N))+"D") 70 {} // end of AsterInvalidDimension::AsterInvalidDimension 71 72 AsterInvalidDimension::AsterInvalidDimension(const AsterInvalidDimension&) = default; 73 AsterInvalidDimension::~AsterInvalidDimension() noexcept = default; 74 AsterInvalidModellingHypothesis()75 AsterInvalidModellingHypothesis::AsterInvalidModellingHypothesis() 76 : AsterException("unsupported modelling hypothesis") 77 {} 78 79 AsterInvalidModellingHypothesis::AsterInvalidModellingHypothesis(const AsterInvalidModellingHypothesis&) = default; 80 81 AsterInvalidModellingHypothesis::~AsterInvalidModellingHypothesis() noexcept = default; 82 83 } // end of namespace aster 84 85