package sanddb

  1. Overview
  2. Docs

Source file record_b.ml

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
(* Auto-generated from "record.atd" *)
[@@@ocaml.warning "-27-32-33-35-39"]

type t = Record_t.t = { id: string; data: string }

let t_tag = Bi_io.record_tag
let write_untagged_t : Bi_outbuf.t -> t -> unit = (
  fun ob x ->
    Bi_vint.write_uvint ob 2;
    Bi_outbuf.add_char4 ob '\128' '\000' '[' '\219';
    (
      Bi_io.write_string
    ) ob x.id;
    Bi_outbuf.add_char4 ob '\194' 'c' 'V' '*';
    (
      Bi_io.write_string
    ) ob x.data;
)
let write_t ob x =
  Bi_io.write_tag ob Bi_io.record_tag;
  write_untagged_t ob x
let string_of_t ?(len = 1024) x =
  let ob = Bi_outbuf.create len in
  write_t ob x;
  Bi_outbuf.contents ob
let get_t_reader = (
  fun tag ->
    if tag <> 21 then Atdgen_runtime.Ob_run.read_error () else
      fun ib ->
        let field_id = ref (Obj.magic (Sys.opaque_identity 0.0)) in
        let field_data = ref (Obj.magic (Sys.opaque_identity 0.0)) in
        let bits0 = ref 0 in
        let len = Bi_vint.read_uvint ib in
        for i = 1 to len do
          match Bi_io.read_field_hashtag ib with
            | 23515 ->
              field_id := (
                (
                  Atdgen_runtime.Ob_run.read_string
                ) ib
              );
              bits0 := !bits0 lor 0x1;
            | -1033677270 ->
              field_data := (
                (
                  Atdgen_runtime.Ob_run.read_string
                ) ib
              );
              bits0 := !bits0 lor 0x2;
            | _ -> Bi_io.skip ib
        done;
        if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "id"; "data" |];
        (
          {
            id = !field_id;
            data = !field_data;
          }
         : t)
)
let read_t = (
  fun ib ->
    if Bi_io.read_tag ib <> 21 then Atdgen_runtime.Ob_run.read_error_at ib;
    let field_id = ref (Obj.magic (Sys.opaque_identity 0.0)) in
    let field_data = ref (Obj.magic (Sys.opaque_identity 0.0)) in
    let bits0 = ref 0 in
    let len = Bi_vint.read_uvint ib in
    for i = 1 to len do
      match Bi_io.read_field_hashtag ib with
        | 23515 ->
          field_id := (
            (
              Atdgen_runtime.Ob_run.read_string
            ) ib
          );
          bits0 := !bits0 lor 0x1;
        | -1033677270 ->
          field_data := (
            (
              Atdgen_runtime.Ob_run.read_string
            ) ib
          );
          bits0 := !bits0 lor 0x2;
        | _ -> Bi_io.skip ib
    done;
    if !bits0 <> 0x3 then Atdgen_runtime.Ob_run.missing_fields [| !bits0 |] [| "id"; "data" |];
    (
      {
        id = !field_id;
        data = !field_data;
      }
     : t)
)
let t_of_string ?pos s =
  read_t (Bi_inbuf.from_string ?pos s)
OCaml

Innovation. Community. Security.