You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of blob_tree is to bring the heirarchical tree like structure of JSON to the world of binary data. Put the header wherever is convenient for your project. First declare a blob_tree.
Create a node called "blobs" and store a blob ("b1") under it. Note here that you never had to specify a schema. You just
start using the [] operator and storing blobs in named locations.
bt["blobs"]["b1"] = make_pair(b1.size(), &b1[0]); // data is inserted as a pair of pointer and size variables
You can also create arrays simply by using a number as the key type to the blob_tree [] operator.
You can get the number of elements in an array simply by calling .size().
bt["blobs"]["container"].size()
Finally when you are done youu jusut call the serialize() static method and pass in your blob_tree. serialize() returns a vector of bytes suitable for writing to a file, or perhaps sending across a network. Note: serialize() can also be passed a version number that will be stored in the blob_tree header.