On Thu, May 29, 2008 at 8:02 PM, Lefrancois, Carl <[EMAIL PROTECTED]> wrote: >>>I'm developing a patch against the ADB C code generator to allow it >>>to > handle polymorphism correctly... > >>>Say you have a complexType A, which is abstract. Then there are > complexTypes A1 and A2, which extend A and are not abstract. > >>>The second case, however, is quite problematic...
>Hi Carl, >Here 'A' have to aware of the fact A1 and A2 are inheriting from it. In current codegen implementation it is bit hard to implement. (need to change the codegen engine implementation). The best thing is let the mapping to do from external file, (some corresponding file to 'ExtensionMapper.java'). So I will change your suggested code to something like this.. Hi Dimuthu, Agreed, your change is a more elegant way to code each ADB object's serializer. However, shouldn't there also be an external mapping of the is_particle() function if we want to keep sub-type details out of A's definition in this case? i.e. (changes marked with ***> ) void adb_A_serialize(void *element, ....) { /* serialize 'A' s element first */ if(!adb_A_is_particle()) { axutil_stream_write(stream, env, start_input_str, start_input_str_len); } serialize_content_func = axis2_extension_mapper_get_serialize_content_func(element); ***> is_particle_func = axis2_extension_mapper_get_is_particle_func(element); serialize_content_func(element, env, current_node, parent_element, ***> is_particle_func() || AXIS2_FALSE, namespaces, next_ns_index); if(!adb_A_is_particle()) { axutil_stream_write(stream, env, end_input_str, end_input_str_len); } } And in the mapper: /* for example for is_particle function */ typedef void (*ret_func_ptr)(); ret_func_ptr axis2_extension_mapper_get_is_particle_func() { if(strcmp((axis2_char_t*)(element), "A1")) { return adb_A1_is_particle; } if(strcmp((axis2_char_t*)(element), "A2")) { return adb_A2_is_particle; } } It looks like a working solution is not far :) Regards, Carl _____ "Ce message est confidentiel, a l'usage exclusif du destinataire ci-dessus et son contenu ne represente en aucun cas un engagement de la part de AXA, sauf en cas de stipulation expresse et par ecrit de la part de AXA. Toute publication, utilisation ou diffusion, meme partielle, doit etre autorisee prealablement. Si vous n'etes pas destinataire de ce message, merci d'en avertir immediatement l'expediteur." "This e-mail message is confidential, for the exclusive use of the addressee and its contents shall not constitute a commitment by AXA, except as otherwise specifically provided in writing by AXA. Any unauthorized disclosure, use or dissemination, either whole or partial, is prohibited. If you are not the intended recipient of the message, please notify the sender immediately." --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]