Eclipse SUMO - Simulation of Urban MObility
SUMOSAXAttributesImpl_Binary.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2007-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
16 // Encapsulated xml-attributes that are retrieved from the sumo-binary-xml format (already typed)
17 /****************************************************************************/
18 #ifndef SUMOSAXAttributesImpl_Binary_h
19 #define SUMOSAXAttributesImpl_Binary_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <map>
28 #include <set>
29 #include "SUMOSAXAttributes.h"
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class BinaryInputDevice;
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
48 public:
55  SUMOSAXAttributesImpl_Binary(const std::map<int, std::string>& predefinedTagsMML,
56  const std::string& objectType,
57  BinaryInputDevice* in, const char version);
58 
61 
62 
63 
64 
67 
73  bool hasAttribute(int id) const;
74 
75 
91  bool getBool(int id) const;
92 
93 
109  int getInt(int id) const;
110 
111 
127  long long int getLong(int id) const;
128 
129 
142  std::string getString(int id) const;
143 
156  std::string getStringSecure(int id,
157  const std::string& def) const;
158 
159 
175  double getFloat(int id) const;
176 
177 
181  bool hasAttribute(const std::string& id) const;
182 
183 
199  double getFloat(const std::string& id) const;
200 
201 
211  std::string getStringSecure(const std::string& id,
212  const std::string& def) const;
213  //}
214 
215 
222  SumoXMLEdgeFunc getEdgeFunc(bool& ok) const;
223 
224 
231  SumoXMLNodeType getNodeType(bool& ok) const;
232 
234  RightOfWay getRightOfWay(bool& ok) const;
235 
237  FringeType getFringeType(bool& ok) const;
238 
245  RGBColor getColor() const;
246 
247 
253  PositionVector getShape(int attr) const;
254 
255 
261  Boundary getBoundary(int attr) const;
262 
270  std::string getName(int attr) const;
271 
272 
277  void serialize(std::ostream& os) const;
278 
281  std::vector<std::string> getAttributeNames() const;
282 
284  SUMOSAXAttributes* clone() const;
285 
286 private:
288  const std::map<int, std::string>& myAttrIds;
289 
291  std::set<int> myAttrs;
292 
294  std::map<int, char> myCharValues;
295 
297  std::map<int, int> myIntValues;
298 
300  std::map<int, double> myFloatValues;
301 
303  std::map<int, std::string> myStringValues;
304 
306  std::map<int, PositionVector> myPositionVectors;
307 
308 
309 private:
312 
315 
316 
317 };
318 
319 
320 #endif
321 
322 /****************************************************************************/
323 
FringeType
FringeType
algorithms for computing right of way
Definition: SUMOXMLDefinitions.h:1110
SUMOSAXAttributesImpl_Binary::serialize
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
Definition: SUMOSAXAttributesImpl_Binary.cpp:338
SUMOSAXAttributesImpl_Binary::myIntValues
std::map< int, int > myIntValues
Map of attribute ids to integers.
Definition: SUMOSAXAttributesImpl_Binary.h:297
SUMOSAXAttributesImpl_Binary::getFloat
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:212
SUMOSAXAttributesImpl_Binary::myCharValues
std::map< int, char > myCharValues
Map of attribute ids to char.
Definition: SUMOSAXAttributesImpl_Binary.h:294
SUMOSAXAttributesImpl_Binary::myFloatValues
std::map< int, double > myFloatValues
Map of attribute ids to floats.
Definition: SUMOSAXAttributesImpl_Binary.h:300
SUMOSAXAttributesImpl_Binary::~SUMOSAXAttributesImpl_Binary
virtual ~SUMOSAXAttributesImpl_Binary()
Destructor.
Definition: SUMOSAXAttributesImpl_Binary.cpp:154
SumoXMLEdgeFunc
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
Definition: SUMOXMLDefinitions.h:1079
SUMOSAXAttributesImpl_Binary::getString
std::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:191
SUMOSAXAttributesImpl_Binary::getColor
RGBColor getColor() const
Returns the value of the named attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:295
PositionVector
A list of positions.
Definition: PositionVector.h:45
SUMOSAXAttributesImpl_Binary::myPositionVectors
std::map< int, PositionVector > myPositionVectors
Map of attribute ids to string.
Definition: SUMOSAXAttributesImpl_Binary.h:306
SUMOSAXAttributesImpl_Binary::myAttrs
std::set< int > myAttrs
the attributes which are set
Definition: SUMOSAXAttributesImpl_Binary.h:291
RGBColor
Definition: RGBColor.h:39
SUMOSAXAttributesImpl_Binary::getShape
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
Definition: SUMOSAXAttributesImpl_Binary.cpp:306
SUMOSAXAttributesImpl_Binary::getRightOfWay
RightOfWay getRightOfWay(bool &ok) const
returns rightOfWay method
Definition: SUMOSAXAttributesImpl_Binary.cpp:269
SumoXMLNodeType
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
Definition: SUMOXMLDefinitions.h:1054
SUMOSAXAttributesImpl_Binary
Encapsulated Xerces-SAX-attributes.
Definition: SUMOSAXAttributesImpl_Binary.h:47
SUMOSAXAttributesImpl_Binary::clone
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
Definition: SUMOSAXAttributesImpl_Binary.cpp:356
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
SUMOSAXAttributesImpl_Binary::getLong
long long int getLong(int id) const
Returns the long-value of the named (by its enum-value) attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:185
SUMOSAXAttributesImpl_Binary::getBoundary
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.
Definition: SUMOSAXAttributesImpl_Binary.cpp:316
SUMOSAXAttributesImpl_Binary::myAttrIds
const std::map< int, std::string > & myAttrIds
Map of attribute ids to names.
Definition: SUMOSAXAttributesImpl_Binary.h:288
SUMOSAXAttributesImpl_Binary::getBool
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:165
SUMOSAXAttributesImpl_Binary::SUMOSAXAttributesImpl_Binary
SUMOSAXAttributesImpl_Binary(const SUMOSAXAttributesImpl_Binary &src)
Invalidated copy constructor.
SUMOSAXAttributesImpl_Binary::getInt
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:175
SUMOSAXAttributesImpl_Binary::hasAttribute
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list.
Definition: SUMOSAXAttributesImpl_Binary.cpp:159
SUMOSAXAttributesImpl_Binary::getFringeType
FringeType getFringeType(bool &ok) const
returns fringe type
Definition: SUMOSAXAttributesImpl_Binary.cpp:282
RightOfWay
RightOfWay
algorithms for computing right of way
Definition: SUMOXMLDefinitions.h:1104
SUMOSAXAttributes.h
SUMOSAXAttributesImpl_Binary::getNodeType
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:255
SUMOSAXAttributesImpl_Binary::getEdgeFunc
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:241
config.h
SUMOSAXAttributesImpl_Binary::operator=
SUMOSAXAttributesImpl_Binary & operator=(const SUMOSAXAttributesImpl_Binary &src)
Invalidated assignment operator.
SUMOSAXAttributesImpl_Binary::getName
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
Definition: SUMOSAXAttributesImpl_Binary.cpp:329
SUMOSAXAttributesImpl_Binary::myStringValues
std::map< int, std::string > myStringValues
Map of attribute ids to string.
Definition: SUMOSAXAttributesImpl_Binary.h:303
SUMOSAXAttributesImpl_Binary::getStringSecure
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.
Definition: SUMOSAXAttributesImpl_Binary.cpp:201
SUMOSAXAttributes
Encapsulated SAX-Attributes.
Definition: SUMOSAXAttributes.h:56
SUMOSAXAttributesImpl_Binary::SUMOSAXAttributesImpl_Binary
SUMOSAXAttributesImpl_Binary(const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType, BinaryInputDevice *in, const char version)
Constructor.
Definition: SUMOSAXAttributesImpl_Binary.cpp:40
BinaryInputDevice
Encapsulates binary reading operations on a file.
Definition: BinaryInputDevice.h:57
SUMOSAXAttributesImpl_Binary::getAttributeNames
std::vector< std::string > getAttributeNames() const
Retrieves all attribute names.
Definition: SUMOSAXAttributesImpl_Binary.cpp:346