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 /****************************************************************************/
17 // Encapsulated xml-attributes that are retrieved from the sumo-binary-xml format (already typed)
18 /****************************************************************************/
19 #ifndef SUMOSAXAttributesImpl_Binary_h
20 #define SUMOSAXAttributesImpl_Binary_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <map>
29 #include <set>
30 #include "SUMOSAXAttributes.h"
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class BinaryInputDevice;
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
49 public:
56  SUMOSAXAttributesImpl_Binary(const std::map<int, std::string>& predefinedTagsMML,
57  const std::string& objectType,
58  BinaryInputDevice* in, const char version);
59 
62 
63 
64 
65 
68 
74  bool hasAttribute(int id) const;
75 
76 
92  bool getBool(int id) const;
93 
94 
110  int getInt(int id) const;
111 
112 
128  long long int getLong(int id) const;
129 
130 
143  std::string getString(int id) const;
144 
157  std::string getStringSecure(int id,
158  const std::string& def) const;
159 
160 
176  double getFloat(int id) const;
177 
178 
182  bool hasAttribute(const std::string& id) const;
183 
184 
200  double getFloat(const std::string& id) const;
201 
202 
212  std::string getStringSecure(const std::string& id,
213  const std::string& def) const;
214  //}
215 
216 
223  SumoXMLEdgeFunc getEdgeFunc(bool& ok) const;
224 
225 
232  SumoXMLNodeType getNodeType(bool& ok) const;
233 
235  RightOfWay getRightOfWay(bool& ok) const;
236 
238  FringeType getFringeType(bool& ok) const;
239 
246  RGBColor getColor() const;
247 
248 
254  PositionVector getShape(int attr) const;
255 
256 
262  Boundary getBoundary(int attr) const;
263 
271  std::string getName(int attr) const;
272 
273 
278  void serialize(std::ostream& os) const;
279 
282  std::vector<std::string> getAttributeNames() const;
283 
285  SUMOSAXAttributes* clone() const;
286 
287 private:
289  const std::map<int, std::string>& myAttrIds;
290 
292  std::set<int> myAttrs;
293 
295  std::map<int, char> myCharValues;
296 
298  std::map<int, int> myIntValues;
299 
301  std::map<int, double> myFloatValues;
302 
304  std::map<int, std::string> myStringValues;
305 
307  std::map<int, PositionVector> myPositionVectors;
308 
309 
310 private:
313 
316 
317 
318 };
319 
320 
321 #endif
322 
323 /****************************************************************************/
324 
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::vector< std::string > getAttributeNames() const
Retrieves all attribute names.
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
RightOfWay getRightOfWay(bool &ok) const
returns rightOfWay method
std::map< int, std::string > myStringValues
Map of attribute ids to string.
RightOfWay
algorithms for computing right of way
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
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.
FringeType getFringeType(bool &ok) const
returns fringe type
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.
FringeType
algorithms for computing right of way
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.