SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SUMOSAXAttributesImpl_Binary.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // Encapsulated Xerces-SAX-attributes
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2007-2015 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);
66 
67 
70 
71 
72 
73 
76 
82  bool hasAttribute(int id) const;
83 
84 
100  bool getBool(int id) const;
101 
102 
118  int getInt(int id) const;
119 
120 
136  SUMOLong getLong(int id) const;
137 
138 
151  std::string getString(int id) const;
152 
165  std::string getStringSecure(int id,
166  const std::string& def) const;
167 
168 
184  SUMOReal getFloat(int id) const;
185 
186 
190  bool hasAttribute(const std::string& id) const;
191 
192 
208  SUMOReal getFloat(const std::string& id) const;
209 
210 
220  std::string getStringSecure(const std::string& id,
221  const std::string& def) const;
222  //}
223 
224 
231  SumoXMLEdgeFunc getEdgeFunc(bool& ok) const;
232 
233 
240  SumoXMLNodeType getNodeType(bool& ok) const;
241 
242 
249  RGBColor getColor() const;
250 
251 
257  PositionVector getShape(int attr) const;
258 
259 
265  Boundary getBoundary(int attr) const;
266 
272  std::vector<std::string> getStringVector(int attr) const;
273 
274 
282  std::string getName(int attr) const;
283 
284 
289  void serialize(std::ostream& os) const;
290 
291 
292 private:
294  const std::map<int, std::string>& myAttrIds;
295 
297  std::set<int> myAttrs;
298 
300  std::map<int, char> myCharValues;
301 
303  std::map<int, int> myIntValues;
304 
306  std::map<int, SUMOReal> myFloatValues;
307 
309  std::map<int, std::string> myStringValues;
310 
312  std::map<int, PositionVector> myPositionVectors;
313 
314 
315 private:
318 
321 
322 
323 };
324 
325 
326 #endif
327 
328 /****************************************************************************/
329 
void serialize(std::ostream &os) const
Prints all attribute names and values into the given stream.
PositionVector getShape(int attr) const
Tries to read given attribute assuming it is a PositionVector.
SUMOLong 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.
RGBColor getColor() const
Returns the value of the named attribute.
SumoXMLEdgeFunc getEdgeFunc(bool &ok) const
Returns the value of the named attribute.
std::string getName(int attr) const
Converts the given attribute id into a man readable string.
std::map< int, std::string > myStringValues
Map of attribute ids to string.
int getInt(int id) const
Returns the int-value of the named (by its enum-value) attribute.
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
SUMOReal getFloat(int id) const
Returns the SUMOReal-value of the named (by its enum-value) attribute.
std::string getStringSecure(int id, const std::string &def) 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.
std::vector< std::string > getStringVector(int attr) const
Tries to read given attribute assuming it is a string vector.
#define SUMOLong
Definition: config.h:215
std::map< int, SUMOReal > myFloatValues
Map of attribute ids to floats.
SumoXMLNodeType getNodeType(bool &ok) const
Returns the value of the named attribute.
SUMOSAXAttributesImpl_Binary(const std::map< int, std::string > &predefinedTagsMML, const std::string &objectType, BinaryInputDevice *in)
Constructor.
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 & operator=(const SUMOSAXAttributesImpl_Binary &src)
Invalidated assignment operator.
bool hasAttribute(int id) const
Returns the information whether the named (by its enum-value) attribute is within the current list...
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
#define SUMOReal
Definition: config.h:218
bool getBool(int id) const
Returns the bool-value of the named (by its enum-value) attribute.
Boundary getBoundary(int attr) const
Tries to read given attribute assuming it is a Boundary.
std::string getString(int id) const
Returns the string-value of the named (by its enum-value) attribute.
Encapsulates binary reading operations on a file.