Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><a href="http://www.picklingtools.com/">http://www.picklingtools.com/</a></p> <p>There is a library called the PicklingTools which I help maintain which might be useful: it allows you to form data structures in C++ that you can then pickle/unpickle ... it is C++, not C, but that shouldn't be a problem these days (assuming you are using the gcc/g++ suite). </p> <p>The library is a plain C++ library (there are examples of C++ and Python within the distribution showing how to use the library over sockets and files from both C++ and Python), but in general, the basics of pickling to files is available.</p> <p>The basic idea is that the PicklingTools library gives you "python-like" data structures from C++ so that you can then serialize and deserialize to/from Python/C++. All (?) the basic types: int, long int,string, None, complex, dictionarys, lists, ordered dictionaries and tuples are supported. There are few hooks to do custom classes, but that part is a bit immature: the rest of the library is pretty stable and has been active for 8 (?) years.</p> <p>Simple example:</p> <pre><code>#include "chooseser.h" int main() { Val a_dict = Tab("{ 'a':1, 'b':[1,2.2,'three'], 'c':None }"); cout &lt;&lt; a_dict["b"][0]; // value of 1 // Dump to a file DumpValToFile(a_dict, "example.p0", SERIALIZE_P0); // .. from Python, can load the dictionary with pickle.load(file('example.p0')) // Get the result back Val result; LoadValFromFile(result, "example.p0", SERIALIZE_P0); cout &lt;&lt; result &lt;&lt; endl; } </code></pre> <p>There is further documentation (FAQ and User's Guide) on the web site.</p> <p>Hope this is useful:</p> <p>Gooday,</p> <p>Richie</p> <p><a href="http://www.picklingtools.com/">http://www.picklingtools.com/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload