SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DPoint4d.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 
75 #ifndef SLIP_DPOINT4D_HPP
76 #define SLIP_DPOINT4D_HPP
77 
78 #include <iostream>
79 #include <cassert>
80 #include <string>
81 #include "DPoint.hpp"
82 
83 namespace slip
84 {
98 template <typename CoordType>
99 class DPoint4d:public slip::DPoint<CoordType,4>
100 {
101 public :
102  typedef DPoint4d<CoordType> self;
104 
109 
113  DPoint4d();
114 
119  DPoint4d(const CoordType* array);
120 
121 
129  DPoint4d(const CoordType& dx1,
130  const CoordType& dx2,
131  const CoordType& dx3,
132  const CoordType& dx4);
133 
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;
174  void dx3(const CoordType& dx);
179  CoordType& dx3();
184  const CoordType& dx3() const;
189  void dx4(const CoordType& dx);
194  CoordType& dx4();
199  const CoordType& dx4() const;
200 
208  void set_coord(const CoordType& dx1,
209  const CoordType& dx2,
210  const CoordType& dx3,
211  const CoordType& dx4);
218  std::string name() const;
219 
220  private:
222  template<class Archive>
223  void save(Archive & ar, const unsigned int version) const
224  {
225  ar & boost::serialization::base_object<slip::DPoint<CoordType,4> >(*this);
226  }
227  template<class Archive>
228  void load(Archive & ar, const unsigned int version)
229  {
230  ar & boost::serialization::base_object<slip::DPoint<CoordType,4> >(*this);
231  }
232  BOOST_SERIALIZATION_SPLIT_MEMBER()
233 };
234 }//slip::
235 
236 namespace slip
237 {
238 template<typename CoordType>
239 inline
241 {
242  this->coord_[0] = CoordType(0);
243  this->coord_[1] = CoordType(0);
244  this->coord_[2] = CoordType(0);
245  this->coord_[3] = CoordType(0);
246 }
247 
248 template<typename CoordType>
249 inline
250 DPoint4d<CoordType>::DPoint4d(const CoordType* array):
251 slip::DPoint<CoordType,4>(array)
252 {}
253 
254 
255 template<typename CoordType>
256 inline
257 DPoint4d<CoordType>::DPoint4d(const CoordType& dx1,
258  const CoordType& dx2, const CoordType& dx3,
259  const CoordType& dx4)
260  {
261  this->coord_[0] = CoordType(dx1);
262  this->coord_[1] = CoordType(dx2);
263  this->coord_[2] = CoordType(dx3);
264  this->coord_[3] = CoordType(dx4);
265  }
266 
267 template<typename CoordType>
268 inline
269 void DPoint4d<CoordType>::dx1(const CoordType& dx) {this->coord_[0]=dx;}
270 
271 template<typename CoordType>
272 inline
273 CoordType& DPoint4d<CoordType>::dx1() {return this->coord_[0];}
274 
275 template<typename CoordType>
276 inline
277 const CoordType& DPoint4d<CoordType>::dx1() const {return this->coord_[0];}
278 
279 template<typename CoordType>
280 inline
281 void DPoint4d<CoordType>::dx2(const CoordType& dx) {this->coord_[1]=dx;}
282 
283 template<typename CoordType>
284 inline
285 CoordType& DPoint4d<CoordType>::dx2() {return this->coord_[1];}
286 
287 template<typename CoordType>
288 inline
289 const CoordType& DPoint4d<CoordType>::dx2() const {return this->coord_[1];}
290 
291 template<typename CoordType>
292 inline
293 void DPoint4d<CoordType>::dx3(const CoordType& dx) {this->coord_[2]=dx;}
294 
295 template<typename CoordType>
296 inline
297 CoordType& DPoint4d<CoordType>::dx3() {return this->coord_[2];}
298 
299 template<typename CoordType>
300 inline
301 const CoordType& DPoint4d<CoordType>::dx3() const {return this->coord_[2];}
302 
303 template<typename CoordType>
304 inline
305 void DPoint4d<CoordType>::dx4(const CoordType& dx) {this->coord_[3]=dx;}
306 
307 template<typename CoordType>
308 inline
309 CoordType& DPoint4d<CoordType>::dx4() {return this->coord_[3];}
310 
311 template<typename CoordType>
312 inline
313 const CoordType& DPoint4d<CoordType>::dx4() const {return this->coord_[3];}
314 
315 template<typename CoordType>
316 inline
317 void DPoint4d<CoordType>::set_coord(const CoordType& dx1,
318  const CoordType& dx2,
319  const CoordType& dx3,
320  const CoordType& dx4)
321  {
322  this->coord_[0] = dx1;
323  this->coord_[1] = dx2;
324  this->coord_[2] = dx3;
325  this->coord_[3] = dx4;
326  }
327 
328 
329 template<typename CoordType>
330 inline
331 std::string
332 DPoint4d<CoordType>::name() const {return "DPoint4d";}
333 
334 }//slip::
335 
336 #endif //SLIP_DPOINT4D
DPoint4d()
Constructs a DPoint4d.
Definition: DPoint4d.hpp:240
friend class boost::serialization::access
Definition: DPoint4d.hpp:221
CoordType & dx3()
Accessor/Mutator of the third coordinate of DPoint4d.
Definition: DPoint4d.hpp:297
CoordType & dx4()
Accessor/Mutator of the fourth coordinate of DPoint4d.
Definition: DPoint4d.hpp:309
void set_coord(const CoordType &dx1, const CoordType &dx2, const CoordType &dx3, const CoordType &dx4)
Accessor/Mutator of the coordinates of DPoint4d.
Definition: DPoint4d.hpp:317
slip::DPoint< CoordType, 4 > base
Definition: DPoint4d.hpp:103
Difference of Point4D class, specialization of DPoint<CoordType,DIM> with DIM = 4.
Definition: DPoint4d.hpp:99
Define an abstract DPoint structure.
Definition: Box.hpp:95
CoordType & dx1()
Accessor/Mutator of the first coordinate of DPoint4d.
Definition: DPoint4d.hpp:273
CoordType & dx2()
Accessor/Mutator of the second coordinate of DPoint4d.
Definition: DPoint4d.hpp:285
std::string name() const
Returns the name of the class.
Definition: DPoint4d.hpp:332
Provides an abstract class to modelize the difference of slip::Point.