SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DPoint2d.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
67 
74 #ifndef SLIP_DPOINT2D_HPP
75 #define SLIP_DPOINT2D_HPP
76 
77 #include <iostream>
78 #include <cassert>
79 #include <string>
80 #include "Block.hpp"
81 #include "DPoint.hpp"
82 
83 #include <boost/serialization/access.hpp>
84 #include <boost/serialization/split_member.hpp>
85 #include <boost/serialization/version.hpp>
86 
87 
88 namespace slip
89 {
90 
102 template <typename CoordType>
103 class DPoint2d:public DPoint<CoordType,2>
104 {
105 public :
106  typedef DPoint2d<CoordType> self;
108 
113 
117  DPoint2d();
118 
123  DPoint2d(const CoordType* array);
124 
130  DPoint2d(const CoordType& dx1,
131  const CoordType& dx2);
132 
144  void dx1(const CoordType& dx);
149  CoordType& dx1();
154  const CoordType& dx1() const;
159  void dx2(const CoordType& dx);
164  CoordType& dx2();
169  const CoordType& dx2() const;
170 
176  void set_coord(const CoordType& dx1, const CoordType& dx2);
177 
184  std::string name() const;
185 
186 private:
188  template<class Archive>
189  void save(Archive & ar, const unsigned int version) const
190  {
191  ar & boost::serialization::base_object<slip::DPoint<CoordType,2> >(*this);
192  }
193  template<class Archive>
194  void load(Archive & ar, const unsigned int version)
195  {
196  ar & boost::serialization::base_object<slip::DPoint<CoordType,2> >(*this);
197  }
198  BOOST_SERIALIZATION_SPLIT_MEMBER()
199 };
200 }//slip::
201 
202 namespace slip
203 {
204  template<typename CoordType>
205  inline
207  {
208  this->coord_[0] = CoordType(0);
209  this->coord_[1] = CoordType(0);
210  }
211 
212  template<typename CoordType>
213  inline
214  DPoint2d<CoordType>::DPoint2d(const CoordType* array):
215  DPoint<CoordType,2>(array)
216  {}
217 
218  template<typename CoordType>
219  inline
220  DPoint2d<CoordType>::DPoint2d(const CoordType& dx1,
221  const CoordType& dx2)
222  {
223  this->coord_[0] = CoordType(dx1);
224  this->coord_[1] = CoordType(dx2);
225  }
226 
227  template<typename CoordType>
228  inline
229  void DPoint2d<CoordType>::dx1(const CoordType& dx) {this->coord_[0]=dx;}
230 
231  template<typename CoordType>
232  inline
233  CoordType& DPoint2d<CoordType>::dx1() {return this->coord_[0];}
234 
235  template<typename CoordType>
236  inline
237  const CoordType& DPoint2d<CoordType>::dx1() const {return this->coord_[0];}
238 
239  template<typename CoordType>
240  inline
241  void DPoint2d<CoordType>::dx2(const CoordType& dx) {this->coord_[1]=dx;}
242 
243  template<typename CoordType>
244  inline
245  CoordType& DPoint2d<CoordType>::dx2() {return this->coord_[1];}
246 
247  template<typename CoordType>
248  inline
249  const CoordType& DPoint2d<CoordType>::dx2() const {return this->coord_[1];}
250 
251  template<typename CoordType>
252  inline
253  void DPoint2d<CoordType>::set_coord(const CoordType& dx1, const CoordType& dx2)
254  {
255  this->coord_[0]= dx1;
256  this->coord_[1] = dx2;
257  }
258  template<typename CoordType>
259  inline
260  std::string
261  DPoint2d<CoordType>::name() const {return "DPoint2d";}
262 
263 
264 }//slip::
265 
266 
267 
268 
269 #endif //SLIP_DPOINT2D_HPP
DPoint2d()
Constructs a DPoint2d.
Definition: DPoint2d.hpp:206
CoordType & dx1()
Accessor/Mutator of the first coordinate of DPoint2d.
Definition: DPoint2d.hpp:233
CoordType & dx2()
Accessor/Mutator of the second coordinate of DPoint2d.
Definition: DPoint2d.hpp:245
Provides a class to manipulate 1d static and generic arrays.
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
Definition: Array2d.hpp:129
void set_coord(const CoordType &dx1, const CoordType &dx2)
Accessor/Mutator of the coordinates of DPoint2d.
Definition: DPoint2d.hpp:253
DPoint< CoordType, 2 > base
Definition: DPoint2d.hpp:107
std::string name() const
Returns the name of the class.
Definition: DPoint2d.hpp:261
friend class boost::serialization::access
Definition: DPoint2d.hpp:187
Provides an abstract class to modelize the difference of slip::Point.