GiNaCRA
0.6.4
|
00001 /* 00002 * GiNaCRA - GiNaC Real Algebra package 00003 * Copyright (C) 2010-2012 Ulrich Loup, Joachim Redies, Sebastian Junges 00004 * 00005 * This file is part of GiNaCRA. 00006 * 00007 * GiNaCRA is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * GiNaCRA is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GiNaCRA. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 */ 00021 00022 00023 #include "Polynomial.h" 00024 00025 using GiNaC::is_exactly_a; 00026 using GiNaC::ex; 00027 using GiNaC::add; 00028 using GiNaC::mul; 00029 using GiNaC::power; 00030 using GiNaC::symbol; 00031 using GiNaC::numeric; 00032 00043 namespace GiNaCRA 00044 { 00046 // Con- and destructors // 00048 00049 Polynomial::Polynomial( const ex& p ) throw ( std::invalid_argument ): 00050 ex( p ) 00051 { 00052 if( !(is_exactly_a<add>( *this ) || is_exactly_a<mul>( *this ) || is_exactly_a<power>( *this ) || is_exactly_a<symbol>( *this ) 00053 || is_exactly_a<numeric>( *this ) || this->info( GiNaC::info_flags::numeric ))) 00054 throw std::invalid_argument( "Specified expression is no polynomial." ); 00055 } 00056 00057 } // namespace GiNaC 00058