digitalmars.D.learn - Binary serialization of a struct
- Joseph (7/7) Sep 15 2017 Are there any simple direct serialization libraries where I can
- Azi Hassan (6/13) Sep 16 2017 Have you checked Cerealed ? From the looks of it, it supports a
- Cym13 (3/17) Dec 08 2017 Cerealed is definitely my favourite library out there for binary
- Sergei Degtiarev (4/7) Sep 16 2017 You may also take a look at
- spring (4/11) Sep 18 2017 https://github.com/huntlabs/common/blob/master/source/zhang2018/common/S...
- =?UTF-8?B?Tm9yZGzDtnc=?= (22/29) Sep 18 2017 https://github.com/msgpack/msgpack-d
- kdevel (7/10) Dec 07 2017 I can't unittest my 32-bit code:
- Daniel Kozak (5/16) Dec 08 2017 You should use size_t instead of ulong, but on 32bit you would have stil...
Are there any simple direct serialization libraries where I can mark elements of a class or struct that I want serialized with an attribute and it will take care of all the rest(including recursive structures, arrays, etc) then deserialize back in to the structs? I want something straight forward without allot of plumbing on my end.
Sep 15 2017
On Saturday, 16 September 2017 at 03:30:51 UTC, Joseph wrote:Are there any simple direct serialization libraries where I can mark elements of a class or struct that I want serialized with an attribute and it will take care of all the rest(including recursive structures, arrays, etc) then deserialize back in to the structs? I want something straight forward without allot of plumbing on my end.Have you checked Cerealed ? From the looks of it, it supports a NoCereal attribute which does the opposite of what you're looking for. Not sure how it handles nested structs, but there are examples in the test/directory : https://github.com/atilaneves/cerealed/
Sep 16 2017
On Saturday, 16 September 2017 at 13:15:54 UTC, Azi Hassan wrote:On Saturday, 16 September 2017 at 03:30:51 UTC, Joseph wrote:Cerealed is definitely my favourite library out there for binary serialization. High quality.Are there any simple direct serialization libraries where I can mark elements of a class or struct that I want serialized with an attribute and it will take care of all the rest(including recursive structures, arrays, etc) then deserialize back in to the structs? I want something straight forward without allot of plumbing on my end.Have you checked Cerealed ? From the looks of it, it supports a NoCereal attribute which does the opposite of what you're looking for. Not sure how it handles nested structs, but there are examples in the test/directory : https://github.com/atilaneves/cerealed/
Dec 08 2017
On Saturday, 16 September 2017 at 03:30:51 UTC, Joseph wrote:Are there any simple direct serialization libraries... I want something straight forward without allot of plumbing on my end.You may also take a look at https://github.com/sdegtiarev/persistentObject This is small module for binary serialization.
Sep 16 2017
On Saturday, 16 September 2017 at 03:30:51 UTC, Joseph wrote:Are there any simple direct serialization libraries where I can mark elements of a class or struct that I want serialized with an attribute and it will take care of all the rest(including recursive structures, arrays, etc) then deserialize back in to the structs? I want something straight forward without allot of plumbing on my end.https://github.com/huntlabs/common/blob/master/source/zhang2018/common/Serialize.d only a single file . can serialize/deserialize struct,class,array.
Sep 18 2017
On Saturday, 16 September 2017 at 03:30:51 UTC, Joseph wrote:Are there any simple direct serialization libraries where I can mark elements of a class or struct that I want serialized with an attribute and it will take care of all the rest(including recursive structures, arrays, etc) then deserialize back in to the structs? I want something straight forward without allot of plumbing on my end.https://github.com/msgpack/msgpack-d is about as simple as it can get: import std.file; import msgpack; struct S { int x; float y; string z; } void main() { S input = S(10, 25.5, "message"); // serialize data ubyte[] inData = pack(input); // write data to a file write("file.dat", inData); // read data from a file ubyte[] outData = cast(ubyte[])read("file.dat"); // unserialize the data S target = outData.unpack!S(); // verify data is the same assert(target.x == input.x); assert(target.y == input.y); assert(target.z == input.z); }
Sep 18 2017
On Tuesday, 19 September 2017 at 06:32:52 UTC, Nordlöw wrote:I can't unittest my 32-bit code: $ MODEL=32 make -f posix.mak unittest [...] src/msgpack/packer.d(1139): Error: function core.stdc.stdlib.malloc (uint size) is not callable using argument types (ulong)I want something straight forward without allot of plumbing on my end.https://github.com/msgpack/msgpack-d
Dec 07 2017
You should use size_t instead of ulong, but on 32bit you would have still problem because you are trying assign 2^32 which is too big to hold in 32bi= t On Thu, Dec 7, 2017 at 11:42 PM, kdevel via Digitalmars-d-learn < digitalmars-d-learn puremagic.com> wrote:On Tuesday, 19 September 2017 at 06:32:52 UTC, Nordl=C3=B6w wrote:I want something straight forward without allot of plumbing on my end.I can't unittest my 32-bit code: $ MODEL=3D32 make -f posix.mak unittest [...] src/msgpack/packer.d(1139): Error: function core.stdc.stdlib.malloc (uint size) is not callable using argument types (ulong)https://github.com/msgpack/msgpack-d
Dec 08 2017