-
Notifications
You must be signed in to change notification settings - Fork 22
/
test_lookup3.cc
114 lines (60 loc) · 1.92 KB
/
test_lookup3.cc
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
// ** Copyright UCAR (c) 1992 - 2021
// ** University Corporation for Atmospheric Research (UCAR)
// ** National Center for Atmospheric Research (NCAR)
// ** Research Applications Lab (RAL)
// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
////////////////////////////////////////////////////////////////////////
static const bool debug = false;
static const char input_filename [] = "john";
////////////////////////////////////////////////////////////////////////
using namespace std;
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <cmath>
#include "vx_util.h"
#include "config_file.h"
////////////////////////////////////////////////////////////////////////
static ConcatString program_name;
static MetConfig config;
////////////////////////////////////////////////////////////////////////
int main(int argc, char * argv [])
{
program_name = get_short_name(argv[0]);
//
// redirect stderr to stdout
//
if ( dup2(1, 2) < 0 ) {
cerr << "\n\n " << program_name << ": dup2 failed\n\n";
exit ( 1 );
}
config.set_debug(debug);
bool status = false;
status = config.read(input_filename);
if ( ! status ) {
cerr << "\n\n " << program_name << ": failed to parse config file \"" << input_filename << "\"\n\n";
exit ( 1 );
}
// config.dump(cout);
//
// test
//
const DictionaryEntry * e = config.lookup("fcst.field");
Dictionary * f = e->array_value();
const DictionaryEntry * ee = f->operator[](2);
Dictionary * ff = ee->dict_value();
const DictionaryEntry * eee = ff->lookup("GRIB1_ptv");
if ( ! eee ) {
cerr << "\n\n " << program_name << ": lookup failed!\n\n";
exit ( 1 );
}
eee->dump(cout);
cout << "\n\n";
//
// done
//
return ( 0 );
}
////////////////////////////////////////////////////////////////////////