GiNaCRA  0.6.4
Constraint.h
Go to the documentation of this file.
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 #ifndef GINACRA_CONSTRAINT_H
00024 #define GINACRA_CONSTRAINT_H
00025 
00026 #include "constants.h"
00027 #include "Polynomial.h"
00028 #include "RealAlgebraicPoint.h"
00029 
00030 using std::invalid_argument;
00031 using GiNaC::symbol;
00032 
00033 namespace GiNaCRA
00034 {
00043     class Constraint
00044     {
00045         public:
00046 
00048             // Con- and destructors //
00050 
00054             Constraint():
00055                 mPoly(),
00056                 mSign(),
00057                 mVariables(),
00058                 mNegated( false )
00059             {}
00060 
00068             Constraint( const Polynomial& p, const GiNaC::sign s, const vector<symbol> v, bool negated = false ):
00069                 mPoly( p ),
00070                 mSign( s ),
00071                 mVariables( checkVariables( p, v )),
00072                 mNegated( negated )
00073             {}
00074 
00076             // Selectors //
00078 
00082             const Polynomial poly() const
00083             {
00084                 return mPoly;
00085             }
00086 
00090             const GiNaC::sign sign() const
00091             {
00092                 return mSign;
00093             }
00094 
00098             const vector<symbol> variables() const
00099             {
00100                 return mVariables;
00101             }
00102 
00104             // Operations //
00106 
00113             bool satisfiedBy( const RealAlgebraicPoint& r ) const;
00114 
00115         private:
00116 
00118             // Attributes //
00120 
00121             Polynomial     mPoly;
00122             GiNaC::sign    mSign;
00123             vector<symbol> mVariables;
00124             bool           mNegated;
00125 
00127             // Auxiliary methods //
00129 
00137             const vector<symbol> checkVariables( const Polynomial& p, const vector<symbol>& v ) const throw ( invalid_argument );
00138 
00139     };    // class Constraint
00140 
00141 }    // namespace GiNaCRA
00142 
00143 #endif