OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
heavyai::JSON Class Referencefinal

#include <json.h>

Public Member Functions

 JSON ()
 
 JSON (const JSON &peer)
 
 JSON (JSON &&)=default
 
 JSON (const std::string &json)
 
 JSON (const char *json)
 
 JSON (const char *json, size_t len)
 
void parse (const std::string &json)
 
void parse (const char *json)
 
void parse (const char *json, size_t len)
 
std::string stringify () const
 
std::string str () const
 
bool b1 () const
 
uint64_t u64 () const
 
int64_t i64 () const
 
uint32_t u32 () const
 
int32_t i32 () const
 
uint16_t u16 () const
 
int16_t i16 () const
 
uint8_t u8 () const
 
int8_t i8 () const
 
double d64 () const
 
float f32 () const
 
bool isString () const
 
bool isNumber () const
 
bool isBoolean () const
 
bool isObject () const
 
bool isArray () const
 
bool isNull () const
 
bool hasMember (const std::string &name) const
 
 operator std::string () const
 
 operator bool () const
 
 operator uint64_t () const
 
 operator int64_t () const
 
 operator uint32_t () const
 
 operator int32_t () const
 
 operator uint16_t () const
 
 operator int16_t () const
 
 operator uint8_t () const
 
 operator int8_t () const
 
 operator double () const
 
 operator float () const
 
JSONoperator= (const JSON &peer)
 
JSONoperator= (const std::string &item)
 
JSONoperator= (const char *item)
 
JSONoperator= (bool item)
 
JSONoperator= (int32_t item)
 
JSONoperator= (int64_t item)
 
JSONoperator= (uint32_t item)
 
JSONoperator= (uint64_t item)
 
JSON operator[] (const std::string &name)
 
JSON operator[] (const char *name)
 
JSON operator[] (const std::string &name) const
 
JSON operator[] (const char *name) const
 
template<typename T >
JSON operator[] (T index)
 
JSON operator[] (size_t index)
 
template<typename T >
JSON operator[] (T index) const
 
JSON operator[] (size_t index) const
 

Private Member Functions

 JSON (std::shared_ptr< rapidjson::Document > doc, rapidjson::Value *vptr, rapidjson::Document::AllocatorType &allo, const std::string &name)
 

Private Attributes

std::shared_ptr
< rapidjson::Document > 
doc_
 
rapidjson::Value * vptr_
 
rapidjson::Document::AllocatorType & allo_
 
const std::string name_
 

Static Private Attributes

static std::string kTypeNames []
 

Friends

bool operator== (const JSON &json1, const JSON &json2)
 
bool operator!= (const JSON &json1, const JSON &json2)
 
template<typename T >
bool operator== (const JSON &json, const T &value)
 
template<typename T >
bool operator== (const T &value, const JSON &json)
 
template<typename T >
bool operator!= (const JSON &json, const T &value)
 
template<typename T >
bool operator!= (const T &value, const JSON &json)
 

Detailed Description

Definition at line 67 of file json.h.

Constructor & Destructor Documentation

heavyai::JSON::JSON ( )
inline

Definition at line 75 of file json.h.

Referenced by operator[]().

76  : doc_(std::make_shared<rapidjson::Document>())
77  , vptr_(&*doc_)
78  , allo_(doc_->GetAllocator())
79  , name_("JSON") {}
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
const std::string name_
Definition: json.h:71

+ Here is the caller graph for this function:

heavyai::JSON::JSON ( const JSON peer)
inline

Definition at line 82 of file json.h.

References allo_, and vptr_.

82 : JSON() { vptr_->CopyFrom(*peer.vptr_, allo_); }
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
heavyai::JSON::JSON ( JSON &&  )
default
heavyai::JSON::JSON ( const std::string &  json)
inline

Definition at line 88 of file json.h.

References parse().

88 : JSON() { parse(json); }
void parse(const std::string &json)
Definition: json.h:98

+ Here is the call graph for this function:

heavyai::JSON::JSON ( const char *  json)
inline

Definition at line 91 of file json.h.

References parse().

91 : JSON() { parse(json); }
void parse(const std::string &json)
Definition: json.h:98

+ Here is the call graph for this function:

heavyai::JSON::JSON ( const char *  json,
size_t  len 
)
inline

Definition at line 95 of file json.h.

References parse().

95 : JSON() { parse(json, len); }
void parse(const std::string &json)
Definition: json.h:98

+ Here is the call graph for this function:

heavyai::JSON::JSON ( std::shared_ptr< rapidjson::Document >  doc,
rapidjson::Value *  vptr,
rapidjson::Document::AllocatorType &  allo,
const std::string &  name 
)
inlineprivate

Definition at line 382 of file json.h.

386  : doc_(doc), vptr_(vptr), allo_(allo), name_(name) {}
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
string name
Definition: setup.in.py:72
const std::string name_
Definition: json.h:71

Member Function Documentation

bool heavyai::JSON::b1 ( ) const
inline

Definition at line 133 of file json.h.

133 { return static_cast<bool>(*this); }
double heavyai::JSON::d64 ( ) const
inline

Definition at line 147 of file json.h.

147 { return static_cast<double>(*this); }
float heavyai::JSON::f32 ( ) const
inline

Definition at line 148 of file json.h.

148 { return static_cast<float>(*this); }
bool heavyai::JSON::hasMember ( const std::string &  name) const
inline

Definition at line 161 of file json.h.

References vptr_.

161 { return vptr_->HasMember(name.c_str()); }
rapidjson::Value * vptr_
Definition: json.h:69
string name
Definition: setup.in.py:72
int16_t heavyai::JSON::i16 ( ) const
inline

Definition at line 142 of file json.h.

142 { return static_cast<int16_t>(*this); }
int32_t heavyai::JSON::i32 ( ) const
inline

Definition at line 139 of file json.h.

139 { return static_cast<int32_t>(*this); }
int64_t heavyai::JSON::i64 ( ) const
inline

Definition at line 136 of file json.h.

136 { return static_cast<int64_t>(*this); }
int8_t heavyai::JSON::i8 ( ) const
inline

Definition at line 145 of file json.h.

145 { return static_cast<int8_t>(*this); }
bool heavyai::JSON::isArray ( ) const
inline

Definition at line 156 of file json.h.

References vptr_.

156 { return vptr_->IsArray(); }
rapidjson::Value * vptr_
Definition: json.h:69
bool heavyai::JSON::isBoolean ( ) const
inline

Definition at line 154 of file json.h.

References vptr_.

154 { return vptr_->IsBool(); }
rapidjson::Value * vptr_
Definition: json.h:69
bool heavyai::JSON::isNull ( ) const
inline

Definition at line 157 of file json.h.

References vptr_.

157 { return vptr_->IsNull(); }
rapidjson::Value * vptr_
Definition: json.h:69
bool heavyai::JSON::isNumber ( ) const
inline

Definition at line 153 of file json.h.

References vptr_.

153 { return vptr_->IsNumber(); }
rapidjson::Value * vptr_
Definition: json.h:69
bool heavyai::JSON::isObject ( ) const
inline

Definition at line 155 of file json.h.

References vptr_.

155 { return vptr_->IsObject(); }
rapidjson::Value * vptr_
Definition: json.h:69
bool heavyai::JSON::isString ( ) const
inline

Definition at line 152 of file json.h.

References vptr_.

152 { return vptr_->IsString(); }
rapidjson::Value * vptr_
Definition: json.h:69
heavyai::JSON::operator bool ( ) const
inline

Definition at line 175 of file json.h.

References kTypeNames, name_, and vptr_.

175  {
176  if (!vptr_->IsBool()) {
177  throw std::runtime_error("expected JSON field '" + name_ +
178  "' to be Boolean but got [" +
179  kTypeNames[vptr_->GetType()] + "]");
180  }
181  return vptr_->GetBool();
182  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator double ( ) const
inline

Definition at line 256 of file json.h.

References kTypeNames, name_, and vptr_.

256  {
257  if (!vptr_->IsDouble()) {
258  throw std::runtime_error("can't convert JSON field '" + name_ +
259  "' to be floating point number from [" +
260  kTypeNames[vptr_->GetType()] + "]");
261  }
262  return vptr_->GetDouble();
263  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator float ( ) const
inline

Definition at line 265 of file json.h.

References kTypeNames, name_, and vptr_.

265  {
266  if (!vptr_->IsDouble()) {
267  throw std::runtime_error("can't convert JSON field '" + name_ +
268  "' to be floating point number from [" +
269  kTypeNames[vptr_->GetType()] + "]");
270  }
271  return static_cast<float>(vptr_->GetDouble());
272  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator int16_t ( ) const
inline

Definition at line 229 of file json.h.

References kTypeNames, name_, and vptr_.

229  {
230  if (!vptr_->IsInt()) {
231  throw std::runtime_error("can't convert JSON field '" + name_ +
232  "' to be signed 16-bit integer from [" +
233  kTypeNames[vptr_->GetType()] + "]");
234  }
235  return vptr_->GetInt();
236  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator int32_t ( ) const
inline

Definition at line 211 of file json.h.

References kTypeNames, name_, and vptr_.

211  {
212  if (!vptr_->IsInt()) {
213  throw std::runtime_error("can't convert JSON field '" + name_ +
214  "' to be signed 32-bit integer from [" +
215  kTypeNames[vptr_->GetType()] + "]");
216  }
217  return vptr_->GetInt();
218  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator int64_t ( ) const
inline

Definition at line 193 of file json.h.

References kTypeNames, name_, and vptr_.

193  {
194  if (!vptr_->IsInt64()) {
195  throw std::runtime_error("can't convert JSON field '" + name_ +
196  "' to be signed 64-bit integer from [" +
197  kTypeNames[vptr_->GetType()] + "]");
198  }
199  return vptr_->GetInt64();
200  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator int8_t ( ) const
inline

Definition at line 247 of file json.h.

References kTypeNames, name_, and vptr_.

247  {
248  if (!vptr_->IsInt()) {
249  throw std::runtime_error("can't convert JSON field '" + name_ +
250  "' to be signed 8-bit integer from [" +
251  kTypeNames[vptr_->GetType()] + "]");
252  }
253  return vptr_->GetInt();
254  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator std::string ( ) const
inline

Definition at line 166 of file json.h.

References kTypeNames, name_, and vptr_.

166  {
167  if (!vptr_->IsString()) {
168  throw std::runtime_error("expected JSON field '" + name_ +
169  "' to be String but got [" + kTypeNames[vptr_->GetType()] +
170  "]");
171  }
172  return std::string{vptr_->GetString(), vptr_->GetStringLength()};
173  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator uint16_t ( ) const
inline

Definition at line 220 of file json.h.

References kTypeNames, name_, and vptr_.

220  {
221  if (!vptr_->IsUint()) {
222  throw std::runtime_error("can't convert JSON field '" + name_ +
223  "' to be unsigned 16-bit integer from [" +
224  kTypeNames[vptr_->GetType()] + "]");
225  }
226  return vptr_->GetUint();
227  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator uint32_t ( ) const
inline

Definition at line 202 of file json.h.

References kTypeNames, name_, and vptr_.

202  {
203  if (!vptr_->IsUint()) {
204  throw std::runtime_error("can't convert JSON field '" + name_ +
205  "' to be unsigned 32-bit integer from [" +
206  kTypeNames[vptr_->GetType()] + "]");
207  }
208  return vptr_->GetUint();
209  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator uint64_t ( ) const
inline

Definition at line 184 of file json.h.

References kTypeNames, name_, and vptr_.

184  {
185  if (!vptr_->IsUint64()) {
186  throw std::runtime_error("can't convert JSON field '" + name_ +
187  "' to be unsigned 64-bit integer from [" +
188  kTypeNames[vptr_->GetType()] + "]");
189  }
190  return vptr_->GetUint64();
191  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
heavyai::JSON::operator uint8_t ( ) const
inline

Definition at line 238 of file json.h.

References kTypeNames, name_, and vptr_.

238  {
239  if (!vptr_->IsUint()) {
240  throw std::runtime_error("can't convert JSON field '" + name_ +
241  "' to be unsigned 8-bit integer from [" +
242  kTypeNames[vptr_->GetType()] + "]");
243  }
244  return vptr_->GetUint();
245  }
rapidjson::Value * vptr_
Definition: json.h:69
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378
JSON& heavyai::JSON::operator= ( const JSON peer)
inline

Definition at line 276 of file json.h.

References allo_, and vptr_.

276  {
277  vptr_->CopyFrom(*peer.vptr_, allo_);
278  return *this;
279  }
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
JSON& heavyai::JSON::operator= ( const std::string &  item)
inline

Definition at line 281 of file json.h.

References allo_, and vptr_.

281  {
282  *vptr_ = rapidjson::Value().SetString(item.c_str(), allo_);
283  return *this;
284  }
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
JSON& heavyai::JSON::operator= ( const char *  item)
inline

Definition at line 286 of file json.h.

References allo_, and vptr_.

286  {
287  *vptr_ = rapidjson::Value().SetString(item, allo_);
288  return *this;
289  }
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
JSON& heavyai::JSON::operator= ( bool  item)
inline

Definition at line 291 of file json.h.

References vptr_.

291  {
292  vptr_->SetBool(item);
293  return *this;
294  }
rapidjson::Value * vptr_
Definition: json.h:69
JSON& heavyai::JSON::operator= ( int32_t  item)
inline

Definition at line 296 of file json.h.

References vptr_.

296  {
297  vptr_->SetInt(item);
298  return *this;
299  }
rapidjson::Value * vptr_
Definition: json.h:69
JSON& heavyai::JSON::operator= ( int64_t  item)
inline

Definition at line 301 of file json.h.

References vptr_.

301  {
302  vptr_->SetInt64(item);
303  return *this;
304  }
rapidjson::Value * vptr_
Definition: json.h:69
JSON& heavyai::JSON::operator= ( uint32_t  item)
inline

Definition at line 306 of file json.h.

References vptr_.

306  {
307  vptr_->SetUint(item);
308  return *this;
309  }
rapidjson::Value * vptr_
Definition: json.h:69
JSON& heavyai::JSON::operator= ( uint64_t  item)
inline

Definition at line 311 of file json.h.

References vptr_.

311  {
312  vptr_->SetUint64(item);
313  return *this;
314  }
rapidjson::Value * vptr_
Definition: json.h:69
JSON heavyai::JSON::operator[] ( const std::string &  name)
inline

Definition at line 318 of file json.h.

Referenced by operator[]().

318 { return (*this)[name.c_str()]; }
string name
Definition: setup.in.py:72

+ Here is the caller graph for this function:

JSON heavyai::JSON::operator[] ( const char *  name)
inline

Definition at line 319 of file json.h.

References allo_, doc_, anonymous_namespace{Utm.h}::f, JSON(), and vptr_.

319  {
320  if (!vptr_->IsObject()) {
321  vptr_->SetObject();
322  }
323  if (!vptr_->HasMember(name)) {
324  vptr_->AddMember(
325  rapidjson::Value(name, allo_).Move(), rapidjson::Value().Move(), allo_);
326  auto f = vptr_->FindMember(name);
327  // f necessary because AddMember inexplicably doesn't return the new member
328  // https://stackoverflow.com/questions/52113291/which-object-reference-does-genericvalueaddmember-return
329  return JSON(doc_, &f->value, allo_, name);
330  }
331  return JSON(doc_, &(*vptr_)[name], allo_, name);
332  }
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
constexpr double f
Definition: Utm.h:31
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
string name
Definition: setup.in.py:72

+ Here is the call graph for this function:

JSON heavyai::JSON::operator[] ( const std::string &  name) const
inline

Definition at line 334 of file json.h.

334 { return (*this)[name.c_str()]; }
string name
Definition: setup.in.py:72
JSON heavyai::JSON::operator[] ( const char *  name) const
inline

Definition at line 335 of file json.h.

References allo_, doc_, JSON(), kTypeNames, name_, and vptr_.

335  {
336  if (!vptr_->IsObject()) {
337  throw std::runtime_error("JSON " + kTypeNames[vptr_->GetType()] + " field '" +
338  name_ + "' can't use operator []");
339  }
340  if (!vptr_->HasMember(name)) {
341  throw std::runtime_error("JSON field '" + std::string(name) + "' not found");
342  }
343  return JSON(doc_, &(*vptr_)[name], allo_, name);
344  }
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
string name
Definition: setup.in.py:72
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378

+ Here is the call graph for this function:

template<typename T >
JSON heavyai::JSON::operator[] ( index)
inline

Definition at line 347 of file json.h.

References operator[]().

347  {
348  return operator[](static_cast<size_t>(index));
349  }
JSON operator[](const std::string &name)
Definition: json.h:318

+ Here is the call graph for this function:

JSON heavyai::JSON::operator[] ( size_t  index)
inline

Definition at line 350 of file json.h.

References allo_, doc_, JSON(), to_string(), and vptr_.

350  {
351  if (!vptr_->IsArray()) {
352  vptr_->SetArray();
353  }
354  if (index >= vptr_->Size()) {
355  throw std::runtime_error("JSON array index " + std::to_string(index) +
356  " out of range " + std::to_string(vptr_->Size()));
357  }
358  return JSON(doc_, &(*vptr_)[index], allo_, std::to_string(index));
359  }
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
std::string to_string(char const *&&v)
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70

+ Here is the call graph for this function:

template<typename T >
JSON heavyai::JSON::operator[] ( index) const
inline

Definition at line 362 of file json.h.

References operator[]().

362  {
363  return operator[](static_cast<size_t>(index));
364  }
JSON operator[](const std::string &name)
Definition: json.h:318

+ Here is the call graph for this function:

JSON heavyai::JSON::operator[] ( size_t  index) const
inline

Definition at line 365 of file json.h.

References allo_, doc_, JSON(), kTypeNames, name_, to_string(), and vptr_.

365  {
366  if (!vptr_->IsArray()) {
367  throw std::runtime_error("JSON " + kTypeNames[vptr_->GetType()] + " field '" +
368  name_ + "' can't use operator []");
369  }
370  if (index >= vptr_->Size()) {
371  throw std::runtime_error("JSON array index " + std::to_string(index) +
372  " out of range " + std::to_string(vptr_->Size()));
373  }
374  return JSON(doc_, &(*vptr_)[index], allo_, std::to_string(index));
375  }
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
std::string to_string(char const *&&v)
rapidjson::Value * vptr_
Definition: json.h:69
rapidjson::Document::AllocatorType & allo_
Definition: json.h:70
const std::string name_
Definition: json.h:71
static std::string kTypeNames[]
Definition: json.h:378

+ Here is the call graph for this function:

void heavyai::JSON::parse ( const std::string &  json)
inline

Definition at line 98 of file json.h.

References doc_.

Referenced by JSON().

98  {
99  if (doc_->Parse(json.c_str()).HasParseError()) {
100  throw std::runtime_error("failed to parse json");
101  }
102  }
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68

+ Here is the caller graph for this function:

void heavyai::JSON::parse ( const char *  json)
inline

Definition at line 105 of file json.h.

References doc_.

105  {
106  if (doc_->Parse(json).HasParseError()) {
107  throw std::runtime_error("failed to parse json");
108  }
109  }
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
void heavyai::JSON::parse ( const char *  json,
size_t  len 
)
inline

Definition at line 113 of file json.h.

References doc_.

113  {
114  if (doc_->Parse(json, len).HasParseError()) {
115  throw std::runtime_error("failed to parse json");
116  }
117  }
std::shared_ptr< rapidjson::Document > doc_
Definition: json.h:68
std::string heavyai::JSON::str ( ) const
inline

Definition at line 131 of file json.h.

131 { return static_cast<std::string>(*this); }
std::string heavyai::JSON::stringify ( ) const
inline

Definition at line 120 of file json.h.

References vptr_.

120  {
121  rapidjson::StringBuffer buf;
122  rapidjson::Writer<rapidjson::StringBuffer> wr(buf);
123  vptr_->Accept(wr);
124  return buf.GetString();
125  }
rapidjson::Value * vptr_
Definition: json.h:69
uint16_t heavyai::JSON::u16 ( ) const
inline

Definition at line 141 of file json.h.

141 { return static_cast<uint16_t>(*this); }
uint32_t heavyai::JSON::u32 ( ) const
inline

Definition at line 138 of file json.h.

138 { return static_cast<uint32_t>(*this); }
uint64_t heavyai::JSON::u64 ( ) const
inline

Definition at line 135 of file json.h.

135 { return static_cast<uint64_t>(*this); }
uint8_t heavyai::JSON::u8 ( ) const
inline

Definition at line 144 of file json.h.

144 { return static_cast<uint8_t>(*this); }

Friends And Related Function Documentation

bool operator!= ( const JSON json1,
const JSON json2 
)
friend

Definition at line 408 of file json.h.

408  {
409  return (*json1.vptr_ != *json2.vptr_);
410 }
template<typename T >
bool operator!= ( const JSON json,
const T &  value 
)
friend

Definition at line 424 of file json.h.

424  {
425  return (*json.vptr_ != value);
426 }
template<typename T >
bool operator!= ( const T &  value,
const JSON json 
)
friend

Definition at line 428 of file json.h.

428  {
429  return (json != value);
430 }
bool operator== ( const JSON json1,
const JSON json2 
)
friend

Definition at line 404 of file json.h.

404  {
405  return (*json1.vptr_ == *json2.vptr_);
406 }
template<typename T >
bool operator== ( const JSON json,
const T &  value 
)
friend

Definition at line 415 of file json.h.

415  {
416  return (*json.vptr_ == value);
417 }
template<typename T >
bool operator== ( const T &  value,
const JSON json 
)
friend

Definition at line 419 of file json.h.

419  {
420  return (json == value);
421 }

Member Data Documentation

rapidjson::Document::AllocatorType& heavyai::JSON::allo_
private

Definition at line 70 of file json.h.

Referenced by JSON(), operator=(), and operator[]().

std::shared_ptr<rapidjson::Document> heavyai::JSON::doc_
private

Definition at line 68 of file json.h.

Referenced by operator[](), and parse().

std::string heavyai::JSON::kTypeNames[]
inlinestaticprivate

The documentation for this class was generated from the following file: