Re: serialization, size errors... or something else.

  • From: "qubit" <lauraeaves@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 30 Jun 2010 17:35:51 -0500

ok, so you are inheriting from a virtual so your nodes all have virtual 
pointers. Are the serialize and deserialize functions redefined in each of 
the derived classes?
If so, then in the ISerialize class, are these functions pure virtual?
I guess I am saying maybe you shouldn't use fwrite the way you are using it 
if you have virtual functions.  But I am just suggesting; i don't have your 
code.
--le

----- Original Message ----- 
From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Wednesday, June 30, 2010 5:20 PM
Subject: Re: serialization, size errors... or something else.


Entity is just an object that can appear in game. It holds contents and 
inherits the stuff to allow for components. All things that can serialize 
inherit the ISerializable class, which has a virtual serialize and 
deserialize method.
Thanks,
Tyler Littlefield
http://tds-solutions.net
Twitter: sorressean

On Jun 30, 2010, at 4:18 PM, qubit wrote:

> oh ok -- in that case, are the serialization functions virtual?
> I mean if you have a node that is to be serialized, is it derived from a
> parent with an abstract virtual "serialize" function? I guess that would 
> be
> entity::serialize(). Do you derive classes from class entity?
> --le
>
> ----- Original Message ----- 
> From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
> To: <programmingblind@xxxxxxxxxxxxx>
> Sent: Wednesday, June 30, 2010 5:00 PM
> Subject: Re: serialization, size errors... or something else.
>
>
> Basically how this works: for root objects (objects that will be written 
> to
> a file), a save function is called to save, and a load function to load. 
> The
> save function basically opens the file, creates the serializer, passes the
> serializer off to the serialize function, then deletes it, as it's created
> on the heap. (the deleting happens after the function call). The player
> writes the members that need to be serialized after calling
> entity::serialize, and entity calls component container and variable
> container's serialization functions.
> Thanks,
> Tyler Littlefield
> http://tds-solutions.net
> Twitter: sorressean
>
> On Jun 30, 2010, at 3:57 PM, qubit wrote:
>
>> are you taking the sizeof the class and just sending the bits? You know,
>> especially when there is inheritance, there a lot of stuff going on in a
>> class object that you don't see.  A better strategy is to have each
>> component class serialize its own data.
>> If your class has multiple inheritance, that can get interesting.
>> Does that give you any ideas, or am I barking up the wrong tree?
>> --le
>>
>> ----- Original Message ----- 
>> From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
>> To: <programmingblind@xxxxxxxxxxxxx>
>> Sent: Wednesday, June 30, 2010 4:11 PM
>> Subject: Re: serialization, size errors... or something else.
>>
>>
>> I didn't mean for that to come across sounding rude, either. I'm just not
>> sure what more info is needed. I know things are broken because some
>> fields
>> are being read wrong, and I've narrowed the issue down to the Entity and
>> it's inherited classes.
>> Thanks,
>> Tyler Littlefield
>> http://tds-solutions.net
>> Twitter: sorressean
>>
>> On Jun 30, 2010, at 3:06 PM, Tyler Littlefield wrote:
>>
>>> If I had more detail things would be a lot easier to fix. as it is, I'm
>>> not quite sure what "detail" you want.
>>> Thanks,
>>> Tyler Littlefield
>>> http://tds-solutions.net
>>> Twitter: sorressean
>>>
>>> On Jun 30, 2010, at 3:04 PM, Sina Bahram wrote:
>>>
>>>> More detail, much appreciated it will be.
>>>>
>>>> Take care,
>>>> Sina
>>>>
>>>> -----Original Message-----
>>>> From: programmingblind-bounce@xxxxxxxxxxxxx
>>>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Tyler
>>>> Littlefield
>>>> Sent: Wednesday, June 30, 2010 5:02 PM
>>>> To: programmingblind@xxxxxxxxxxxxx
>>>> Subject: Re: serialization, size errors... or something else.
>>>>
>>>> I do know I'm reading to much because I get a size excception. I'm not
>>>> sure how to cut this down because the serialization works
>>>> through an inheritance hierarchy.__________ View the list's information
>>>> and change your settings at
>>>> //www.freelists.org/list/programmingblind
>>>>
>>>> __________
>>>> View the list's information and change your settings at
>>>> //www.freelists.org/list/programmingblind
>>>>
>>>
>>> __________
>>> View the list's information and change your settings at
>>> //www.freelists.org/list/programmingblind
>>>
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: