00001 /* 00002 * lib-spamod : Visualisation des objets en discret. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-spamod 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 /****************************************************************************** 00025 * Fichier : Ineq_Table2_Att.h * 00026 * Auteur : DEXET Martine * 00027 *----------------------------------------------------------------------------* 00028 * Ce fichier contient la spécification de la classe Ineq_Table2_Att. Cette * 00029 * classe permet de stocker un objet de la classe Ineq_Table2 en tant * 00030 * qu'attribut. * 00031 * * 00032 *****************************************************************************/ 00033 00034 00035 #ifndef INEQ_TABLE2_ATT_H 00036 #define INEQ_TABLE2_ATT_H 00037 00038 #include "ineq-table-2.hh" 00039 #include "attribute.hh" 00040 00041 00042 00043 /****************************************************************************** 00044 * Classe Ineq_Table2_Att * 00045 *****************************************************************************/ 00046 00047 class Ineq_Table2_Att : public CAttribute { 00048 00049 public: 00050 00051 // Constructeurs. 00052 Ineq_Table2_Att(); 00053 Ineq_Table2_Att(CVertex const & p1, CVertex const & p2, CVertex const & p3); 00054 Ineq_Table2_Att(Ineq_Table2 *t); 00055 00056 // Destructeur. 00057 virtual ~Ineq_Table2_Att(); 00058 00059 // Surcharge des méthodes de la classe CAttribute. 00060 TAttributeId getType() const; 00061 Ineq_Table2 * Get_Data(); 00062 CAttribute * copy() const; 00063 void destroy(); 00064 void save(std::ostream &fd) const; 00065 void load(std::istream &fd); 00066 00067 private: 00068 00069 // Pointeur sur un objet de la classe Ineq_Table2. 00070 Ineq_Table2 * tab; 00071 }; 00072 00073 /****************************************************************************** 00074 * Fichier : Ineq_Table2_Att.inl * 00075 * Auteur : DEXET Martine * 00076 *----------------------------------------------------------------------------* 00077 * Ce fichier contient l'implémentation des méthodes de la classe * 00078 * Ineq_Table2_Att. * 00079 * * 00080 *****************************************************************************/ 00081 00082 // Constructeurs. 00083 inline 00084 Ineq_Table2_Att::Ineq_Table2_Att() 00085 { 00086 tab = new Ineq_Table2(); 00087 } 00088 00089 inline 00090 Ineq_Table2_Att::Ineq_Table2_Att(CVertex const & p1, 00091 CVertex const & p2, 00092 CVertex const & p3) 00093 { 00094 tab = new Ineq_Table2(p1, p2, p3); 00095 } 00096 00097 inline 00098 Ineq_Table2_Att::Ineq_Table2_Att(Ineq_Table2 * t) 00099 { 00100 tab = t; 00101 } 00102 00103 00104 // Destructeur. 00105 inline 00106 Ineq_Table2_Att::~Ineq_Table2_Att() 00107 { 00108 delete tab; 00109 } 00110 00111 00112 // Surcharge des méthodes de la classe CAttribute. 00113 inline 00114 TAttributeId Ineq_Table2_Att::getType() const 00115 { 00116 return INEQ2_ATTRIBUTE_ID; 00117 } 00118 00119 inline 00120 Ineq_Table2 * Ineq_Table2_Att::Get_Data() 00121 { 00122 return tab; 00123 } 00124 00125 inline 00126 CAttribute * Ineq_Table2_Att::copy() const 00127 { 00128 Ineq_Table2 * t = new Ineq_Table2(*(this->tab)); 00129 00130 return new Ineq_Table2_Att(t); 00131 } 00132 00133 00134 inline 00135 void Ineq_Table2_Att::destroy() 00136 { 00137 delete this; 00138 } 00139 00140 00141 inline 00142 void Ineq_Table2_Att::save(std::ostream &fd) const 00143 { 00144 for (int i=0 ; i<2 ; i++) 00145 fd << *tab->Get_Ineq(i); 00146 } 00147 00148 inline 00149 void Ineq_Table2_Att::load(std::istream &fd) 00150 { 00151 Inequation iq; 00152 00153 for (int i=0; i<2; i++) 00154 { 00155 fd >> iq; 00156 tab->Set_Ineq(i, iq); 00157 } 00158 } 00159 00160 #endif