Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
JetScapeXML.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file JetScapeXML.h
1
/*******************************************************************************
2
* Copyright (c) The JETSCAPE Collaboration, 2018
3
*
4
* Modular, task-based framework for simulating all aspects of heavy-ion collisions
5
*
6
* For the list of contributors see AUTHORS.
7
*
8
* Report issues at https://github.com/JETSCAPE/JETSCAPE/issues
9
*
10
* or via email to bugs.jetscape@gmail.com
11
*
12
* Distributed under the GNU General Public License 3.0 (GPLv3 or later).
13
* See COPYING for details.
14
******************************************************************************/
15
16
#ifndef JETSCAPEXML_H
17
#define JETSCAPEXML_H
18
19
#include <iostream>
20
#include <string>
21
#include <stdexcept>
22
#include <initializer_list>
23
24
#include "
tinyxml2.h
"
25
34
using
std::string
;
35
using
std::runtime_error;
36
37
namespace
Jetscape {
38
39
class
JetScapeXML
{
40
41
public
:
42
static
JetScapeXML
*
Instance
();
43
44
// Master file: These functions are deprecated. Users should use the Main functions instead.
45
// These functions have been updated to use the 'main' instead of 'master' variables
46
47
tinyxml2::XMLElement
*
GetXMLRootMaster
() {
return
xml_root_main
; }
48
tinyxml2::XMLDocument
&
GetXMLDocumentMaster
() {
return
xml_doc_main
; }
49
tinyxml2::XMLElement
*
50
GetXMLElementMaster
(std::initializer_list<const char *> &
path
);
51
52
void
SetXMLMasterFileName
(
string
m_name
) {
xml_main_file_name
=
m_name
; }
53
std::string
GetXMLMasterFileName
() {
return
xml_main_file_name
; }
54
bool
IsMasterFileOpen
() {
return
xml_main_file_open
; }
55
56
void
OpenXMLMasterFile
();
57
void
OpenXMLMasterFile
(
string
m_name
);
58
59
// Main file:
60
61
tinyxml2::XMLElement
*
GetXMLRootMain
()
const
{
return
xml_root_main
; }
62
tinyxml2::XMLDocument
&
GetXMLDocumentMain
() {
return
xml_doc_main
; }
63
tinyxml2::XMLElement
*
64
GetXMLElementMain
(std::initializer_list<const char *> &
path
);
65
66
void
SetXMLMainFileName
(
string
m_name
) {
xml_main_file_name
=
m_name
; }
67
std::string
GetXMLMainFileName
()
const
{
return
xml_main_file_name
; }
68
bool
IsMainFileOpen
()
const
{
return
xml_main_file_open
; }
69
70
void
OpenXMLMainFile
();
71
void
OpenXMLMainFile
(
string
m_name
);
72
73
// User file
74
75
tinyxml2::XMLElement
*
GetXMLRootUser
() {
return
xml_root_user
; }
76
tinyxml2::XMLDocument
&
GetXMLDocumentUser
() {
return
xml_doc_user
; }
77
tinyxml2::XMLElement
*
78
GetXMLElementUser
(std::initializer_list<const char *> &
path
);
79
80
void
SetXMLUserFileName
(
string
m_name
) {
xml_user_file_name
=
m_name
; }
81
std::string
GetXMLUserFileName
() {
return
xml_user_file_name
; }
82
bool
IsUserFileOpen
() {
return
xml_user_file_open
; }
83
84
void
OpenXMLUserFile
();
85
void
OpenXMLUserFile
(
string
m_name
);
86
87
// Helper functions for XML parsing/
88
// Look first in user XML file for a parameter, and if not found look in the main XML file.
89
tinyxml2::XMLElement
*
GetElement
(std::initializer_list<const char *>
path
,
90
bool
isRequired =
true
);
91
std::string
GetElementText
(std::initializer_list<const char *>
path
,
92
bool
isRequired =
true
);
93
int
GetElementInt
(std::initializer_list<const char *>
path
,
94
bool
isRequired =
true
);
95
double
GetElementDouble
(std::initializer_list<const char *>
path
,
96
bool
isRequired =
true
);
97
98
private
:
99
JetScapeXML
() {
100
xml_main_file_name
=
""
;
101
xml_main_file_open
=
false
;
102
xml_user_file_name
=
""
;
103
xml_user_file_open
=
false
;
104
};
105
JetScapeXML
(
JetScapeXML
const
&){};
106
static
JetScapeXML
*
m_pInstance
;
107
108
// Main file
109
110
tinyxml2::XMLElement
*
111
xml_root_main
;
//use unique pointer here instead of raw pointer (check with tinyxml interface)
112
tinyxml2::XMLDocument
xml_doc_main
;
113
114
std::string
xml_main_file_name
;
115
bool
xml_main_file_open
;
116
117
// User file
118
119
tinyxml2::XMLElement
*
120
xml_root_user
;
//use unique pointer here instead of raw pointer (check with tinyxml interface)
121
tinyxml2::XMLDocument
xml_doc_user
;
122
123
std::string
xml_user_file_name
;
124
bool
xml_user_file_open
;
125
};
126
127
// Print the XML element path name
128
std::ostream &
operator<<
(std::ostream &
os
,
129
std::initializer_list<const char *>
path
);
130
131
}
// end namespace Jetscape
132
133
#endif
JETSCAPE
blob
main
src
framework
JetScapeXML.h
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:25
using
1.8.2 with
sPHENIX GitHub integration