FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sample does not build
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic     Forum Index -> Orange
View previous topic :: View next topic  
Author Message
jaysistar



Joined: 30 Jun 2010
Posts: 31

PostPosted: Sat Aug 07, 2010 7:09 pm    Post subject: Reply with quote

doob wrote:
About the optional throwing, could you put that as a enhancement request in the ticket system so I don't forget about it.
Done. I'm duplicating the ticket opening text here:

As the Archive interface is now, the archive has only the option of throwing an Exception when given a name of a variable to deserialize that doesn't exist in the archive. This has the adverse affect of stopping deserialization, which may not be necessary.

If a variable is not found in an archive, it should tell the deserializer that it didn't find it, but it shouldn't throw. The missing variable should be initialized to its default value _by the deserializer_ not the Archive class (this is just to remove duplicating the code that does this action in all of Archive classes).

This can be done by a return value or an out parameter to each "deserialize type" function in the archive. The application must also be able to pass a parameter telling the deserializer if it wants an exception to be thrown or the missing variables to be assigned default.

Note that the Archive doesn't really ever have to throw an exception because the throwing code could then be put into the serializer (read "reused by all new Archive classes"), while the Archive could just indicate whether the variable was found.


Last edited by jaysistar on Sat Aug 07, 2010 7:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
jaysistar



Joined: 30 Jun 2010
Posts: 31

PostPosted: Sat Aug 07, 2010 7:19 pm    Post subject: Reply with quote

doob wrote:
I didn't understand much of the metadata in JSON, it sounds complicated.
Don't worry about it; it's just implementation details of Arvo's binary file format. The point was that the metadata was included. The metadata is also included in your XMLArchive class as well: In your XMLArchive each variable includes its name and type as well as its value, and it doesn't rely on an outside source (like a definition file) to know what value is meant for what variable. Arvo just happens to separate name and type metadata (in JSON) from value data (in binary).
doob wrote:
About the opEquals, that is just to overwrite the default comparison to show that two objects are considered equal, i.e. that they contain the same data. opEquals is not necessary for making the serializer work. As default opEquals compare the addresses of two objects and they will not be the same when the serialized object is deserialized.
I know, and that was a great idea: Now you could store the object once, and then store references to that object in other parts of the archive.
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Thu Aug 12, 2010 3:35 pm    Post subject: Reply with quote

I've implemented an error callback which is now called instead of throwing an exception. You can set/get the error callback like this:
Code:
serializer.errorCallback = &someMethod;

There serializer provides two default callbacks, which are set like this:
Code:
serializer.setThrowOnErrorCallback;
serializer.setDoNothingOnErrorCallback;

The signature of the callback looks like this:
Code:
void delegate (ArchiveExeption, DataType[]);
Back to top
View user's profile Send private message
jaysistar



Joined: 30 Jun 2010
Posts: 31

PostPosted: Fri Aug 13, 2010 1:55 am    Post subject: Reply with quote

Sounds great! I'll try it out sometime today.
Back to top
View user's profile Send private message
doob



Joined: 06 Jan 2007
Posts: 367

PostPosted: Fri Aug 13, 2010 2:17 am    Post subject: Reply with quote

BTW, I think we can end this topic, we are quite far away from the original topic. Please create a new topic if you want to follow up on my answer.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Orange All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group