|
PVData C++
|
00001 /* 00002 * Copyright information and license terms for this software can be 00003 * found in the file LICENSE that is included with the distribution 00004 */ 00005 #ifndef PV_JSON_H 00006 #define PV_JSON_H 00007 00008 #include <istream> 00009 #include <ostream> 00010 #include <string> 00011 #include <map> 00012 00013 #include <pv/pvdVersion.h> 00014 #include <pv/pvData.h> 00015 00016 #if EPICS_VERSION_INT>=VERSION_INT(3,15,0,1) 00017 00018 #ifdef epicsExportSharedSymbols 00019 # define pvjson_epicsExportSharedSymbols 00020 # undef epicsExportSharedSymbols 00021 #endif 00022 00023 #include <yajl_parse.h> 00024 00025 #ifdef pvjson_epicsExportSharedSymbols 00026 # define epicsExportSharedSymbols 00027 # include "shareLib.h" 00028 #endif 00029 00030 #include <shareLib.h> 00031 00032 namespace epics{namespace pvData{ 00033 00034 class BitSet; 00035 00043 00044 struct epicsShareClass JSONPrintOptions 00045 { 00046 bool multiLine; 00047 bool ignoreUnprintable; 00048 unsigned indent; 00049 JSONPrintOptions(); 00050 }; 00051 00058 epicsShareFunc 00059 void printJSON(std::ostream& strm, 00060 const PVField::const_shared_pointer& val, 00061 const JSONPrintOptions& opts = JSONPrintOptions()); 00062 00071 epicsShareFunc 00072 PVStructure::shared_pointer parseJSON(std::istream& strm); 00073 00086 epicsShareFunc 00087 void parseJSON(std::istream& strm, 00088 const PVField::shared_pointer& dest, 00089 BitSet *assigned=0); 00090 00091 00104 epicsShareFunc 00105 bool yajl_parse_helper(std::istream& src, 00106 yajl_handle handle); 00107 00108 namespace yajl { 00109 // undef implies API version 0 00110 #ifndef EPICS_YAJL_VERSION 00111 typedef long integer_arg; 00112 typedef unsigned size_arg; 00113 #else 00114 typedef long long integer_arg; 00115 typedef size_t size_arg; 00116 #endif 00117 } // namespace epics::pvData::yajl 00118 00121 }} // namespace epics::pvData 00122 00123 #else 00124 # error JSON parser requires EPICS Base >= 3.15.0.1 00125 #endif // EPICS_VERSION_INT 00126 00127 #endif // PV_JSON_H
1.7.4