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