EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Keyword.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Keyword.h
1
/* -------------------------------------------------------------------------- */
2
/* Keyword.h */
3
/* */
4
/* Definitions related to Keyword.cc code. */
5
/* */
6
/* A.Kisselev, PNPI, St.Petersburg, Russia. */
7
/* e-mail: kisselev@hermes.desy.de */
8
/* -------------------------------------------------------------------------- */
9
10
//
11
// Prefer to change logic as less as possible in this code -> use linked
12
// list of keywords and a friend function to declare keywords;
13
//
14
15
#ifndef _KEYWORD_H
16
#define _KEYWORD_H
17
18
// Command line arguments starting from this prefix are 'keywords';
19
#define _KEYWORD_PREFIX_ "--"
20
21
typedef
int (*
keywordfun
)(
int
argc,
char
**argv);
22
23
enum
MultipleInvocationMode
{
_MULTIPLE_INVOCATION_DISABLED_
,
_MULTIPLE_INVOCATION_ALLOWED_
};
24
25
class
Keyword
{
26
// Yes, just a friend function;
27
friend
Keyword
*
declare_keyword
(
Keyword
**root,
char
*_name,
int
_arg_num_min,
int
_arg_num_max,
28
keywordfun
_fun,
29
MultipleInvocationMode
_invocation_mode
/*= _MULTIPLE_INVOCATION_DISABLED_*/
);
30
public
:
31
// Constructor;
32
Keyword
(
char
*_name,
int
_arg_num_min,
int
_arg_num_max,
keywordfun
_fun,
33
MultipleInvocationMode
_invocation_mode);
34
35
// The actual parser;
36
int
parseCommandLine
(
int
argc,
char
**argv);
37
38
private
:
39
// Name of the command line key (like '--geometry');
40
char
*
name
;
41
// Expected min/max # of arguments (keyword itself excluded);
42
int
arg_num_min
,
arg_num_max
;
43
44
// Function to be called for this keyword;
45
keywordfun
fun
;
46
47
// Used to verify that the same key is not used twice in the same
48
// command line ...;
49
int
activated
;
50
// ... unless multiple invocation of this key is allowed;
51
MultipleInvocationMode
__multiple_invocation_mode
;
52
53
Keyword
*
next
;
54
} ;
55
56
#endif
EicRoot
blob
master
eic
ayk
Keyword.h
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:33
using
1.8.2 with
EIC GitHub integration