source: observatorio/simulacion/ModuloDinamico/ip_relationship.C

simulacion
Last change on this file was 6217e66, checked in by root <root@…>, 10 years ago

Eliminado script sql no utilizado

  • Property mode set to 100644
File size: 3.8 KB
Line 
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 implementación de la clase IP_Relationship.
25*/
26
27# include <ip_relationship.H>
28
29IP_Relationship::IP_Relationship()
30  : input_id(0), requested_quantity(0.0), purchase_price(0.0),
31    bought_quantity(0.0), INIT_SIMULATION_ATTRIBUTES
32{
33  // Empty
34}
35
36IP_Relationship::IP_Relationship(const IP_Relationship & ip_relationship)
37  : input_id(ip_relationship.input_id),
38    requested_quantity(ip_relationship.requested_quantity),
39    purchase_price(ip_relationship.purchase_price),
40    bought_quantity(ip_relationship.bought_quantity),
41    INIT_COPY_SIMULATION_ATTRIBUTES(ip_relationship)
42{
43  // Empty
44}
45
46IP_Relationship::IP_Relationship(IP_Relationship && ip_relationship)
47  : input_id(0), requested_quantity(0.0), purchase_price(0.0),
48    bought_quantity(0.0), INIT_SIMULATION_ATTRIBUTES
49{
50  std::swap(input_id, ip_relationship.input_id);
51  std::swap(requested_quantity, ip_relationship.requested_quantity);
52  std::swap(purchase_price, ip_relationship.purchase_price);
53  std::swap(bought_quantity, ip_relationship.bought_quantity);
54  SWAP_SIMULATION_ATTRIBUTES(ip_relationship)
55}
56
57const db_id_t & IP_Relationship::get_input_id() const
58{
59  return input_id;
60}
61
62void IP_Relationship::set_input_id(const db_id_t & _input_id)
63{
64  input_id = _input_id;
65}
66
67const real & IP_Relationship::get_requested_quantity() const
68{
69  return requested_quantity;
70}
71
72void IP_Relationship::set_requested_quantity(const real & _requested_quantity)
73{
74  requested_quantity = _requested_quantity;
75}
76
77const real & IP_Relationship::get_purchase_price() const
78{
79  return purchase_price;
80}
81
82void IP_Relationship::set_purchase_price(const real & _purchase_price)
83{
84  purchase_price = _purchase_price;
85}
86
87const real & IP_Relationship::get_bought_quantity() const
88{
89  return bought_quantity;
90}
91
92void IP_Relationship::set_bought_quantity(const real & _bought_quantity)
93{
94  bought_quantity = _bought_quantity;
95}
96
97IP_Relationship &
98IP_Relationship::operator = (const IP_Relationship & ip_relationship)
99{
100  if (&ip_relationship == this)
101    return *this;
102
103  input_id = ip_relationship.input_id;
104  requested_quantity = ip_relationship.requested_quantity;
105  purchase_price = ip_relationship.purchase_price;
106  bought_quantity = ip_relationship.bought_quantity;
107  COPY_SIMULATION_ATTRIBUTES(ip_relationship)
108
109  return *this;
110}
111
112IP_Relationship &
113IP_Relationship::operator = (IP_Relationship && ip_relationship)
114{
115  std::swap(input_id, ip_relationship.input_id);
116  std::swap(requested_quantity, ip_relationship.requested_quantity);
117  std::swap(purchase_price, ip_relationship.purchase_price);
118  std::swap(bought_quantity, ip_relationship.bought_quantity);
119  SWAP_SIMULATION_ATTRIBUTES(ip_relationship)
120
121  return *this;
122}
123
124std::string IP_Relationship::to_dot() const
125{
126  std::stringstream sstr;
127
128  sstr << "ID: " << input_id << " / "
129       << "IP: " << requested_quantity << " / "
130       << "P: "  << purchase_price << " / "
131       << "C: "  << bought_quantity;
132
133  return sstr.str();
134}
135
Note: See TracBrowser for help on using the repository browser.