1 | /* |
---|
2 | Copyright (C) 2014 |
---|
3 | Alejandro Mujica (amujica@cenditel.gob.ve) |
---|
4 | José Ruiz (jruiz@cenditel.gob.ve) |
---|
5 | Julie Vera (jvera@cenditel.gob.ve) |
---|
6 | |
---|
7 | CENDITEL Fundación Centro Nacional de Desarrollo e Investigación en |
---|
8 | Tecnologías Libres |
---|
9 | |
---|
10 | Este programa es software libre; Usted puede usarlo bajo los términos de la |
---|
11 | licencia de software GPL versión 2.0 de la Free Software Foundation. |
---|
12 | |
---|
13 | Este programa se distribuye con la esperanza de que sea útil, pero SIN |
---|
14 | NINGUNA GARANTÍA; tampoco las implícitas garantías de MERCANTILIDAD o |
---|
15 | ADECUACIÓN A UN PROPÓSITO PARTICULAR. |
---|
16 | Consulte la licencia GPL para más detalles. Usted debe recibir una copia |
---|
17 | de la GPL junto con este programa; si no, escriba a la Free Software |
---|
18 | Foundation Inc. 51 Franklin Street,5 Piso, Boston, MA 02110-1301, USA. |
---|
19 | */ |
---|
20 | |
---|
21 | /* |
---|
22 | Autor: Alejandro J. Mujica |
---|
23 | Fecha de creación: 05/06/2014 |
---|
24 | Este archivo contiene la definición de la clase Good y un tipo |
---|
25 | enumerado llamado Good_Type el cual contiene valores para cada tipo de Good. |
---|
26 | */ |
---|
27 | |
---|
28 | # ifndef GOOD_H |
---|
29 | # define GOOD_H |
---|
30 | |
---|
31 | # include <types.H> |
---|
32 | |
---|
33 | /// Tipo de especialización de un bien. |
---|
34 | enum Good_Type { PRODUCT, INPUT, IMPORTED_PRODUCT }; |
---|
35 | |
---|
36 | /** Representa la abstracción base para un Bien. |
---|
37 | * |
---|
38 | * Esta clase contiene información general que llevan todos los bienes, bien |
---|
39 | * sea el producto de una empresa registrada en el SIGESIC, un insumo declarado |
---|
40 | * por una empresa registrada el cual sea producido por una empresa no |
---|
41 | * registrada o una importación declarada por una empresa registrada. |
---|
42 | * |
---|
43 | * @author Alejandro J. Mujica |
---|
44 | */ |
---|
45 | class Good |
---|
46 | { |
---|
47 | // Información de la empresa que lo produce |
---|
48 | |
---|
49 | /// Registro de Información Fiscal de la Unidad Económica. |
---|
50 | std::string company_rif; |
---|
51 | |
---|
52 | /// Razón Social. |
---|
53 | std::string company_name; |
---|
54 | |
---|
55 | /// Nacionalidad. |
---|
56 | std::string nationality; |
---|
57 | |
---|
58 | /// Jornada de trabajo diaria. |
---|
59 | real working_day; |
---|
60 | |
---|
61 | // Información general del bien |
---|
62 | |
---|
63 | /** Id del bien en la tabla de la base de datos, tanto para producto como para |
---|
64 | * insumo. |
---|
65 | */ |
---|
66 | db_id_t id; |
---|
67 | std::string name; |
---|
68 | std::string tariff_code; |
---|
69 | std::string measurement_unit; |
---|
70 | |
---|
71 | // Información del bien en la red |
---|
72 | int level; |
---|
73 | |
---|
74 | public: |
---|
75 | Good(); |
---|
76 | |
---|
77 | Good(const Good &); |
---|
78 | |
---|
79 | Good(Good &&); |
---|
80 | |
---|
81 | const std::string & get_company_rif() const; |
---|
82 | |
---|
83 | void set_company_rif(const std::string &); |
---|
84 | |
---|
85 | void set_company_rif(std::string &&); |
---|
86 | |
---|
87 | const std::string & get_company_name() const; |
---|
88 | |
---|
89 | void set_company_name(const std::string &); |
---|
90 | |
---|
91 | void set_company_name(std::string &&); |
---|
92 | |
---|
93 | const std::string & get_nationality() const; |
---|
94 | |
---|
95 | void set_nationality(const std::string &); |
---|
96 | |
---|
97 | void set_nationality(std::string &&); |
---|
98 | |
---|
99 | const real & get_working_day() const; |
---|
100 | |
---|
101 | void set_working_day(const real &); |
---|
102 | |
---|
103 | const db_id_t & get_id() const; |
---|
104 | |
---|
105 | void set_id(const db_id_t &); |
---|
106 | |
---|
107 | const std::string & get_name() const; |
---|
108 | |
---|
109 | void set_name(const std::string &); |
---|
110 | |
---|
111 | void set_name(std::string &&); |
---|
112 | |
---|
113 | const std::string & get_tariff_code() const; |
---|
114 | |
---|
115 | void set_tariff_code(const std::string &); |
---|
116 | |
---|
117 | void set_tariff_code(std::string &&); |
---|
118 | |
---|
119 | const std::string & get_measurement_unit() const; |
---|
120 | |
---|
121 | void set_measurement_unit(const std::string &); |
---|
122 | |
---|
123 | void set_measurement_unit(std::string &&); |
---|
124 | |
---|
125 | const int & get_level() const; |
---|
126 | |
---|
127 | void set_level(const int &); |
---|
128 | |
---|
129 | Good & operator = (const Good &); |
---|
130 | |
---|
131 | Good & operator = (Good &&); |
---|
132 | |
---|
133 | virtual Good_Type get_type() const = 0; |
---|
134 | }; |
---|
135 | |
---|
136 | # define DECLARE_SIMULATION_ATTRIBUTES(Simulation_Attributes) \ |
---|
137 | List<Simulation_Attributes> simulation_attributes_list; |
---|
138 | |
---|
139 | # define DEFINE_SIMULATION_ATTRIBUTES_METHODS(Simulation_Attributes) \ |
---|
140 | Simulation_Attributes & \ |
---|
141 | add_simulation_attributes(const Simulation_Attributes & simulation_attributes) \ |
---|
142 | { \ |
---|
143 | return simulation_attributes_list.append(simulation_attributes); \ |
---|
144 | } \ |
---|
145 | \ |
---|
146 | Simulation_Attributes & get_last_simulation_attributes() \ |
---|
147 | { \ |
---|
148 | return simulation_attributes_list.get_last(); \ |
---|
149 | } \ |
---|
150 | \ |
---|
151 | template <class Op> \ |
---|
152 | void for_each_simulation_attributes(Op & op) \ |
---|
153 | { \ |
---|
154 | List<Simulation_Attributes>::Iterator it(simulation_attributes_list); \ |
---|
155 | \ |
---|
156 | for ( ; it.has_current(); it.next()) \ |
---|
157 | { \ |
---|
158 | Simulation_Attributes & simulation_attributes = it.get_current(); \ |
---|
159 | op(simulation_attributes); \ |
---|
160 | } \ |
---|
161 | } \ |
---|
162 | \ |
---|
163 | template <class Op> \ |
---|
164 | void for_each_simulation_attributes(Op && op) \ |
---|
165 | { \ |
---|
166 | for_each_simulation_attributes<Op>(op); \ |
---|
167 | } |
---|
168 | |
---|
169 | # define INIT_SIMULATION_ATTRIBUTES \ |
---|
170 | simulation_attributes_list() |
---|
171 | |
---|
172 | # define INIT_COPY_SIMULATION_ATTRIBUTES(src) \ |
---|
173 | simulation_attributes_list(src.simulation_attributes_list) |
---|
174 | |
---|
175 | # define COPY_SIMULATION_ATTRIBUTES(src) \ |
---|
176 | simulation_attributes_list = src.simulation_attributes_list; |
---|
177 | |
---|
178 | # define SWAP_SIMULATION_ATTRIBUTES(src) \ |
---|
179 | simulation_attributes_list.swap(src.simulation_attributes_list); |
---|
180 | |
---|
181 | # endif // GOOD_H |
---|
182 | |
---|