Modelib: Fichier source de ExprNode.h

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

# ExprNode.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 __EXPRNODE_H_
    00033 #define __EXPRNODE_H_
    00034
    00035 #include "Config.h"
    00036 #include "Num.h"
    00037 #include "NumVar.h"
    00038 #include "LagrangianParam.h"
    00039
    00040 namespace Modelib {
    00041
    00042 //class LagrangianParam;
    00044 /*
    00045   Elle est constituée
    00046   - d'un coefficient de type "Num"
    00047   - d'une variable de type "NumVar"
    00048   - d'un coefficent Lagrangien
    00049   \n Elle represente un groupe  "+ Num * NumVar" dans une expressions linéaire
    00050 */
    00051
    00052 class ExprNode
    00053 {
    00054   protected:
    00055     Num coefficient;
    00056     NumVar variable;
    00057     LagrangianParam mult;
    00058   public:
    00060     ExprNode(const Num & _coefficient = Num(0.0f),
    00061              const NumVar & _variable = NumVar(),
    00062              const LagrangianParam & _mult = LagrangianParam())
    00063     : coefficient(_coefficient), variable(_variable), mult(_mult)
    00064     {}
    00065
    00069     Num       GetCoefficient()  const { return coefficient; }
    00073     void SetCoefficient( float coef ) { coefficient = Num(coef); }
    00074
    00078     NumVar    GetVariable()     const { return variable;    }
    00079
    00083     LagrangianParam   GetLagrangianParam()    const { return mult;   }
    00084 };
    00085
    00086 }
    00087
    00088 #endif