Main Page
Namespaces
Classes
Files
File List
File Members
pos2.hpp
Go to the documentation of this file.
1
/*
2
** TP CPE Lyon
3
** Copyright (C) 2013 Damien Rohmer
4
**
5
** This program is free software: you can redistribute it and/or modify
6
** it under the terms of the GNU General Public License as published by
7
** the Free Software Foundation, either version 3 of the License, or
8
** (at your option) any later version.
9
**
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
14
**
15
** You should have received a copy of the GNU General Public License
16
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
20
21
#ifndef POS2_HPP
22
#define POS2_HPP
23
24
#include <iostream>
25
#include <
exception_cpe.hpp
>
26
27
namespace
cpe
28
{
30
class
pos2
31
{
32
public
:
33
34
// ********************************************* //
35
// ********************************************* //
36
// CONSTRUCTOR
37
// ********************************************* //
38
// ********************************************* //
39
44
pos2
(
int
x0=0,
int
y0=0);
45
46
// ********************************************* //
47
// ********************************************* //
48
// Coordinate access
49
// ********************************************* //
50
// ********************************************* //
51
53
int
x
()
const
;
55
int
&
x
();
57
int
y
()
const
;
59
int
&
y
();
60
61
62
private
:
63
64
// ********************************************* //
65
// ********************************************* //
66
// Internal storage
67
// ********************************************* //
68
// ********************************************* //
69
71
int
internal_x
;
73
int
internal_y
;
74
75
};
76
77
78
// ********************************************* //
79
// ********************************************* //
80
// Operators
81
// ********************************************* //
82
// ********************************************* //
83
85
pos2
operator+
(
const
pos2
& u1,
const
pos2
& u2);
87
pos2
operator-
(
const
pos2
& u1,
const
pos2
& u2);
89
pos2
&
operator+=
(
pos2
& u1,
const
pos2
& u2);
91
pos2
&
operator-=
(
pos2
& u1,
const
pos2
& u2);
92
93
// ********************************************* //
94
// ********************************************* //
95
// I/O
96
// ********************************************* //
97
// ********************************************* //
98
100
std::ostream&
operator<<
(std::ostream& stream,
const
pos2
& u);
101
102
103
105
class
exception_p2d
:
public
exception_cpe
106
{
107
public
:
109
exception_p2d
():
exception_cpe
(){}
111
exception_p2d
(
const
std::string& msg_param,
const
std::string& file_param,
const
std::string& caller_param,
const
int
& line_param):
exception_cpe
(msg_param,file_param,caller_param,line_param){}
112
};
113
}
114
115
116
#endif
libimage
pos2.hpp
Generated on Wed Mar 6 2013 11:12:44 by
1.8.3.1