| 1 |
/* |
| 2 |
* Methods of class Coord |
| 3 |
* |
| 4 |
* (see file coord.h for documentation) |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
/* |
| 9 |
* Copyright (c) 1999-2000 Jean-Alain Marck |
| 10 |
* Copyright (c) 1999-2001 Eric Gourgoulhon |
| 11 |
* |
| 12 |
* This file is part of LORENE. |
| 13 |
* |
| 14 |
* LORENE is free software; you can redistribute it and/or modify |
| 15 |
* it under the terms of the GNU General Public License as published by |
| 16 |
* the Free Software Foundation; either version 2 of the License, or |
| 17 |
* (at your option) any later version. |
| 18 |
* |
| 19 |
* LORENE is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with LORENE; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 27 |
* |
| 28 |
*/ |
| 29 |
|
| 30 |
|
| 31 |
char coord_C[] = "$Header: /cvsroot/Lorene/C++/Source/Coord/coord.C,v 1.5 2014/10/13 08:52:50 j_novak Exp $" ; |
| 32 |
|
| 33 |
/* |
| 34 |
* $Id: coord.C,v 1.5 2014/10/13 08:52:50 j_novak Exp $ |
| 35 |
* $Log: coord.C,v $ |
| 36 |
* Revision 1.5 2014/10/13 08:52:50 j_novak |
| 37 |
* Lorene classes and functions now belong to the namespace Lorene. |
| 38 |
* |
| 39 |
* Revision 1.4 2014/10/06 15:13:04 j_novak |
| 40 |
* Modified #include directives to use c++ syntax. |
| 41 |
* |
| 42 |
* Revision 1.3 2008/02/18 13:53:39 j_novak |
| 43 |
* Removal of special indentation instructions. |
| 44 |
* |
| 45 |
* Revision 1.2 2002/10/16 14:36:34 j_novak |
| 46 |
* Reorganization of #include instructions of standard C++, in order to |
| 47 |
* use experimental version 3 of gcc. |
| 48 |
* |
| 49 |
* Revision 1.1.1.1 2001/11/20 15:19:28 e_gourgoulhon |
| 50 |
* LORENE |
| 51 |
* |
| 52 |
* Revision 2.3 1999/10/15 09:16:11 eric |
| 53 |
* Depoussierage. |
| 54 |
* |
| 55 |
* Revision 2.2 1999/03/01 15:07:25 eric |
| 56 |
* *** empty log message *** |
| 57 |
* |
| 58 |
* Revision 2.1 1999/02/23 14:57:03 hyc |
| 59 |
* *** empty log message *** |
| 60 |
* |
| 61 |
* Revision 2.0 1999/02/15 10:42:45 hyc |
| 62 |
* *** empty log message *** |
| 63 |
* |
| 64 |
* $Header: /cvsroot/Lorene/C++/Source/Coord/coord.C,v 1.5 2014/10/13 08:52:50 j_novak Exp $ |
| 65 |
* |
| 66 |
*/ |
| 67 |
|
| 68 |
// Fichier includes |
| 69 |
#include <cstdlib> |
| 70 |
#include <cstdio> |
| 71 |
#include "coord.h" |
| 72 |
#include "mtbl.h" |
| 73 |
|
| 74 |
//---------------// |
| 75 |
// Constructeurs // |
| 76 |
//---------------// |
| 77 |
|
| 78 |
// Constructeur par defaut |
| 79 |
namespace Lorene { |
| 80 |
Coord::Coord() : mp(0x0), met_fait(0x0), c(0x0) {} |
| 81 |
|
| 82 |
// Constructeur |
| 83 |
Coord::Coord(const Map* mpi, Mtbl* (*construit)(const Map* ) ) : mp(mpi), |
| 84 |
met_fait(construit), |
| 85 |
c(0x0) |
| 86 |
{} |
| 87 |
|
| 88 |
//--------------// |
| 89 |
// Destructeur // |
| 90 |
//--------------// |
| 91 |
|
| 92 |
Coord::~Coord() { |
| 93 |
delete c ; |
| 94 |
} |
| 95 |
|
| 96 |
//------------// |
| 97 |
// Impression // |
| 98 |
//------------// |
| 99 |
|
| 100 |
// Operateurs << |
| 101 |
ostream& operator<<(ostream& o, const Coord & ci) { |
| 102 |
|
| 103 |
if (ci.c == 0x0) { |
| 104 |
o << "La coordonnee n'est pas a jour, je la fais." << endl ; |
| 105 |
ci.fait() ; |
| 106 |
} |
| 107 |
o << "Coordonnee: " << endl ; |
| 108 |
o << *(ci.c) << endl ; |
| 109 |
return o ; |
| 110 |
} |
| 111 |
|
| 112 |
//----------// |
| 113 |
// Methodes // |
| 114 |
//----------// |
| 115 |
|
| 116 |
void Coord::fait() const { |
| 117 |
delete c ; |
| 118 |
c = met_fait(mp) ; |
| 119 |
} |
| 120 |
|
| 121 |
//-----------------// |
| 122 |
// Gestion memoire // |
| 123 |
//-----------------// |
| 124 |
|
| 125 |
void Coord::del_t() const { |
| 126 |
delete c ; |
| 127 |
c = 0x0 ; |
| 128 |
} |
| 129 |
|
| 130 |
//--------------------// |
| 131 |
// Fonctions diverses // |
| 132 |
//--------------------// |
| 133 |
|
| 134 |
void Coord::set(const Map* mpi, Mtbl* (*construit)(const Map*) ) { |
| 135 |
mp = mpi ; |
| 136 |
met_fait = construit ; |
| 137 |
} |
| 138 |
} |