1 | /* |
---|
2 | Copyright (C) 2012 |
---|
3 | Alejandro Mujica (amujica@cenditel.gob.ve) |
---|
4 | Erwin Paredes (eparedes@cenditel.gob.ve) |
---|
5 | José Ruiz (jruiz@cenditel.gob.ve) |
---|
6 | Rodolfo Rangel (rrangel@cenditel.gob.ve) |
---|
7 | Julie Vera (jvera@cenditel.gob.ve) |
---|
8 | |
---|
9 | CENDITEL Fundación Centro Nacional de Desarrollo e Investigación en |
---|
10 | Tecnologías Libres |
---|
11 | |
---|
12 | Este programa es software libre; Usted puede usarlo bajo los términos de la |
---|
13 | licencia de software GPL versión 2.0 de la Free Software Foundation. |
---|
14 | |
---|
15 | Este programa se distribuye con la esperanza de que sea útil, pero SIN |
---|
16 | NINGUNA GARANTÍA; tampoco las implícitas garantías de MERCANTILIDAD o |
---|
17 | ADECUACIÓN A UN PROPÓSITO PARTICULAR. |
---|
18 | Consulte la licencia GPL para más detalles. Usted debe recibir una copia |
---|
19 | de la GPL junto con este programa; si no, escriba a la Free Software |
---|
20 | Foundation Inc. 51 Franklin Street,5 Piso, Boston, MA 02110-1301, USA. |
---|
21 | */ |
---|
22 | |
---|
23 | /* |
---|
24 | Autor: Alejandro J. Mujica |
---|
25 | Fecha de creación: 10/09/2013 |
---|
26 | Este archivo contiene la implementación de la clase Plant. |
---|
27 | */ |
---|
28 | |
---|
29 | # include <plant.H> |
---|
30 | |
---|
31 | Plant::Plant() |
---|
32 | : id(-1), name("NULL"), ownerCompany(NULL) { |
---|
33 | |
---|
34 | // Empty |
---|
35 | } |
---|
36 | |
---|
37 | Plant::Plant(const Plant & plant) |
---|
38 | : id(plant.id), name(plant.name), ownerCompany(plant.ownerCompany) { |
---|
39 | |
---|
40 | // Empty |
---|
41 | } |
---|
42 | |
---|
43 | Plant::Plant(Plant && plant) |
---|
44 | : id(-1), name("NULL"), ownerCompany(NULL) { |
---|
45 | |
---|
46 | std::swap(id, plant.id); |
---|
47 | std::swap(name, plant.name); |
---|
48 | std::swap(ownerCompany, plant.ownerCompany); |
---|
49 | } |
---|
50 | |
---|
51 | const long & Plant::getId() const { |
---|
52 | return id; |
---|
53 | } |
---|
54 | |
---|
55 | void Plant::setId(const long & id) |
---|
56 | { |
---|
57 | this->id = id; |
---|
58 | } |
---|
59 | |
---|
60 | const std::string & Plant::getName() const { |
---|
61 | return name; |
---|
62 | } |
---|
63 | |
---|
64 | void Plant::setName(const std::string & name) { |
---|
65 | this->name = name; |
---|
66 | } |
---|
67 | |
---|
68 | void Plant::setName(std::string && name) { |
---|
69 | this->name = std::move(name); |
---|
70 | } |
---|
71 | |
---|
72 | Company * Plant::getOwnerCompany() { |
---|
73 | return ownerCompany; |
---|
74 | } |
---|
75 | |
---|
76 | void Plant::setOwnerCompany(Company * ownerCompany) { |
---|
77 | this->ownerCompany = ownerCompany; |
---|
78 | } |
---|
79 | |
---|
80 | Plant & Plant::operator = (const Plant & plant) { |
---|
81 | |
---|
82 | if (&plant == this) |
---|
83 | return *this; |
---|
84 | |
---|
85 | id = plant.id; |
---|
86 | name = plant.name; |
---|
87 | ownerCompany = plant.ownerCompany; |
---|
88 | |
---|
89 | return *this; |
---|
90 | } |
---|
91 | |
---|
92 | Plant & Plant::operator = (Plant && plant) { |
---|
93 | |
---|
94 | std::swap(id, plant.id); |
---|
95 | std::swap(name, plant.name); |
---|
96 | std::swap(ownerCompany, plant.ownerCompany); |
---|
97 | |
---|
98 | return *this; |
---|
99 | } |
---|
100 | |
---|