Gaudi Framework, version v24r2
Home
Generated: Wed Dec 4 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiKernel
GaudiKernel
Parsers.h
Go to the documentation of this file.
1
// ============================================================================
2
#ifndef GAUDIPROPERTYPARSERS_PARSERS_H
3
#define GAUDIPROPERTYPARSERS_PARSERS_H 1
4
// ============================================================================
5
// Include files
6
// ============================================================================
7
// STD & STL
8
// ============================================================================
9
#include <
string
>
10
#include <
vector
>
11
#include <
list
>
12
#include <
set
>
13
#include <
map
>
14
15
// ============================================================================
16
#include "
GaudiKernel/StatusCode.h
"
17
#include "
GaudiKernel/HistoDef.h
"
18
19
#define PARSERS_DECL_FOR_SINGLE(Type)\
20
GAUDI_API StatusCode parse(Type& result, const std::string& input);
21
22
#define PARSERS_DECL_FOR_PAIR(FirstType, SecondType)\
23
GAUDI_API StatusCode parse(std::pair<FirstType, SecondType >& result,\
24
const std::string& input);
25
26
#define PARSERS_DECL_FOR_LIST(InnerType)\
27
GAUDI_API StatusCode parse(std::vector<InnerType>& result,\
28
const std::string& input);
29
// ============================================================================
61
// ============================================================================
62
namespace
Gaudi
63
{
64
// ==========================================================================
65
class
Histo1DDef ;
66
// ==========================================================================
67
namespace
Parsers
68
{
69
// ========================================================================
80
PARSERS_DECL_FOR_SINGLE
(
bool
)
81
// ========================================================================
93
PARSERS_DECL_FOR_SINGLE
(
char
)
95
PARSERS_DECL_FOR_SINGLE
(
unsigned
char
)
97
PARSERS_DECL_FOR_SINGLE
(
signed
char
)
98
// ========================================================================
110
PARSERS_DECL_FOR_SINGLE
(
int
)
112
PARSERS_DECL_FOR_SINGLE
(
short
)
114
PARSERS_DECL_FOR_SINGLE
(
unsigned
short
)
116
PARSERS_DECL_FOR_SINGLE
(
unsigned
int
)
118
PARSERS_DECL_FOR_SINGLE
(
long
)
120
PARSERS_DECL_FOR_SINGLE
(
unsigned
long
)
122
PARSERS_DECL_FOR_SINGLE
(
long
long
)
124
PARSERS_DECL_FOR_SINGLE
(
unsigned
long
long
)
125
// ========================================================================
137
PARSERS_DECL_FOR_SINGLE
(
double
)
139
PARSERS_DECL_FOR_SINGLE
(
float
)
141
PARSERS_DECL_FOR_SINGLE
(
long
double
)
142
// ========================================================================
154
PARSERS_DECL_FOR_SINGLE
(
std::string
)
155
// ========================================================================
156
157
PARSERS_DECL_FOR_LIST
(
bool
)
158
PARSERS_DECL_FOR_LIST
(
char
)
159
PARSERS_DECL_FOR_LIST
(
unsigned
char
)
160
PARSERS_DECL_FOR_LIST
(
signed
char
)
161
162
PARSERS_DECL_FOR_LIST
(
int
)
163
PARSERS_DECL_FOR_LIST
(
short
)
164
PARSERS_DECL_FOR_LIST
(
unsigned
short
)
165
PARSERS_DECL_FOR_LIST
(
unsigned
int
)
166
PARSERS_DECL_FOR_LIST
(
long
)
167
PARSERS_DECL_FOR_LIST
(
unsigned
long
)
168
PARSERS_DECL_FOR_LIST
(
long
long
)
169
PARSERS_DECL_FOR_LIST
(
unsigned
long
long
)
170
171
PARSERS_DECL_FOR_LIST
(
double
)
172
PARSERS_DECL_FOR_LIST
(
float
)
173
PARSERS_DECL_FOR_LIST
(
long
double
)
174
175
PARSERS_DECL_FOR_LIST
(
std::string
)
176
// ========================================================================
177
// Advanced parses
178
// ========================================================================
191
PARSERS_DECL_FOR_PAIR
(
double
,
double
)
192
// ========================================================================
205
PARSERS_DECL_FOR_PAIR
(
int
,
int
)
206
// ========================================================================
220
GAUDI_API
StatusCode
parse
221
(
std::vector
<
std::pair<double,double>
>& result ,
222
const
std::string
& input ) ;
223
// ========================================================================
237
GAUDI_API
StatusCode
parse
238
(
std::vector
<
std::pair<int,int>
>& result ,
239
const
std::string
& input ) ;
240
// ========================================================================
241
// vector< vector< TYPE > >
242
// ========================================================================
255
GAUDI_API
StatusCode
parse
256
(
std::vector
<
std::vector<std::string>
>& result ,
257
const
std::string
& input ) ;
258
// ========================================================================
271
GAUDI_API
StatusCode
parse
272
(
std::vector
<
std::vector<double>
>& result ,
273
const
std::string
& input ) ;
274
// ========================================================================
275
// map< TYPE, TYPE >
276
// ========================================================================
289
GAUDI_API
StatusCode
parse
290
(
std::map< int , int >
& result ,
291
const
std::string
& input ) ;
292
// ========================================================================
306
GAUDI_API
StatusCode
parse
307
(
std::map< int , double >
& result ,
308
const
std::string
& input ) ;
309
// ========================================================================
322
GAUDI_API
StatusCode
parse
323
(
std::map< std::string , std::string >
& result ,
324
const
std::string
& input ) ;
325
// ========================================================================
339
GAUDI_API
StatusCode
parse
340
(
std::map< std::string , int >
& result ,
341
const
std::string
& input ) ;
342
// ========================================================================
356
GAUDI_API
StatusCode
parse
357
(
std::map< std::string , double >
& result ,
358
const
std::string
& input ) ;
359
// ========================================================================
375
GAUDI_API
StatusCode
parse
376
(
std::map
<
std::string
,
std::vector< std::string>
>& result ,
377
const
std::string
& input ) ;
378
// ========================================================================
394
GAUDI_API
StatusCode
parse
395
(
std::map
<
std::string
,
std::vector< int >
>& result ,
396
const
std::string
& input ) ;
397
// ========================================================================
413
GAUDI_API
StatusCode
parse
414
(
std::map
<
std::string
,
std::vector< double >
>& result ,
415
const
std::string
& input ) ;
416
// ========================================================================
424
GAUDI_API
StatusCode
parse
425
(
std::map<int, std::string>
& result ,
426
const
std::string
& input ) ;
427
// ========================================================================
435
GAUDI_API
StatusCode
parse
436
(
std::map<unsigned int, std::string>
& result ,
437
const
std::string
& input ) ;
438
// ========================================================================
443
GAUDI_API
StatusCode
parse
444
(
std::map<std::string, unsigned int>
& result ,
445
const
std::string
& input ) ;
446
// ========================================================================
473
GAUDI_API
StatusCode
parse
474
(
std::string
& name ,
475
std::string
& value ,
476
const
std::string
& input ) ;
477
// ========================================================================
486
GAUDI_API
StatusCode
parse
487
( Gaudi::Histo1DDef& histo ,
488
const
std::string
& input ) ;
489
// ========================================================================
498
GAUDI_API
StatusCode
parse
499
(
std::map<std::string,Gaudi::Histo1DDef>
&
histos
,
500
const
std::string
& input ) ;
501
// ========================================================================
513
GAUDI_API
StatusCode
parse
514
(
std::map
<
std::string
,
std::pair<double,double>
>& params ,
515
const
std::string
& input ) ;
516
// ========================================================================
524
template
<
class
T,
unsigned
int
N>
525
StatusCode
parse
( T(&result)[
N
] ,
const
std::string
& input )
526
{
527
typedef
std::vector<T>
_Vct ;
528
// create the temporary vector
529
_Vct tmp ;
530
StatusCode
sc
=
parse
( tmp , input ) ;
531
if
( sc.
isFailure
() ) {
return
sc
; }
// RETURN
532
if
( N != tmp.size() ) {
return
StatusCode::FAILURE
; }
// RETURN
533
//
534
std::copy
( tmp.begin() , tmp.end() , result ) ;
535
//
536
return
StatusCode::SUCCESS
;
// RETURN
537
}
538
// ========================================================================
546
template
<
unsigned
int
N>
547
StatusCode
parse
(
char
(&result)[
N
] ,
const
std::string
& input )
548
{
549
// clear the string
550
std::fill_n
( result , N ,
' '
) ;
551
// create the temporary string
552
std::string
tmp ;
553
StatusCode
sc
=
parse
( tmp , input ) ;
554
if
( sc.
isFailure
() ) {
return
sc
; }
// RETURN
555
if
( N == tmp.size() )
556
{
std::copy
( tmp.begin() , tmp.end() , result ) ; }
557
else
if
( N + 2 == tmp.size() &&
558
(
'\''
== tmp[0] ||
'\"'
== tmp[0] ) &&
559
( tmp[0] == tmp[tmp.size()-1] ))
560
{
std::copy
( tmp.begin() + 1 , tmp.end() -1 , result ) ; }
561
else
{
return
StatusCode::FAILURE
; }
562
//
563
return
StatusCode::SUCCESS
;
// RETURN
564
}
565
// ========================================================================
566
}
// end of namespace Gaudi::Parsers
567
// ==========================================================================
568
}
// end of namespace Gaudi
569
// ============================================================================
570
// The END
571
// ============================================================================
572
#endif //GAUDIPROPERTYPARSERS_PARSERS_H
573
// ============================================================================
Generated at Wed Dec 4 2013 14:33:09 for Gaudi Framework, version v24r2 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004