473,513 Members | 3,076 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object serialization

ds
Hi all,

this is more a poll to ask for opinions and experiences on
serialization of objects. What toolkit do you use? If not using a
toolkit do you have your own serialization framework? What techniques
are you using? I used the boost serialization framework but - besides
the fact of having all the macros and recursive templates - it does
not work with objects from different dlls, so I am looking for
something else. Any help appreciated!!!!

BR

-- dimitris

Sep 7 '07 #1
5 1823
ds <ju***********@yahoo.comwrote:
this is more a poll to ask for opinions and experiences on
serialization of objects.
http://www.parashift.com/c++-faq-lit...alization.html
Sep 7 '07 #2
On Sep 7, 11:29 am, ds <junkmailav...@yahoo.comwrote:
Hi all,

this is more a poll to ask for opinions and experiences on
serialization of objects. What toolkit do you use? If not using a
toolkit do you have your own serialization framework? What techniques
are you using? I used the boost serialization framework but - besides
the fact of having all the macros and recursive templates - it does
not work with objects from different dlls, so I am looking for
something else. Any help appreciated!!!!

BR

-- dimitris
I tend to write my own per-class serialize and deserialize methods. To
back them up, I use a class I've written as part of the General
Systems Library project; gsDataPacker. It's a simple class with
template methods for packing and unpacking primitive types into and
out of data buffers. When I want to build serialization into a class,
I use gsDataPacker's static methods to pack and unpack member objects.
It's a simple approach that works quite well.

Sep 7 '07 #3
On Sep 7, 4:29 am, ds <junkmailav...@yahoo.comwrote:
Hi all,

this is more a poll to ask for opinions and experiences on
serialization of objects. What toolkit do you use? If not using a
toolkit do you have your own serialization framework? What techniques
are you using?
If you are talking about binary serialization you could
consider www.webebenezer.net.
>I used the boost serialization framework but - besides
the fact of having all the macros and recursive templates - it does
not work with objects from different dlls, so I am looking for
something else. Any help appreciated!!!!
I don't know if it works with objects from different dlls, but
it doesn't require macros or friend declarations. It is an
online service so downloading, building and maintaining
the installation aren't required.

Brian Wood
Ebenezer Enterprises

Sep 7 '07 #4
ds
On Sep 7, 11:57 pm, c...@mailvault.com wrote:
On Sep 7, 4:29 am, ds <junkmailav...@yahoo.comwrote:
Hi all,
this is more a poll to ask for opinions and experiences on
serialization of objects. What toolkit do you use? If not using a
toolkit do you have your own serialization framework? What techniques
are you using?

If you are talking about binary serialization you could
considerwww.webebenezer.net.
I used the boost serialization framework but - besides
the fact of having all the macros and recursive templates - it does
not work with objects from different dlls, so I am looking for
something else. Any help appreciated!!!!

I don't know if it works with objects from different dlls, but
it doesn't require macros or friend declarations. It is an
online service so downloading, building and maintaining
the installation aren't required.

Brian Wood
Ebenezer Enterprises
Hi Brian,

BOOST_SERIALIZATION_SPLIT_MEMBER, BOOST_CLASS_VERSION and so on are
macros that make my code impossible to read and maintain, because if
something goes wrong, I don't have the code that gets compiled, as it
is the case now for me...

Regards,

Dimitris

Sep 10 '07 #5
On Sep 10, 1:57 am, ds <junkmailav...@yahoo.comwrote:
On Sep 7, 11:57 pm, c...@mailvault.com wrote:
I don't know if it works with objects from different dlls, but
it doesn't require macros or friend declarations. It is an
online service so downloading, building and maintaining
the installation aren't required.
Brian Wood
Ebenezer Enterprises

Hi Brian,

BOOST_SERIALIZATION_SPLIT_MEMBER, BOOST_CLASS_VERSION and so on are
macros that make my code impossible to read and maintain, because if
something goes wrong, I don't have the code that gets compiled, as it
is the case now for me...
Shalom, Dimitris,

The B.Ser author has used macros liberally and the result is
not surprising. The BOOST_CLASS_VERSION macro is kind of the
tip of an iceberg. I'm skeptical of the approach to version support
advanced by Boost. It encourages users to have one
class for multiple releases and use if statements to figure
out which fields to work with based on the version number.
I think having separate classes when something needs to be
changed between releases is a better approach. Consider the following
scenario:

AccountBase {};

Account : public AccountBase {};

Account_13 : public Account {};

Say there are releases 1.1, 1.2 and 1.3. The Account
class is used in 1.1 and 1.2 but needs to be changed
in 1.3. The 1.3 server needs to support 1.1 and 1.2
clients. The Boost approach suggests using one class,
I'll call it B_Account, to support all of the releases.
Using a B_Account to support 1.1 clients (in a 1.3 server)
is probably wasting memory/time because it has fields in
support of 1.3 as well. And if a 1.3 client sends a
B_Account and an error occurs in the reception of the 1.3
part of the class, there is no sane way to use the 1.1
portion.

I'll explain how this could be handled better now.
Currently in C++, if the constructor of a derived
class throws an exception, the already constructed
sub objects will be destructed. IMO this default
behaviour is dubious in distributed apps. It should
be possible to write something like:

AccountBase* account = new (preserve) Account_13(...);

that would preserve a successfully constructed Account
object when an exception is thrown from Account_13's
constructor. The sender, network and receiver of the
object have put in too much work to throw it all away.
The 1.3 server is able to work with 1.1 Accounts
already so this fits in well with the big picture.

If I were using B.Ser I would want to avoid what it
refers to as "versioning" support.

Brian Wood
Ebenezer Enterprises
www.webebenezer.net

Sep 11 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7136
by: NewToDotNet | last post by:
I am getting "Object reference not set to an instance of an object. " when I attempt to open a C# windows service class in design view, although I was able to initially create the service and open in design view. This happens once I restarted Visual Studio adn opened teh solution Any ideas on how to fix this would be appreciated.. BR...
0
2057
by: Philip Reed | last post by:
I'm trying to write a preferences-handling infrastructure that serializes prefs to XML. Basically I want to read in a common "default" prefs set, then read in the user's prefs and override the defaults as appropriate. I'm trying to do them both using the SoapFormatter to serialize. But when I try to read in the user's prefs after reading...
5
7562
by: Mark Rae | last post by:
Hi, Can anyone please tell me how to convert an object say, a System.Web.Mail.MailMessage object, to a byte array and then convert the byte array to a Base64 string? Any assistance gratefully received. Best regards,
8
12650
by: rawCoder | last post by:
Hi All, I need some advanced samples or references for passing custom objects over the network using sockets. Without using Remoting what are other options in .NET Framework for this binary serialization. Thank You rawCoder
3
2742
by: AVL | last post by:
Hi, I'm new to .net. I need some info on serialization. What is serialization? Why do we need it? Why objects need to be serialized if they need to be stored in session or viewstate?
5
2257
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2 = "otherText" xmlSave("C:\folder\file.xml", mySettings) Here is the sub: Public Shared Sub xmlSave(ByVal path As String, ByVal config As
1
5526
by: J. Askey | last post by:
I am implementing a web service and thought it may be a good idea to return a more complex class (which I have called 'ServiceResponse') in order to wrap the original return value along with two other properties... bool error; string lastError; My whole class looks like this... using System;
3
2142
by: benkial | last post by:
Below is a custom exception class that I created to be shared by my C+ + and C# code. It works fine till I need to pass the exception object through Remoting: every time a FtException is raized in the Remoting server side, the client got the following error (see below). Based on my Google search, I did the best I can to have a constructor...
0
1893
by: anchiang | last post by:
Hi All, I have XML: <RegistryResponse status="Success" xmlns="urn:oasis:names:tc:ebxml-regrep:registry:xsd:2.1"> <AdhocQueryResponse xmlns="urn:oasis:names:tc:ebxml-regrep:query:xsd:2.1"> <SQLQueryResult> <ObjectRef id="urn:uuid:425cb4ea-752c-4276-ae52-db295e8e7dc4" /> <ObjectRef...
3
2112
by: Jeremy | last post by:
I've created a serializable class and put attributes around all the properties that should be serialized. I return the class from a web service, but my problem is that the wsdl for the web service is only including the Values poperty, and nothing else. Also, when the object gets serialized out, only the Values property gets serialized. I...
0
7269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5701
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.