SUMO - Simulation of Urban MObility
SUMOSAXAttributesImpl_Binary.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Encapsulated xml-attributes that are retrieved from the sumo-binary-xml format (already typed)
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2007-2017 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef SUMOSAXAttributesImpl_Binary_h
23 #define SUMOSAXAttributesImpl_Binary_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <map>
36 #include <set>
37 #include "SUMOSAXAttributes.h"
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class BinaryInputDevice;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
56 public:
63  SUMOSAXAttributesImpl_Binary(const std::map<int, std::string>& predefinedTagsMML,
64  const std::string& objectType,
65  BinaryInputDevice* in, const char version);
66 
69 
70 
71 
72 
75 
81  bool hasAttribute(int id) const;
82 
83 
99  bool getBool(int id) const;
100 
101 
117  int getInt(int id) const;
118 
119 
135  long long int getLong(int id) const;
136 
137 
150  std::string getString(int id) const;
151 
164  std::string getStringSecure(int id,
165  const std::string& def) const;
166 
167 
183  double getFloat(int id) const;
184 
185 
189  bool hasAttribute(const std::string& id) const;
190 
191 
207  double getFloat(const std::string& id) const;
208 
209 
219  std::string getStringSecure(const std::string& id,
220  const std::string& def) const;
221  //}
222 
223 
230  SumoXMLEdgeFunc getEdgeFunc(bool& ok) const;
231 
232 
239  SumoXMLNodeType getNodeType(bool& ok) const;
240 
241 
248  RGBColor getColor() const;
249 
250 
256  PositionVector getShape(int attr) const;
257 
258 
264  Boundary getBoundary(int attr) const;
265 
271  std::vector<std::string> getStringVector(int attr) const;
272 
273 
281  std::string getName(int attr) const;
282 
283 
288  void serialize(std::ostream& os) const;
289 
291  SUMOSAXAttributes* clone() const;
292 
293 private:
295  const std::map<int, std::string>& myAttrIds;
296 
298  std::set<int> myAttrs;
299 
301  std::map<int, char> myCharValues;
302 
304  std::map<int, int> myIntValues;
305 
307  std::map<int, double> myFloatValues;
308 
310  std::map<int, std::string> myStringValues;
311 
313  std::map<int, PositionVector> myPositionVectors;
314 
315 
316 private:
319 
322 
323 
324 };
325 
326 
327 #endif
328 
329 /****************************************************************************/
330 
std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
long long int getLong(int id) const
Returns the long-value of the named (by its enum-value) attribute.
std::map< int, char > myCharValues
Map of attribute ids to char.
std::map< int, double > myFloatValues
Map of attribute ids to floats.
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list...
SUMOSAXAttributes * clone() const
return a new deep-copy attributes object
std::map< int, std::string > myStringValues
Map of attribute ids to string.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
std::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
Encapsulated SAX-Attributes.
const std::map< int, std::string > & myAttrIds
Map of attribute ids to names.
A list of positions.
RGBColor getColor() const
Returns the value of the named attribute.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
double getFloat(int id) const
Returns the double-value of the named (by its enum-value) attribute.
Encapsulated Xerces-SAX-attributes.
std::map< int, int > myIntValues
Map of attribute ids to integers.
std::map< int, PositionVector > myPositionVectors
Map of attribute ids to string.
std::set< int > myAttrs
the attributes which are set
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
SUMOSAXAttributesImpl_Binary(const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType, BinaryInputDevice *in, const char version)
Constructor.
SUMOSAXAttributesImpl_Binary & operator=(const SUMOSAXAttributesImpl_Binary &src)
Invalidated assignment operator.
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
Encapsulates binary reading operations on a file.
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
std::string getStringSecure(int id, const std::string &def) const
Returns the string-value of the named (by its enum-value) attribute.