From: "Iñaki Baz Castillo" Date: 2008-04-15T05:39:03+09:00 Subject: Re: How to duplicate a object changing the class without attributes memory copy El Lunes, 14 de Abril de 2008, Robert Klemme escribió: > 2008/4/12, Iñaki Baz Castillo : > > 2008/4/12, Joel VanderWerf : > > > Why do you need a From class that is distinct from Header? > > > > Because in an initial parsing I just get a headers array, whiotu > > inspecting each of them. > > Later, if I need, I look for some specific headers (From, To...) and > > need to add some methods to them. > > IMHO it is more efficient and less error prone if you create > appropriate instances during initial parsing. You have all the > information at that point in time plus you you save one additional > pass through the collection. Yes, but let me explain: I'm doing a SIP protocol parser. In SIP a repeated request can be received because retransmissions and there is no need at all of parsing the entire request to know if it's a retransmission (since it will be discarded). Also, I don't need to parse all the headers, but I cannot know which headers I'll need to parse since that is a application layer decission instead of transport layer decission. For example: If I implement a SIp proxy I just need to parse some headers, if I do a SIP server UAS I need to parse others. Transport layer is common but application layer not, so I don't need to do all the parsing in transport layer. Thanks a lot for all you suggestions and help. Best regards. -- Iñaki Baz Castillo