SUMO - Simulation of Urban MObility
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SUMOSAXAttributes.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// Encapsulated SAX-Attributes
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
12
// Copyright (C) 2001-2012 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 SUMOSAXAttributes_h
23
#define SUMOSAXAttributes_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 <string>
36
#include <vector>
37
38
#include <
utils/common/SUMOTime.h
>
39
#include <
utils/common/UtilExceptions.h
>
40
#include "
SUMOXMLDefinitions.h
"
41
42
43
// ===========================================================================
44
// class declarations
45
// ===========================================================================
46
class
PositionVector
;
47
class
Boundary
;
48
class
RGBColor
;
49
50
51
// ===========================================================================
52
// class definitions
53
// ===========================================================================
62
class
SUMOSAXAttributes
{
63
public
:
64
/* @brief Constructor
65
* @param[in] tagName The name of the parsed object type; used for error message generation
66
*/
67
SUMOSAXAttributes
(
const
std::string& objectType);
68
69
71
virtual
~SUMOSAXAttributes
() { }
72
73
87
int
getIntReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
88
bool
report =
true
)
const
;
89
90
106
int
getOptIntReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
107
int
defaultValue,
bool
report =
true
)
const
;
108
109
110
124
SUMOLong
getLongReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
125
bool
report =
true
)
const
;
126
127
128
142
SUMOReal
getSUMORealReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
143
bool
report =
true
)
const
;
144
145
146
162
SUMOReal
getOptSUMORealReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
163
SUMOReal
defaultValue,
bool
report =
true
)
const
;
164
165
166
180
bool
getBoolReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
181
bool
report =
true
)
const
;
182
183
184
200
bool
getOptBoolReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
201
bool
defaultValue,
bool
report =
true
)
const
;
202
203
204
218
std::string
getStringReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
219
bool
report =
true
)
const
;
220
221
222
238
std::string
getOptStringReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
239
const
std::string& defaultValue,
bool
report =
true
)
const
;
240
241
242
259
SUMOTime
getSUMOTimeReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
260
bool
report =
true
)
const
;
261
262
263
282
SUMOTime
getOptSUMOTimeReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
283
SUMOTime
defaultValue,
bool
report =
true
)
const
;
284
285
286
287
288
289
290
291
294
300
virtual
bool
hasAttribute
(
int
id
)
const
= 0;
301
302
308
virtual
bool
hasAttribute
(
const
std::string&
id
)
const
= 0;
309
310
326
virtual
bool
getBool
(
int
id
)
const
throw
(
EmptyData
,
BoolFormatException
) = 0;
327
342
virtual
bool
getBoolSecure
(
int
id
,
bool
val)
const
throw
(
EmptyData
) = 0;
343
344
360
virtual
int
getInt
(
int
id
)
const
= 0;
361
362
378
virtual
SUMOLong
getLong
(
int
id
)
const
= 0;
379
380
398
virtual
int
getIntSecure
(
int
id
,
int
def)
const
= 0;
399
400
413
virtual
std::string
getString
(
int
id
)
const
throw
(
EmptyData
) = 0;
414
415
428
virtual
std::string
getStringSecure
(
int
id
,
429
const
std::string& def)
const
throw
(
EmptyData
) = 0;
430
431
447
virtual
SUMOReal
getFloat
(
int
id
)
const
= 0;
448
466
virtual
SUMOReal
getFloatSecure
(
int
id
,
SUMOReal
def)
const
= 0;
467
468
484
virtual
SUMOReal
getFloat
(
const
std::string&
id
)
const
= 0;
485
486
496
virtual
std::string
getStringSecure
(
const
std::string&
id
,
497
const
std::string& def)
const
= 0;
498
//}
499
500
507
virtual
SumoXMLEdgeFunc
getEdgeFunc
(
bool
& ok)
const
= 0;
508
509
516
virtual
SumoXMLNodeType
getNodeType
(
bool
& ok)
const
= 0;
517
518
525
virtual
RGBColor
getColorReporting
(
const
char
* objectid,
bool
& ok)
const
= 0;
526
527
541
virtual
PositionVector
getShapeReporting
(
int
attr,
const
char
* objectid,
bool
& ok,
542
bool
allowEmpty)
const
= 0;
543
557
virtual
Boundary
getBoundaryReporting
(
int
attr,
const
char
* objectid,
bool
& ok)
const
= 0;
558
564
virtual
std::string
getName
(
int
attr)
const
= 0;
565
566
571
virtual
void
serialize
(std::ostream& os)
const
= 0;
572
573
582
static
void
parseStringVector
(
const
std::string& def, std::vector<std::string>& into);
583
584
586
const
std::string&
getObjectType
()
const
{
587
return
myObjectType
;
588
}
589
590
591
friend
std::ostream&
operator<<
(std::ostream& os,
const
SUMOSAXAttributes
& src);
592
594
static
const
std::string
ENCODING
;
595
596
597
protected
:
598
void
emitUngivenError
(
const
std::string& attrname,
const
char
* objectid)
const
;
599
void
emitEmptyError
(
const
std::string& attrname,
const
char
* objectid)
const
;
600
void
emitFormatError
(
const
std::string& attrname,
const
std::string& type,
const
char
* objectid)
const
;
601
602
private
:
604
static
bool
myHaveInformedAboutDeprecatedDivider
;
605
606
private
:
608
SUMOSAXAttributes
(
const
SUMOSAXAttributes
& src);
609
611
SUMOSAXAttributes
&
operator=
(
const
SUMOSAXAttributes
& src);
612
614
std::string
myObjectType
;
615
616
};
617
618
619
inline
std::ostream&
operator<<
(std::ostream& os,
const
SUMOSAXAttributes
& src) {
620
src.
serialize
(os);
621
return
os;
622
}
623
624
625
#endif
626
627
/****************************************************************************/
628
build
buildd
sumo-0.16.0~dfsg
src
utils
xml
SUMOSAXAttributes.h
Generated on Tue Apr 16 2013 01:32:21 for SUMO - Simulation of Urban MObility by
1.8.3.1