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 Product. |
---|
27 | */ |
---|
28 | |
---|
29 | # include <product.H> |
---|
30 | |
---|
31 | Product::Product() |
---|
32 | : Good(), producerPlant(NULL) { |
---|
33 | |
---|
34 | // Empty |
---|
35 | } |
---|
36 | |
---|
37 | Product::Product(const Product & product) |
---|
38 | : Good(product), producerPlant(product.producerPlant) { |
---|
39 | |
---|
40 | // Empty |
---|
41 | } |
---|
42 | |
---|
43 | Product::Product(Product && product) |
---|
44 | : Good(std::move(product)), producerPlant(NULL) { |
---|
45 | |
---|
46 | std::swap(producerPlant, product.producerPlant); |
---|
47 | } |
---|
48 | |
---|
49 | Plant * Product::getProducerPlant() { |
---|
50 | return producerPlant; |
---|
51 | } |
---|
52 | |
---|
53 | void Product::setProducerPlant(Plant * producerPlant) { |
---|
54 | this->producerPlant = producerPlant; |
---|
55 | } |
---|
56 | |
---|
57 | Product & Product::operator = (const Product & product) { |
---|
58 | |
---|
59 | if (&product == this) |
---|
60 | return *this; |
---|
61 | |
---|
62 | (Good &) (*this) = product; |
---|
63 | |
---|
64 | producerPlant = product.producerPlant; |
---|
65 | |
---|
66 | return *this; |
---|
67 | } |
---|
68 | |
---|
69 | Product & Product::operator = (Product && product) { |
---|
70 | |
---|
71 | (Good &) (*this) = std::move(product); |
---|
72 | |
---|
73 | std::swap(producerPlant, product.producerPlant); |
---|
74 | |
---|
75 | return *this; |
---|
76 | } |
---|
77 | |
---|
78 | GoodType Product::getType() const { |
---|
79 | return PRODUCT_GOOD; |
---|
80 | } |
---|
81 | |
---|