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 : Int_Att.h * 00026 * Auteur : DEXET Martine * 00027 *----------------------------------------------------------------------------* 00028 * Ce fichier contient la spécification de la classe Int_Att. Cette * 00029 * classe permet de stocker un entier en tant qu'attribut. * 00030 * * 00031 *****************************************************************************/ 00032 00033 00034 #ifndef INT_ATT_H 00035 #define INT_ATT_H 00036 00037 #include "attribute.hh" 00038 00039 00040 00041 /****************************************************************************** 00042 * Classe Int_Att * 00043 *****************************************************************************/ 00044 00045 class Int_Att : public CAttribute { 00046 00047 public: 00048 00049 // Constructeurs. 00050 Int_Att(); 00051 Int_Att(int v); 00052 00053 // Destructeur. 00054 virtual ~Int_Att(); 00055 00056 // Surcharge des méthodes de la classe CAttribute. 00057 TAttributeId getType() const; 00058 int * Get_Data(); 00059 CAttribute * copy() const; 00060 void destroy(); 00061 void save(std::ostream &fd) const; 00062 void load(std::istream &fd); 00063 00064 private: 00065 00066 // Pointeur sur un entier. 00067 int * value; 00068 }; 00069 00070 /****************************************************************************** 00071 * Fichier : Int_Att.inl * 00072 * Auteur : DEXET Martine * 00073 *----------------------------------------------------------------------------* 00074 * Ce fichier contient l'implémentation des méthodes de la classe * 00075 * Int_Att. * 00076 * * 00077 *****************************************************************************/ 00078 00079 #include "user.hh" 00080 00081 // Constructeurs. 00082 inline 00083 Int_Att::Int_Att() 00084 { 00085 value = new int; 00086 } 00087 00088 inline 00089 Int_Att::Int_Att(int v) 00090 { 00091 value = new int(v); 00092 } 00093 00094 00095 // Destructeur. 00096 inline 00097 Int_Att::~Int_Att() 00098 { 00099 delete value; 00100 } 00101 00102 00103 // Surcharge des méthodes de la classe CAttribute. 00104 inline 00105 TAttributeId Int_Att::getType() const 00106 { 00107 return INT_ATTRIBUTE_ID; 00108 } 00109 00110 inline 00111 int * Int_Att::Get_Data() 00112 { 00113 return value; 00114 } 00115 00116 inline 00117 CAttribute * Int_Att::copy() const 00118 { 00119 return new Int_Att(*value); 00120 } 00121 00122 inline 00123 void Int_Att::destroy() 00124 { 00125 delete this; 00126 } 00127 00128 00129 inline 00130 void Int_Att::save(std::ostream &fd) const 00131 { 00132 fd << *value << std::endl; 00133 } 00134 00135 inline 00136 void Int_Att::load(std::istream &fd) 00137 { 00138 } 00139 00140 #endif