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
Option.h
Go to the documentation of this file.
1
/****************************************************************************/
9
// Classes representing a single program option (with different types)
10
/****************************************************************************/
11
// SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
12
// Copyright (C) 2001-2014 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 Option_h
23
#define Option_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
#include <exception>
38
#include <
utils/common/UtilExceptions.h
>
39
40
41
// ===========================================================================
42
// class definitions
43
// ===========================================================================
48
typedef
std::vector<int>
IntVector
;
49
50
51
/* -------------------------------------------------------------------------
52
* Option
53
* ----------------------------------------------------------------------- */
79
class
Option
{
80
public
:
82
virtual
~Option
();
83
84
88
bool
isSet
()
const
;
89
90
93
void
unSet
();
94
95
104
virtual
SUMOReal
getFloat
()
const
;
105
106
115
virtual
int
getInt
()
const
;
116
117
126
virtual
std::string
getString
()
const
;
127
128
137
virtual
bool
getBool
()
const
;
138
139
148
virtual
const
IntVector
&
getIntVector
()
const
;
149
150
170
virtual
bool
set
(
const
std::string& v) = 0;
171
172
179
virtual
std::string
getValueString
()
const
= 0;
180
181
188
virtual
bool
isBool
()
const
;
189
190
195
virtual
bool
isDefault
()
const
;
196
197
204
virtual
bool
isFileName
()
const
;
205
206
214
bool
isWriteable
()
const
;
215
216
222
void
resetWritable
();
223
224
231
const
std::string&
getDescription
()
const
;
232
233
240
void
setDescription
(
const
std::string& desc);
241
242
249
virtual
const
std::string&
getTypeName
()
const
;
250
251
252
protected
:
259
bool
markSet
();
260
261
262
protected
:
270
Option
(
bool
set
=
false
);
271
272
274
Option
(
const
Option
& s);
275
276
278
virtual
Option
&
operator=
(
const
Option
& s);
279
280
281
protected
:
283
std::string
myTypeName
;
284
285
286
private
:
288
bool
myAmSet
;
289
291
bool
myHaveTheDefaultValue
;
292
294
bool
myAmWritable
;
295
297
std::string
myDescription
;
298
299
};
300
301
302
/* -------------------------------------------------------------------------
303
* Option_Integer
304
* ----------------------------------------------------------------------- */
309
class
Option_Integer
:
public
Option
{
310
public
:
315
Option_Integer
();
316
317
324
Option_Integer
(
int
value);
325
326
328
Option_Integer
(
const
Option_Integer
& s);
329
330
332
~Option_Integer
();
333
334
336
Option_Integer
&
operator=
(
const
Option_Integer
& s);
337
338
343
int
getInt
()
const
;
344
345
361
bool
set
(
const
std::string& v);
362
363
371
std::string
getValueString
()
const
;
372
373
374
private
:
376
int
myValue
;
377
378
};
379
380
381
/* -------------------------------------------------------------------------
382
* Option_String
383
* ----------------------------------------------------------------------- */
384
class
Option_String
:
public
Option
{
385
public
:
390
Option_String
();
391
392
399
Option_String
(
const
std::string& value, std::string typeName =
"STR"
);
400
401
403
Option_String
(
const
Option_String
& s);
404
405
407
virtual
~Option_String
();
408
409
411
Option_String
&
operator=
(
const
Option_String
& s);
412
413
418
std::string
getString
()
const
;
419
420
432
bool
set
(
const
std::string& v);
433
434
442
std::string
getValueString
()
const
;
443
444
445
protected
:
447
std::string
myValue
;
448
449
};
450
451
452
/* -------------------------------------------------------------------------
453
* Option_Float
454
* ----------------------------------------------------------------------- */
455
class
Option_Float
:
public
Option
{
456
public
:
461
Option_Float
();
462
463
470
Option_Float
(
SUMOReal
value);
471
472
474
Option_Float
(
const
Option_Float
& s);
475
476
478
~Option_Float
();
479
480
482
Option_Float
&
operator=
(
const
Option_Float
& s);
483
484
489
SUMOReal
getFloat
()
const
;
490
491
507
bool
set
(
const
std::string& v);
508
509
517
std::string
getValueString
()
const
;
518
519
520
private
:
522
SUMOReal
myValue
;
523
524
};
525
526
527
/* -------------------------------------------------------------------------
528
* Option_Bool
529
* ----------------------------------------------------------------------- */
530
class
Option_Bool
:
public
Option
{
531
public
:
536
Option_Bool
();
537
538
545
Option_Bool
(
bool
value);
546
547
549
Option_Bool
(
const
Option_Bool
& s);
550
551
553
~Option_Bool
();
554
555
557
Option_Bool
&
operator=
(
const
Option_Bool
& s);
558
559
564
bool
getBool
()
const
;
565
567
bool
set
(
const
std::string& v);
568
569
577
std::string
getValueString
()
const
;
578
579
587
bool
isBool
()
const
;
588
589
590
private
:
592
bool
myValue
;
593
594
};
595
596
597
/* -------------------------------------------------------------------------
598
* Option_FileName
599
* ----------------------------------------------------------------------- */
600
class
Option_FileName
:
public
Option_String
{
601
public
:
604
Option_FileName
();
605
606
611
Option_FileName
(
const
std::string& value);
612
613
615
Option_FileName
(
const
Option_String
& s);
616
617
619
virtual
~Option_FileName
();
620
622
Option_FileName
&
operator=
(
const
Option_FileName
& s);
623
624
631
bool
isFileName
()
const
;
632
633
};
634
635
636
/* -------------------------------------------------------------------------
637
* Option_IntVector
638
* ----------------------------------------------------------------------- */
639
class
Option_IntVector
:
public
Option
{
640
public
:
643
Option_IntVector
();
644
645
650
Option_IntVector
(
const
IntVector
& value);
651
652
654
Option_IntVector
(
const
Option_IntVector
& s);
655
656
658
virtual
~Option_IntVector
();
659
660
662
Option_IntVector
&
operator=
(
const
Option_IntVector
& s);
663
664
669
const
IntVector
&
getIntVector
()
const
;
670
671
687
bool
set
(
const
std::string& v);
688
689
697
std::string
getValueString
()
const
;
698
699
700
private
:
702
IntVector
myValue
;
703
};
704
705
706
#endif
707
708
/****************************************************************************/
709
tmp
buildd
sumo-0.21.0+dfsg
src
utils
options
Option.h
Generated on Thu Nov 20 2014 19:49:58 for SUMO - Simulation of Urban MObility by
1.8.1.2