-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathprintInfo.cpp
More file actions
55 lines (48 loc) · 1.22 KB
/
printInfo.cpp
File metadata and controls
55 lines (48 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <mdsobjects.h>
int main(int argc, char *argv[])
{
if(argc < 4)
{
std::cout << "Usage: " << argv[0] << " <directory> < pulse> < run>" << std::endl;
exit(0);
}
int pulse, run;
#ifdef WIN32
char szEnv[256] = { 0 };
sprintf(szEnv, "ids_path=%s", argv[1]);
putenv(szEnv);
#else // WIN32
setenv("ids_path",argv[1],1);
#endif // WIN32
sscanf(argv[2], "%d", &pulse);
sscanf(argv[3], "%d", &run);
int mdsPulse = (pulse * 10000) + (run%10000);
MDSplus::Tree *tree;
try
{
tree = new MDSplus::Tree("ids", mdsPulse);
}
catch(MDSplus::MdsException &exc)
{
std::cout << "Cannot open pulse file: " << exc.what() << std::endl;
exit(0);
}
MDSplus::TreeNode *n1, *n2;
char *d1, *d2;
try
{
n1 = tree->getNode("VERSION:ACC_LAYER");
d1 = n1->data()->getString();
n2 = tree->getNode("VERSION:DATA_DICT");
d2 = n2->data()->getString();
}
catch(MDSplus::MdsException &exc)
{
std::cout << "Cannot get Access Layer and Data Dictionary versions. Pulse file maybe too old." << std::endl;
exit(0);
}
std::cout << "This MDS+ file has been created with the following versions of IMAS:" << std::endl;
std::cout << "Access Layer: " << d1 << std::endl;
std::cout << "Data Dictionary: " << d2 << std::endl;
return 0;
}