Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYTrafic.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 /*
17  *
18  */
19 
20 #ifndef __TY_TRAFIC__
21 #define __TY_TRAFIC__
22 
24 
25 #include "RoadEmissionNMPB08.h"
26 
30 class TYTrafic : public TYElement
31 {
34 
35  friend class TYRoute;
36 
38  {
39  LV /*Light Vehicules*/,
40  HGV /*Heavy Goods Vehicules*/,
42  };
43 
44  // Methodes
45 public:
49  TYTrafic();
53  TYTrafic(const TYTrafic& other);
57  TYTrafic(double debitVL, double debitPL);
61  virtual ~TYTrafic();
62 
64  TYTrafic& operator=(const TYTrafic& other);
66  bool operator==(const TYTrafic& other) const;
68  bool operator!=(const TYTrafic& other) const;
69 
78  virtual bool deepCopy(const TYElement* pOther, bool copyId = true, bool pUseCopyTag = false);
79 
80  virtual std::string toString() const;
81 
82  virtual DOM_Element toXML(DOM_Element& domElement);
83  virtual int fromXML(DOM_Element domElement);
84 
88  double getDebitPL() const
89  {
90  return hgv.trafficFlow;
91  }
95  void setDebitPL(double deb)
96  {
97  hgv.trafficFlow = deb;
98  }
99 
103  double getDebitVL() const
104  {
105  return lv.trafficFlow;
106  }
110  void setDebitVL(double deb)
111  {
112  lv.trafficFlow = deb;
113  }
114 
115  // Membres
116 protected:
117  union
118  {
119  struct
120  {
121  RoadTrafficComponent lv;
122  RoadTrafficComponent hgv;
123  };
124 
125  RoadTrafficComponent arr[NB_VEHICLE_TYPES];
126  };
127 
128 private:
136  int fromXML_TrafficComponent(DOM_Element domElement, RoadTrafficComponent& rtc);
137 };
138 
139 #endif // __TY_TRAFIC__
QDomElement DOM_Element
Definition: QT2DOM.h:30
#define OPROTODECL(classname)
Definition: TYElement.h:65
#define TY_EXTENSION_DECL_ONLY(classname)
Definition: TYElement.h:386
virtual bool deepCopy(const TYElement *pOther, bool copyId=true, bool pUseCopyTag=false)
Definition: TYTrafic.cpp:95
int fromXML_TrafficComponent(DOM_Element domElement, RoadTrafficComponent &rtc)
Auxilliary methods used to read a RoadTrafficComponent from XML.
Definition: TYTrafic.cpp:164
VehicleTypes
Definition: TYTrafic.h:38
@ NB_VEHICLE_TYPES
Definition: TYTrafic.h:41
void setDebitPL(double deb)
Definition: TYTrafic.h:95
virtual ~TYTrafic()
Definition: TYTrafic.cpp:50
TYTrafic(double debitVL, double debitPL)
RoadTrafficComponent arr[NB_VEHICLE_TYPES]
Definition: TYTrafic.h:125
void setDebitVL(double deb)
Definition: TYTrafic.h:110
RoadTrafficComponent lv
Definition: TYTrafic.h:121
double getDebitPL() const
Definition: TYTrafic.h:88
bool operator!=(const TYTrafic &other) const
Operateur !=.
Definition: TYTrafic.cpp:90
TYTrafic()
Definition: TYTrafic.cpp:30
virtual std::string toString() const
Definition: TYTrafic.cpp:109
RoadTrafficComponent hgv
Definition: TYTrafic.h:122
virtual DOM_Element toXML(DOM_Element &domElement)
Definition: TYTrafic.cpp:114
TYTrafic & operator=(const TYTrafic &other)
Operateur =.
Definition: TYTrafic.cpp:52
virtual int fromXML(DOM_Element domElement)
Definition: TYTrafic.cpp:133
double getDebitVL() const
Definition: TYTrafic.h:103
bool operator==(const TYTrafic &other) const
Operateur ==.
Definition: TYTrafic.cpp:67