ATLAS Offline Software
Database
APR
CollectionUtilities
CollectionUtilities
ArgQual.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef UTILITIES_COLLECTION_ARGQUAL
6
#define UTILITIES_COLLECTION_ARGQUAL
7
8
#include <string>
9
#include <iostream>
10
#include <sstream>
11
#include <vector>
12
#include <map>
13
#include <algorithm>
14
15
/**********************************************************
16
17
ArgQual is a class version of a struct
18
19
Purpose: Contain all information on the state of
20
input for a command line argument qualifier
21
22
argsize: cardinality of the qualifier arguments
23
multiarg: whether there can be multiple units
24
of the cardinality
25
required: whether the argument is required
26
desc: a string stream with a readable description
27
of the qualifier and it's defaults
28
29
Example of Usage with CmdLineArgs2:
30
31
Args2Container argsVec(thisProgram);
32
33
QualList markers;
34
markers.insert( make_pair("-somequal", ArgQual()) );
35
markers["-somequal"].desc << "this is a qualifier with default=this";
36
37
CmdLineArgs2 cmdLineArgs;
38
cmdLineArgs.setArgQuals(markers);
39
cmdLineArgs.evalArgs(argc,argv);
40
argsVec.push_back(&cmdLineArgs); // Add it to the list
41
42
...
43
44
% someProgram.exe -somequal thisval
45
46
**********************************************************/
47
namespace
pool
48
{
49
class
ArgQual
50
{
51
public
:
52
ArgQual
() :
argsize
(1),
multiarg
(false),
required
(false) {}
53
54
ArgQual
(
int
i
,
bool
b
=
false
,
bool
r
=
false
) :
argsize
(
i
),
55
multiarg
(
b
),
56
required
(
r
)
57
{}
58
59
ArgQual
(
const
std::string&
d
,
int
i
,
bool
b
=
false
,
bool
r
=
false
)
60
:
argsize
(
i
),
61
multiarg
(
b
),
62
required
(
r
)
63
{
64
desc
<<
d
;
65
}
66
67
ArgQual
(
const
ArgQual
&
a
) { *
this
=
a
; }
68
69
ArgQual
&
operator =
(
const
ArgQual
&
r
) {
70
if
(
this
!= &
r
) {
71
argsize
=
r
.argsize;
72
multiarg
=
r
.multiarg;
73
required
=
r
.required;
74
desc
.clear();
desc
<<
r
.desc.str();
75
}
76
return
*
this
;
77
}
78
79
int
argsize
;
80
bool
multiarg
;
81
bool
required
;
82
std::stringstream
desc
;
83
84
void
print
(std::ostream&)
const
;
85
86
friend
std::ostream&
operator<<
(std::ostream& theStream,
ArgQual
& rhs);
87
};
88
89
typedef
std::map<std::string,ArgQual>
QualList
;
90
}
91
92
#endif // UTILITIES_COLLECTION_ARGQUAL
93
94
95
beamspotman.r
def r
Definition:
beamspotman.py:676
pool::ArgQual::operator=
ArgQual & operator=(const ArgQual &r)
Definition:
ArgQual.h:131
hist_file_dump.d
d
Definition:
hist_file_dump.py:137
pool::ArgQual::argsize
int argsize
Definition:
ArgQual.h:141
pool
pool namespace
Definition:
libname.h:15
pool::ArgQual::ArgQual
ArgQual()
Definition:
ArgQual.h:114
pool::ArgQual::print
void print(std::ostream &) const
lumiFormat.i
int i
Definition:
lumiFormat.py:85
pool::ArgQual::multiarg
bool multiarg
Definition:
ArgQual.h:142
plotBeamSpotMon.b
b
Definition:
plotBeamSpotMon.py:77
pool::ArgQual::operator<<
friend std::ostream & operator<<(std::ostream &theStream, ArgQual &rhs)
pool::QualList
std::map< std::string, ArgQual > QualList
Definition:
ArgQual.h:120
a
TList * a
Definition:
liststreamerinfos.cxx:10
pool::ArgQual::required
bool required
Definition:
ArgQual.h:143
pool::ArgQual
Definition:
ArgQual.h:81
pool::ArgQual::desc
std::stringstream desc
Definition:
ArgQual.h:144
Generated on Thu Jan 2 2025 21:07:04 for ATLAS Offline Software by
1.8.18