Page principale | Liste des namespaces | Hiérarchie des classes | Liste alphabétique | Liste des classes | Liste des fichiers | Membres de namespace | Membres de classe | Membres de fichier

ConstraintBuilder.h

Aller à la documentation de ce fichier.
00001 /*
00002     Copyright (c) 2005, Quentin Lequy and Romain Gaucher
00003     All rights reserved.
00004 
00005     Redistribution and use in source and binary forms, with or 
00006     without modification, are permitted provided that the following 
00007     conditions are met:
00008 
00009         * Redistributions of source code must retain the above copyright 
00010           notice, this list of conditions and the following disclaimer.
00011 
00012         * Redistributions in binary form must reproduce the above copyright 
00013           notice, this list of conditions and the following disclaimer in the 
00014           documentation and/or other materials provided with the distribution.
00015 
00016         * Neither the name of Quentin Lequy or Romain Gaucher nor the names 
00017           of its contributors may be used to endorse or promote products 
00018           derived from this software without specific prior written permission.
00019 
00020     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
00021     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
00022     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
00023     ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
00024     LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
00025     DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00026     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
00027     AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
00028     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
00029     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00030 */
00031 
00032 #ifndef __CONSTRAINTBUILDER_H
00033 #define __CONSTRAINTBUILDER_H
00034 
00035 #include "Expr.h"
00036 #include <list>
00037 
00038 namespace Modelib {
00039 
00040 class ostream;
00041 
00042 
00044 
00056 class ConstraintBuilder
00057 {
00058   public:
00060     enum Operateur {EGAL=0,DIFFERENT,INFERIEUR,SUPERIEUR,INFSTRICT,SUPSTRICT};
00061 
00062   protected:
00063     std::list<Expr> expressions;       
00064     std::list<Operateur> operateurs;   
00065     bool isBound;                      
00066     
00067     bool CheckIfIsBound();
00068     void Add(Operateur,const std::list<Expr> &,const std::list<Operateur> &);
00069    
00070     friend class Model;
00071     friend std::ostream & operator<< (std::ostream & flux, const ConstraintBuilder & c);
00072 
00073   public:
00075     ConstraintBuilder(): isBound(false) {}
00076     ConstraintBuilder( const Expr & , ConstraintBuilder::Operateur , const Expr &);
00078     ConstraintBuilder(const ConstraintBuilder & c) { *this = c; }
00080     ConstraintBuilder & operator= ( const ConstraintBuilder & _c)
00081     {
00082         if( this != &_c )   //permet d'economiser la recopie de liste
00083         {
00084           isBound = _c.isBound;
00085           expressions = _c.expressions;
00086           operateurs = _c.operateurs;
00087         }
00088         return *this;
00089     }
00091     inline bool IsBound() const { return isBound;}
00092   
00093     //operateurs permettant d'enchainer les contraintes
00094     ConstraintBuilder & operator== ( const ConstraintBuilder & );
00095     ConstraintBuilder & operator!= ( const ConstraintBuilder & );
00096     ConstraintBuilder & operator<= ( const ConstraintBuilder & );
00097     ConstraintBuilder & operator>= ( const ConstraintBuilder & );
00098     ConstraintBuilder & operator< ( const ConstraintBuilder & );
00099     ConstraintBuilder & operator> ( const ConstraintBuilder & );
00100   
00101     //operateur permettant de terminer un enchainement
00102     ConstraintBuilder & operator== ( const Expr & );
00103     ConstraintBuilder & operator!= ( const Expr & );
00104     ConstraintBuilder & operator<= ( const Expr & );
00105     ConstraintBuilder & operator>= ( const Expr & );
00106     ConstraintBuilder & operator< ( const Expr & );
00107     ConstraintBuilder & operator> ( const Expr & );
00108 
00109     ~ConstraintBuilder() {}
00110 };
00111 
00112 //operateurs permettant de créer une expression a partir de deux expressions
00113 ConstraintBuilder operator== ( const Expr &, const Expr & );
00114 ConstraintBuilder operator!= ( const Expr &, const Expr & );
00115 ConstraintBuilder operator<= ( const Expr &, const Expr & );
00116 ConstraintBuilder operator>= ( const Expr &, const Expr & );
00117 ConstraintBuilder operator< ( const Expr &, const Expr & );
00118 ConstraintBuilder operator> ( const Expr &, const Expr & );
00119 
00120 std::ostream & operator<< (std::ostream & flux,const ConstraintBuilder & c);
00121 
00122 }
00123 
00124 #endif

Généré le Sun Oct 2 19:13:11 2005 pour Modelib par  doxygen 1.4.4