Awkward Array: include/awkward/io/json.h Source File

Loading...
Searching...
No Matches
json.h
Go to the documentation of this file.
1// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2
3#ifndef AWKWARD_IO_JSON_H_
4#define AWKWARD_IO_JSON_H_
5
6#include <complex>
7#include <cstdio>
8#include <string>
9
10#include "awkward/common.h"
11#include "awkward/builder/Builder.h"
12#include "awkward/builder/ArrayBuilder.h"
13#include "awkward/BuilderOptions.h"
14#include "awkward/GrowableBuffer.h"
15#include "awkward/util.h"
16
17namespace awkward {
21 class LIBAWKWARD_EXPORT_SYMBOL ToJson {
22 public:
26 virtual ~ToJson();
27
29 virtual void
30 null() = 0;
32 virtual void
33 boolean(bool x) = 0;
35 virtual void
36 integer(int64_t x) = 0;
38 virtual void
39 real(double x) = 0;
41 virtual void
42 complex(std::complex<double> x) = 0;
44 virtual void
45 string(const char* x, int64_t length) = 0;
47 virtual void
48 beginlist() = 0;
50 virtual void
51 endlist() = 0;
53 virtual void
54 beginrecord() = 0;
56 virtual void
57 field(const char* x) = 0;
59 virtual void
60 endrecord() = 0;
62 virtual void
63 json(const char* data) = 0;
65 void
66 string(const std::string& x);
68 void
69 field(const std::string& x);
70 };
71
75 class LIBAWKWARD_EXPORT_SYMBOL ToJsonString: public ToJson {
76 public:
91 ToJsonString(int64_t maxdecimals,
92 const char* nan_string = nullptr,
93 const char* infinity_string = nullptr,
94 const char* minus_infinity_string = nullptr,
95 const char* complex_real_string = nullptr,
96 const char* complex_imag_string = nullptr);
98 ~ToJsonString();
99 void
100 null() override;
101 void
102 boolean(bool x) override;
103 void
104 integer(int64_t x) override;
105 void
106 real(double x) override;
107 void
108 complex(std::complex<double> x) override;
109 void
110 string(const char* x, int64_t length) override;
111 void
112 beginlist() override;
113 void
114 endlist() override;
115 void
116 beginrecord() override;
117 void
118 field(const char* x) override;
119 void
120 endrecord() override;
121 void
122 json(const char* data) override;
124 const std::string
125 tostring();
126 private:
127 class Impl;
128 Impl* impl_;
129 const char* nan_string_;
130 const char* infinity_string_;
131 const char* minus_infinity_string_;
132 const char* complex_real_string_;
133 const char* complex_imag_string_;
134 };
135
139 class LIBAWKWARD_EXPORT_SYMBOL ToJsonPrettyString: public ToJson {
140 public:
155 ToJsonPrettyString(int64_t maxdecimals,
156 const char* nan_string = nullptr,
157 const char* infinity_string = nullptr,
158 const char* minus_infinity_string = nullptr,
159 const char* complex_real_string = nullptr,
160 const char* complex_imag_string = nullptr);
162 ~ToJsonPrettyString();
163 void
164 null() override;
165 void
166 boolean(bool x) override;
167 void
168 integer(int64_t x) override;
169 void
170 real(double x) override;
171 void
172 complex(std::complex<double> x) override;
173 void
174 string(const char* x, int64_t length) override;
175 void
176 beginlist() override;
177 void
178 endlist() override;
179 void
180 beginrecord() override;
181 void
182 field(const char* x) override;
183 void
184 endrecord() override;
185 void
186 json(const char* data) override;
188 const std::string
189 tostring();
190 private:
191 class Impl;
192 Impl* impl_;
193 const char* nan_string_;
194 const char* infinity_string_;
195 const char* minus_infinity_string_;
196 const char* complex_real_string_;
197 const char* complex_imag_string_;
198 };
199
203 class LIBAWKWARD_EXPORT_SYMBOL ToJsonFile: public ToJson {
204 public:
221 ToJsonFile(FILE* destination,
222 int64_t maxdecimals,
223 int64_t buffersize,
224 const char* nan_string = nullptr,
225 const char* infinity_string = nullptr,
226 const char* minus_infinity_string = nullptr,
227 const char* complex_real_string = nullptr,
228 const char* complex_imag_string = nullptr);
230 ~ToJsonFile();
231 void
232 null() override;
233 void
234 boolean(bool x) override;
235 void
236 integer(int64_t x) override;
237 void
238 real(double x) override;
239 void
240 complex(std::complex<double> x) override;
241 void
242 string(const char* x, int64_t length) override;
243 void
244 beginlist() override;
245 void
246 endlist() override;
247 void
248 beginrecord() override;
249 void
250 field(const char* x) override;
251 void
252 endrecord() override;
253 void
254 json(const char* data) override;
255 private:
256 class Impl;
257 Impl* impl_;
258 const char* nan_string_;
259 const char* infinity_string_;
260 const char* minus_infinity_string_;
261 const char* complex_real_string_;
262 const char* complex_imag_string_;
263 };
264
268 class LIBAWKWARD_EXPORT_SYMBOL ToJsonPrettyFile: public ToJson {
269 public:
286 ToJsonPrettyFile(FILE* destination,
287 int64_t maxdecimals,
288 int64_t buffersize,
289 const char* nan_string = nullptr,
290 const char* infinity_string = nullptr,
291 const char* minus_infinity_string = nullptr,
292 const char* complex_real_string = nullptr,
293 const char* complex_imag_string = nullptr);
295 ~ToJsonPrettyFile();
296 void
297 null() override;
298 void
299 boolean(bool x) override;
300 void
301 integer(int64_t x) override;
302 void
303 real(double x) override;
304 void
305 complex(std::complex<double> x) override;
306 void
307 string(const char* x, int64_t length) override;
308 void
309 beginlist() override;
310 void
311 endlist() override;
312 void
313 beginrecord() override;
314 void
315 field(const char* x) override;
316 void
317 endrecord() override;
318 void
319 json(const char* data) override;
320 private:
321 class Impl;
322 Impl* impl_;
323 const char* nan_string_;
324 const char* infinity_string_;
325 const char* minus_infinity_string_;
326 const char* complex_real_string_;
327 const char* complex_imag_string_;
328 };
329
341 LIBAWKWARD_EXPORT_SYMBOL int64_t
342 FromJsonString(const char* source,
343 ArrayBuilder& builder,
344 const char* nan_string = nullptr,
345 const char* infinity_string = nullptr,
346 const char* minus_infinity_string = nullptr);
347
360 LIBAWKWARD_EXPORT_SYMBOL int64_t
361 FromJsonFile(FILE* source,
362 ArrayBuilder& builder,
363 int64_t buffersize,
364 const char* nan_string = nullptr,
365 const char* infinity_string = nullptr,
366 const char* minus_infinity_string = nullptr);
367
372 class FileLikeObject {
373 public:
374 virtual int64_t read(int64_t num_bytes, char* buffer) = 0;
375 };
376
393 LIBAWKWARD_EXPORT_SYMBOL void
394 fromjsonobject(FileLikeObject* source,
395 ArrayBuilder& builder,
396 int64_t buffersize,
397 bool read_one,
398 const char* nan_string = nullptr,
399 const char* posinf_string = nullptr,
400 const char* neginf_string = nullptr);
401
402 class FromJsonObjectSchema {
403 public:
404 FromJsonObjectSchema(FileLikeObject* source,
405 int64_t buffersize,
406 bool read_one,
407 const char* nan_string,
408 const char* posinf_string,
409 const char* neginf_string,
410 const char* jsonassembly,
411 int64_t initial,
412 double resize);
413
415 inline int64_t current_stack_depth() const noexcept {
416 return current_stack_depth_;
417 }
418
420 inline int64_t current_instruction() const noexcept {
421 return current_instruction_;
422 }
423
425 inline int64_t instruction() const noexcept {
426 return instructions_.data()[current_instruction_ * 4];
427 }
428
430 inline int64_t argument1() const noexcept {
431 return instructions_.data()[current_instruction_ * 4 + 1];
432 }
433
435 inline int64_t argument2() const noexcept {
436 return instructions_.data()[current_instruction_ * 4 + 2];
437 }
438
440 inline int64_t argument3() const noexcept {
441 return instructions_.data()[current_instruction_ * 4 + 3];
442 }
443
445 inline void step_forward() noexcept {
446 current_instruction_++;
447 }
448
450 inline void step_backward() noexcept {
451 current_instruction_--;
452 }
453
455 inline void push_stack(int64_t jump_to) noexcept {
456 instruction_stack_.data()[current_stack_depth_] = current_instruction_;
457 current_stack_depth_++;
458 current_instruction_ = jump_to;
459 }
460
462 inline void pop_stack() noexcept {
463 current_stack_depth_--;
464 current_instruction_ = instruction_stack_.data()[current_stack_depth_];
465 }
466
468 inline int64_t find_enum(const char* str) noexcept {
469 int64_t* offsets = string_offsets_.data();
470 char* chars = characters_.data();
471 int64_t stringsstart = argument2();
472 int64_t start;
473 int64_t stop;
474 for (int64_t i = stringsstart; i < argument3(); i++) {
475 start = offsets[i];
476 stop = offsets[i + 1];
477 if (strncmp(str, &chars[start], stop - start) == 0) {
478 return i - stringsstart;
479 }
480 }
481 return -1;
482 }
483
485 inline int64_t find_key(const char* str) noexcept {
486 int64_t* offsets = string_offsets_.data();
487 char* chars = characters_.data();
488 int64_t stringi;
489 int64_t start;
490 int64_t stop;
491 for (int64_t i = current_instruction_ + 1; i <= current_instruction_ + argument1(); i++) {
492 stringi = instructions_.data()[i * 4 + 1];
493 start = offsets[stringi];
494 stop = offsets[stringi + 1];
495 if (strncmp(str, &chars[start], stop - start) == 0) {
496 return instructions_.data()[i * 4 + 2];
497 }
498 }
499 return -1;
500 }
501
503 inline void write_int8(int64_t index, int8_t x) noexcept {
504 buffers_uint8_[index].append(*reinterpret_cast<uint8_t*>(&x));
505 }
506
508 inline void write_uint8(int64_t index, uint8_t x) noexcept {
509 buffers_uint8_[index].append(x);
510 }
511
513 inline void write_many_uint8(int64_t index, int64_t num_items, const uint8_t* values) noexcept {
514 buffers_uint8_[index].extend(values, num_items);
515 }
516
518 inline void write_int64(int64_t index, int64_t x) noexcept {
519 buffers_int64_[index].append(x);
520 }
521
523 inline void write_uint64(int64_t index, uint64_t x) noexcept {
524 buffers_int64_[index].append(static_cast<int64_t>(x));
525 }
526
528 inline void write_add_int64(int64_t index, int64_t x) noexcept {
529 buffers_int64_[index].append(buffers_int64_[index].last() + x);
530 }
531
533 inline void write_float64(int64_t index, double x) noexcept {
534 buffers_float64_[index].append(x);
535 }
536
538 inline int64_t get_and_increment(int64_t index) noexcept {
539 return counters_[index]++;
540 }
541
543 int64_t length() const noexcept {
544 return length_;
545 }
546
548 inline void add_to_length(int64_t length) noexcept {
549 length_ += length;
550 }
551
553 std::string debug() const noexcept;
554
556 int64_t num_outputs() const {
557 return output_names_.size();
558 }
559
561 std::string output_name(int64_t i) const {
562 return output_names_[i];
563 }
564
566 std::string output_dtype(int64_t i) const {
567 switch (output_dtypes_[i]) {
568 case util::dtype::int8:
569 return "int8";
570 case util::dtype::uint8:
571 return "uint8";
572 case util::dtype::int64:
573 return "int64";
574 case util::dtype::float64:
575 return "float64";
576 default:
577 return "unknown";
578 }
579 }
580
582 int64_t output_num_items(int64_t i) const {
583 switch (output_dtypes_[i]) {
584 case util::dtype::int8:
585 return buffers_uint8_[output_which_[i]].nbytes();
586 case util::dtype::uint8:
587 return buffers_uint8_[output_which_[i]].nbytes();
588 case util::dtype::int64:
589 return buffers_int64_[output_which_[i]].nbytes() / 8;
590 case util::dtype::float64:
591 return buffers_float64_[output_which_[i]].nbytes() / 8;
592 default:
593 return -1;
594 }
595 }
596
598 void output_fill(int64_t i, void* external_pointer) const {
599 switch (output_dtypes_[i]) {
600 case util::dtype::int8:
601 buffers_uint8_[output_which_[i]].concatenate(
602 reinterpret_cast<uint8_t*>(external_pointer)
603 );
604 break;
605 case util::dtype::uint8:
606 buffers_uint8_[output_which_[i]].concatenate(
607 reinterpret_cast<uint8_t*>(external_pointer)
608 );
609 break;
610 case util::dtype::int64:
611 buffers_int64_[output_which_[i]].concatenate(
612 reinterpret_cast<int64_t*>(external_pointer)
613 );
614 break;
615 case util::dtype::float64:
616 buffers_float64_[output_which_[i]].concatenate(
617 reinterpret_cast<double*>(external_pointer)
618 );
619 break;
620 }
621 }
622
623 private:
624 std::vector<int64_t> instructions_;
625 std::vector<char> characters_;
626 std::vector<int64_t> string_offsets_;
627
628 std::vector<std::string> output_names_;
629 std::vector<util::dtype> output_dtypes_;
630 std::vector<int64_t> output_which_;
631 std::vector<GrowableBuffer<uint8_t>> buffers_uint8_;
632 std::vector<GrowableBuffer<int64_t>> buffers_int64_;
633 std::vector<GrowableBuffer<double>> buffers_float64_;
634
635 int64_t current_instruction_;
636 std::vector<int64_t> instruction_stack_;
637 int64_t current_stack_depth_;
638 std::vector<int64_t> counters_;
639
640 int64_t length_;
641 };
642
643}
644
645#endif // AWKWARD_IO_JSON_H_
ArrayBuilder.h
BuilderOptions.h
Builder.h
GrowableBuffer.h
awkward::ArrayBuilder
User interface to the Builder system: the ArrayBuilder is a fixed reference while the Builder subclas...
Definition: ArrayBuilder.h:23
awkward::FileLikeObject
Abstract class to represent a file-like object, something with a read(num_bytes) method....
Definition: json.h:372
awkward::FileLikeObject::read
virtual int64_t read(int64_t num_bytes, char *buffer)=0
awkward::FromJsonObjectSchema
Definition: json.h:402
awkward::FromJsonObjectSchema::write_many_uint8
void write_many_uint8(int64_t index, int64_t num_items, const uint8_t *values) noexcept
HERE.
Definition: json.h:513
awkward::FromJsonObjectSchema::step_forward
void step_forward() noexcept
HERE.
Definition: json.h:445
awkward::FromJsonObjectSchema::pop_stack
void pop_stack() noexcept
HERE.
Definition: json.h:462
awkward::FromJsonObjectSchema::FromJsonObjectSchema
FromJsonObjectSchema(FileLikeObject *source, int64_t buffersize, bool read_one, const char *nan_string, const char *posinf_string, const char *neginf_string, const char *jsonassembly, int64_t initial, double resize)
awkward::FromJsonObjectSchema::write_uint64
void write_uint64(int64_t index, uint64_t x) noexcept
HERE.
Definition: json.h:523
awkward::FromJsonObjectSchema::output_fill
void output_fill(int64_t i, void *external_pointer) const
HERE.
Definition: json.h:598
awkward::FromJsonObjectSchema::instruction
int64_t instruction() const noexcept
HERE.
Definition: json.h:425
awkward::FromJsonObjectSchema::length
int64_t length() const noexcept
HERE.
Definition: json.h:543
awkward::FromJsonObjectSchema::write_float64
void write_float64(int64_t index, double x) noexcept
HERE.
Definition: json.h:533
awkward::FromJsonObjectSchema::find_enum
int64_t find_enum(const char *str) noexcept
HERE.
Definition: json.h:468
awkward::FromJsonObjectSchema::write_int64
void write_int64(int64_t index, int64_t x) noexcept
HERE.
Definition: json.h:518
awkward::FromJsonObjectSchema::current_instruction
int64_t current_instruction() const noexcept
HERE.
Definition: json.h:420
awkward::FromJsonObjectSchema::argument1
int64_t argument1() const noexcept
HERE.
Definition: json.h:430
awkward::FromJsonObjectSchema::num_outputs
int64_t num_outputs() const
HERE.
Definition: json.h:556
awkward::FromJsonObjectSchema::step_backward
void step_backward() noexcept
HERE.
Definition: json.h:450
awkward::FromJsonObjectSchema::write_uint8
void write_uint8(int64_t index, uint8_t x) noexcept
HERE.
Definition: json.h:508
awkward::FromJsonObjectSchema::get_and_increment
int64_t get_and_increment(int64_t index) noexcept
HERE.
Definition: json.h:538
awkward::FromJsonObjectSchema::write_add_int64
void write_add_int64(int64_t index, int64_t x) noexcept
HERE.
Definition: json.h:528
awkward::FromJsonObjectSchema::argument2
int64_t argument2() const noexcept
HERE.
Definition: json.h:435
awkward::FromJsonObjectSchema::add_to_length
void add_to_length(int64_t length) noexcept
HERE.
Definition: json.h:548
awkward::FromJsonObjectSchema::output_name
std::string output_name(int64_t i) const
HERE.
Definition: json.h:561
awkward::FromJsonObjectSchema::write_int8
void write_int8(int64_t index, int8_t x) noexcept
HERE.
Definition: json.h:503
awkward::FromJsonObjectSchema::push_stack
void push_stack(int64_t jump_to) noexcept
HERE.
Definition: json.h:455
awkward::FromJsonObjectSchema::find_key
int64_t find_key(const char *str) noexcept
HERE.
Definition: json.h:485
awkward::FromJsonObjectSchema::argument3
int64_t argument3() const noexcept
HERE.
Definition: json.h:440
awkward::FromJsonObjectSchema::debug
std::string debug() const noexcept
HERE.
awkward::FromJsonObjectSchema::output_num_items
int64_t output_num_items(int64_t i) const
HERE.
Definition: json.h:582
awkward::FromJsonObjectSchema::output_dtype
std::string output_dtype(int64_t i) const
HERE.
Definition: json.h:566
awkward::FromJsonObjectSchema::current_stack_depth
int64_t current_stack_depth() const noexcept
HERE.
Definition: json.h:415
awkward::ToJsonFile
Produces a JSON-formatted file.
Definition: json.h:203
awkward::ToJsonFile::field
void field(const char *x) override
Insert a key for a key-value pair.
awkward::ToJsonFile::json
void json(const char *data) override
Write raw JSON as a string.
awkward::ToJsonFile::boolean
void boolean(bool x) override
Append a boolean value x.
awkward::ToJsonFile::real
void real(double x) override
Append a real value x.
awkward::ToJsonFile::endrecord
void endrecord() override
End the current record.
awkward::ToJsonFile::endlist
void endlist() override
End the current list.
awkward::ToJsonFile::beginrecord
void beginrecord() override
Begin a record.
awkward::ToJsonFile::ToJsonFile
ToJsonFile(FILE *destination, int64_t maxdecimals, int64_t buffersize, const char *nan_string=nullptr, const char *infinity_string=nullptr, const char *minus_infinity_string=nullptr, const char *complex_real_string=nullptr, const char *complex_imag_string=nullptr)
Creates a ToJsonFile with a full set of parameters.
awkward::ToJsonFile::complex
void complex(std::complex< double > x) override
Append a complex value x.
awkward::ToJsonFile::string
void string(const char *x, int64_t length) override
Append a string value x.
awkward::ToJsonFile::integer
void integer(int64_t x) override
Append an integer value x.
awkward::ToJsonFile::~ToJsonFile
~ToJsonFile()
Empty destructor; required for some C++ reason.
awkward::ToJsonFile::null
void null() override
Append a null value.
awkward::ToJsonFile::beginlist
void beginlist() override
Begin a list.
awkward::ToJsonPrettyFile
Produces a pretty JSON-formatted file.
Definition: json.h:268
awkward::ToJsonPrettyFile::field
void field(const char *x) override
Insert a key for a key-value pair.
awkward::ToJsonPrettyFile::json
void json(const char *data) override
Write raw JSON as a string.
awkward::ToJsonPrettyFile::boolean
void boolean(bool x) override
Append a boolean value x.
awkward::ToJsonPrettyFile::ToJsonPrettyFile
ToJsonPrettyFile(FILE *destination, int64_t maxdecimals, int64_t buffersize, const char *nan_string=nullptr, const char *infinity_string=nullptr, const char *minus_infinity_string=nullptr, const char *complex_real_string=nullptr, const char *complex_imag_string=nullptr)
Creates a ToJsonPrettyFile with a full set of parameters.
awkward::ToJsonPrettyFile::real
void real(double x) override
Append a real value x.
awkward::ToJsonPrettyFile::endrecord
void endrecord() override
End the current record.
awkward::ToJsonPrettyFile::endlist
void endlist() override
End the current list.
awkward::ToJsonPrettyFile::beginrecord
void beginrecord() override
Begin a record.
awkward::ToJsonPrettyFile::complex
void complex(std::complex< double > x) override
Append a complex value x.
awkward::ToJsonPrettyFile::string
void string(const char *x, int64_t length) override
Append a string value x.
awkward::ToJsonPrettyFile::integer
void integer(int64_t x) override
Append an integer value x.
awkward::ToJsonPrettyFile::null
void null() override
Append a null value.
awkward::ToJsonPrettyFile::~ToJsonPrettyFile
~ToJsonPrettyFile()
Empty destructor; required for some C++ reason.
awkward::ToJsonPrettyFile::beginlist
void beginlist() override
Begin a list.
awkward::ToJsonPrettyString
Produces a pretty JSON-formatted string.
Definition: json.h:139
awkward::ToJsonPrettyString::field
void field(const char *x) override
Insert a key for a key-value pair.
awkward::ToJsonPrettyString::json
void json(const char *data) override
Write raw JSON as a string.
awkward::ToJsonPrettyString::ToJsonPrettyString
ToJsonPrettyString(int64_t maxdecimals, const char *nan_string=nullptr, const char *infinity_string=nullptr, const char *minus_infinity_string=nullptr, const char *complex_real_string=nullptr, const char *complex_imag_string=nullptr)
Creates a ToJsonPrettyString with a full set of parameters.
awkward::ToJsonPrettyString::boolean
void boolean(bool x) override
Append a boolean value x.
awkward::ToJsonPrettyString::real
void real(double x) override
Append a real value x.
awkward::ToJsonPrettyString::endrecord
void endrecord() override
End the current record.
awkward::ToJsonPrettyString::endlist
void endlist() override
End the current list.
awkward::ToJsonPrettyString::beginrecord
void beginrecord() override
Begin a record.
awkward::ToJsonPrettyString::complex
void complex(std::complex< double > x) override
Append a complex value x.
awkward::ToJsonPrettyString::string
void string(const char *x, int64_t length) override
Append a string value x.
awkward::ToJsonPrettyString::integer
void integer(int64_t x) override
Append an integer value x.
awkward::ToJsonPrettyString::tostring
const std::string tostring()
Return the accumulated data as a string.
awkward::ToJsonPrettyString::~ToJsonPrettyString
~ToJsonPrettyString()
Empty destructor; required for some C++ reason.
awkward::ToJsonPrettyString::null
void null() override
Append a null value.
awkward::ToJsonPrettyString::beginlist
void beginlist() override
Begin a list.
awkward::ToJsonString
Produces a JSON-formatted string.
Definition: json.h:75
awkward::ToJsonString::field
void field(const char *x) override
Insert a key for a key-value pair.
awkward::ToJsonString::json
void json(const char *data) override
Write raw JSON as a string.
awkward::ToJsonString::boolean
void boolean(bool x) override
Append a boolean value x.
awkward::ToJsonString::real
void real(double x) override
Append a real value x.
awkward::ToJsonString::endrecord
void endrecord() override
End the current record.
awkward::ToJsonString::endlist
void endlist() override
End the current list.
awkward::ToJsonString::beginrecord
void beginrecord() override
Begin a record.
awkward::ToJsonString::ToJsonString
ToJsonString(int64_t maxdecimals, const char *nan_string=nullptr, const char *infinity_string=nullptr, const char *minus_infinity_string=nullptr, const char *complex_real_string=nullptr, const char *complex_imag_string=nullptr)
Creates a ToJsonString with a full set of parameters.
awkward::ToJsonString::complex
void complex(std::complex< double > x) override
Append a complex value x.
awkward::ToJsonString::string
void string(const char *x, int64_t length) override
Append a string value x.
awkward::ToJsonString::integer
void integer(int64_t x) override
Append an integer value x.
awkward::ToJsonString::~ToJsonString
~ToJsonString()
Empty destructor; required for some C++ reason.
awkward::ToJsonString::tostring
const std::string tostring()
Return the accumulated data as a string.
awkward::ToJsonString::null
void null() override
Append a null value.
awkward::ToJsonString::beginlist
void beginlist() override
Begin a list.
awkward::ToJson
Definition: json.h:21
awkward::ToJson::complex
virtual void complex(std::complex< double > x)=0
Append a complex value x.
awkward::ToJson::integer
virtual void integer(int64_t x)=0
Append an integer value x.
awkward::ToJson::field
void field(const std::string &x)
Insert a key for a key-value pair.
awkward::ToJson::field
virtual void field(const char *x)=0
Insert a key for a key-value pair.
awkward::ToJson::endrecord
virtual void endrecord()=0
End the current record.
awkward::ToJson::~ToJson
virtual ~ToJson()
Virtual destructor acts as a first non-inline virtual function that determines a specific translation...
awkward::ToJson::string
virtual void string(const char *x, int64_t length)=0
Append a string value x.
awkward::ToJson::endlist
virtual void endlist()=0
End the current list.
awkward::ToJson::null
virtual void null()=0
Append a null value.
awkward::ToJson::boolean
virtual void boolean(bool x)=0
Append a boolean value x.
awkward::ToJson::json
virtual void json(const char *data)=0
Write raw JSON as a string.
awkward::ToJson::beginlist
virtual void beginlist()=0
Begin a list.
awkward::ToJson::string
void string(const std::string &x)
Append a string value x.
awkward::ToJson::real
virtual void real(double x)=0
Append a real value x.
awkward::ToJson::beginrecord
virtual void beginrecord()=0
Begin a record.
common.h
LIBAWKWARD_EXPORT_SYMBOL
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
awkward::util::dtype::int8
@ int8
awkward::util::dtype::uint8
@ uint8
awkward::util::dtype::float64
@ float64
awkward::util::dtype::int64
@ int64
awkward
Definition: BitMaskedArray.h:15
awkward::fromjsonobject
LIBAWKWARD_EXPORT_SYMBOL void fromjsonobject(FileLikeObject *source, ArrayBuilder &builder, int64_t buffersize, bool read_one, const char *nan_string=nullptr, const char *posinf_string=nullptr, const char *neginf_string=nullptr)
Parses a JSON-encoded file-like object using an ArrayBuilder.
awkward::state::index
@ index
awkward::FromJsonString
LIBAWKWARD_EXPORT_SYMBOL int64_t FromJsonString(const char *source, ArrayBuilder &builder, const char *nan_string=nullptr, const char *infinity_string=nullptr, const char *minus_infinity_string=nullptr)
Parses a JSON-encoded string using an ArrayBuilder.
awkward::FromJsonFile
LIBAWKWARD_EXPORT_SYMBOL int64_t FromJsonFile(FILE *source, ArrayBuilder &builder, int64_t buffersize, const char *nan_string=nullptr, const char *infinity_string=nullptr, const char *minus_infinity_string=nullptr)
Parses a JSON-encoded file using an ArrayBuilder.
util.h