HIPO4 C++ Library 4.4.1
Columnar I/O library for CLAS12 physics data
Loading...
Searching...
No Matches
jsonutil.h
Go to the documentation of this file.
1//******************************************************************************
2//* ██╗ ██╗██╗██████╗ ██████╗ ██╗ ██╗ ██████╗ *
3//* ██║ ██║██║██╔══██╗██╔═══██╗ ██║ ██║ ██╔═████╗ *
4//* ███████║██║██████╔╝██║ ██║ ███████║ ██║██╔██║ *
5//* ██╔══██║██║██╔═══╝ ██║ ██║ ╚════██║ ████╔╝██║ *
6//* ██║ ██║██║██║ ╚██████╔╝ ██║██╗╚██████╔╝ *
7//* ╚═╝ ╚═╝╚═╝╚═╝ ╚═════╝ ╚═╝╚═╝ ╚═════╝ *
8//************************ Jefferson National Lab (2017) ***********************
9/*
10 * Copyright (c) 2017. Jefferson Lab (JLab). All rights reserved. Permission
11 * to use, copy, modify, and distribute this software and its documentation
12 * for educational, research, and not-for-profit purposes, without fee and
13 * without a signed licensing agreement.
14 *
15 * IN NO EVENT SHALL JLAB BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL
16 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
17 * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF JLAB HAS
18 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 *
20 * JLAB SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE. THE HIPO DATA FORMAT SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF
23 * ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". JLAB HAS NO OBLIGATION TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 *
26 * This software was developed under the United States Government license.
27 * For more information contact author at gavalian@jlab.org
28 * Department of Experimental Nuclear Physics, Jefferson Lab.
29 */
30/*******************************************************************************
31 * File: table.h
32 * Author: gavalian
33 *
34 * Created on April 12, 2017, 10:14 AM
35 */
36
37#ifndef HIPO_JSON_H
38#define HIPO_JSON_H
39
40#include <map>
41#include "json.h"
42
43namespace hipo {
44
45using json = nlohmann::json;
46
47class jsonutil {
48
49private:
50
51 json json_object;
52
53public:
54
56 virtual ~jsonutil(){};
57
58 void set(const char *json_string){ json_object = json::parse(json_string);}
59 bool hasObject(const char *var){ return json_object.count(var)>0;}
60 float getFloat(const char *var){ return (float) json_object[var];}
61};
62
63} // end of namespace
64
65#endif /*HIPO_TABLE_H*/
66
Definition jsonutil.h:47
virtual ~jsonutil()
Definition jsonutil.h:56
void set(const char *json_string)
Definition jsonutil.h:58
bool hasObject(const char *var)
Definition jsonutil.h:59
jsonutil()
Definition jsonutil.h:55
float getFloat(const char *var)
Definition jsonutil.h:60
HIPO namespace is used for the classes that read/write files and records.
Definition bank.cpp:45
nlohmann::json json
Definition jsonutil.h:45