1 /*
2  * Portions of this file Copyright 1999-2005 University of Chicago
3  * Portions of this file Copyright 1999-2005 The University of Southern California.
4  *
5  * This file or a portion of this file is licensed under the
6  * terms of the Globus Toolkit Public License, found at
7  * http://www.globus.org/toolkit/download/license.html.
8  * If you redistribute this file, with or without
9  * modifications, you must include this notice in the file.
10  */
11
12
13 /*
14  * This file is automatically generated by the Globus WSDLtoC converter
15  */
16
17 #include "xsd_QName.h"
18 #include "globus_soap_message.h"
19 #include "globus_xsd_type_info.h"
20 #include "ds_SignaturePropertyType.h"
21
22 xsd_QName ds_SignaturePropertyType_choice_qname =
23 {
24     "http://www.w3.org/2000/09/xmldsig#",
25     "SignaturePropertyType_choice"
26 };
27
28 globus_result_t
29 ds_SignaturePropertyType_choice_serialize_wrapper(
30     xsd_QName *                         element_qname,
31     void *                              instance,
32     globus_soap_message_handle_t        message_handle,
33     globus_xsd_element_options_t        options)
34 0 {
35 0     return ds_SignaturePropertyType_choice_serialize(
36         element_qname,
37         (ds_SignaturePropertyType_choice *) instance,
38         message_handle, options);
39 }
40
41 globus_result_t
42 ds_SignaturePropertyType_choice_deserialize_pointer_wrapper(
43     xsd_QName *                         element_qname,
44     void **                             ip,
45     globus_soap_message_handle_t        message_handle,
46     globus_xsd_element_options_t        options)
47 0 {
48 0     return ds_SignaturePropertyType_choice_deserialize_pointer(
49         element_qname,
50         (ds_SignaturePropertyType_choice **) ip,
51         message_handle, options);
52 }
53
54 globus_result_t
55 ds_SignaturePropertyType_choice_init_wrapper(void **object)
56 0 {
57 0     return ds_SignaturePropertyType_choice_init(
58         (ds_SignaturePropertyType_choice **) object);
59 }
60
61 void
62 ds_SignaturePropertyType_choice_destroy_wrapper(
63     void *                          object)
64 0 {
65 0     ds_SignaturePropertyType_choice_destroy(
66         (ds_SignaturePropertyType_choice *) object);
67 }
68
69 globus_result_t
70 ds_SignaturePropertyType_choice_copy_wrapper(
71     void **                         dest_obj,
72     void *                          src_obj)
73 0 {
74 0     return ds_SignaturePropertyType_choice_copy(
75         (ds_SignaturePropertyType_choice **) dest_obj,
76         (ds_SignaturePropertyType_choice *) src_obj);
77 }
78
79 globus_result_t
80 ds_SignaturePropertyType_choice_init_contents_wrapper(void *object)
81 0 {
82 0     return ds_SignaturePropertyType_choice_init_contents(
83         (ds_SignaturePropertyType_choice *) object);
84 }
85
86 void
87 ds_SignaturePropertyType_choice_destroy_contents_wrapper(
88     void *                          object)
89 0 {
90 0     ds_SignaturePropertyType_choice_destroy_contents(
91         (ds_SignaturePropertyType_choice *) object);
92 }
93
94 globus_result_t
95 ds_SignaturePropertyType_choice_copy_contents_wrapper(
96     void *                          dest_obj,
97     void *                          src_obj)
98 0 {
99 0     return ds_SignaturePropertyType_choice_copy_contents(
100         (ds_SignaturePropertyType_choice *) dest_obj,
101         (ds_SignaturePropertyType_choice *) src_obj);
102 }
103
104 globus_result_t
105 ds_SignaturePropertyType_choice_serialize_contents_wrapper(
106     xsd_QName *                         element_qname,
107     void *                              instance,
108     globus_soap_message_handle_t        message_handle,
109     globus_xsd_element_options_t        options)
110 0 {
111 0     return ds_SignaturePropertyType_choice_serialize_contents(
112         element_qname,
113         (ds_SignaturePropertyType_choice *) instance,
114         message_handle, options);
115 }
116
117 globus_result_t
118 ds_SignaturePropertyType_choice_deserialize_contents_wrapper(
119     xsd_QName *                         element_qname,
120     void **                             instance,
121     globus_soap_message_handle_t        message_handle,
122     globus_xsd_element_options_t        options)
123 0 {
124 0     globus_result_t                     result;
125 0     GlobusFuncName(ds_SignaturePropertyType_choice_deserialize_contents_wrapper);
126 0     GlobusSoapMessageDebugEnter();
127
128 0     if(!*instance)
129     {
130 0         result = ds_SignaturePropertyType_choice_init(
131             (ds_SignaturePropertyType_choice **)instance);
132 0         if(result != GLOBUS_SUCCESS)
133         {
134 0             goto error;
135         }
136     }
137
138 0     result = ds_SignaturePropertyType_choice_deserialize_contents(
139         element_qname,
140         *(ds_SignaturePropertyType_choice **)instance,
141         message_handle, options);
142 error:
143 0     GlobusSoapMessageDebugExit();
144 0     return result;
145 }
146
147 globus_result_t
148 ds_SignaturePropertyType_choice_array_serialize_wrapper(
149     xsd_QName *                     element,
150     void *                          instance,
151     globus_soap_message_handle_t    message,
152     globus_xsd_element_options_t    options)
153 0 {
154 0     return ds_SignaturePropertyType_choice_array_serialize(
155         element,
156         (ds_SignaturePropertyType_choice_array *) instance,
157         message, options);
158 }
159
160 globus_result_t
161 ds_SignaturePropertyType_choice_array_deserialize_wrapper(
162     xsd_QName *                         element_qname,
163     void **                             inst,
164     globus_soap_message_handle_t        message,
165     globus_xsd_element_options_t        options)
166 0 {
167 0     if(!*inst)
168     {
169 0         globus_result_t                 result;
170
171 0         result = ds_SignaturePropertyType_choice_array_init(
172             (ds_SignaturePropertyType_choice_array **)inst);
173 0         if(result != GLOBUS_SUCCESS)
174         {
175 0             return result;
176         }
177     }
178
179 0     return ds_SignaturePropertyType_choice_array_deserialize(
180         element_qname,
181         *(ds_SignaturePropertyType_choice_array **) inst,
182         message, options);
183 }
184
185 globus_result_t
186 ds_SignaturePropertyType_choice_array_init_wrapper(
187     void **                             arr)
188 0 {
189 0     return ds_SignaturePropertyType_choice_array_init(
190         (ds_SignaturePropertyType_choice_array **) arr);
191 }
192
193 void
194 ds_SignaturePropertyType_choice_array_destroy_wrapper(
195     void *                              arr)
196 0 {
197 0     ds_SignaturePropertyType_choice_array_destroy(
198         (ds_SignaturePropertyType_choice_array *) arr);
199 }
200
201 globus_result_t
202 ds_SignaturePropertyType_choice_array_copy_wrapper(
203     void **                             dest_arr,
204     void *                              src_arr)
205 0 {
206 0     return ds_SignaturePropertyType_choice_array_copy(
207         (ds_SignaturePropertyType_choice_array **) dest_arr,
208         (ds_SignaturePropertyType_choice_array *) src_arr);
209 }
210
211 globus_result_t
212 ds_SignaturePropertyType_choice_array_init_contents_wrapper(
213     void *                              arr)
214 0 {
215 0     return ds_SignaturePropertyType_choice_array_init_contents(
216         (ds_SignaturePropertyType_choice_array *) arr);
217 }
218
219 void
220 ds_SignaturePropertyType_choice_array_destroy_contents_wrapper(
221     void *                              arr)
222 0 {
223 0     ds_SignaturePropertyType_choice_array_destroy_contents(
224         (ds_SignaturePropertyType_choice_array *) arr);
225 }
226
227 globus_result_t
228 ds_SignaturePropertyType_choice_array_copy_contents_wrapper(
229     void *                              dest_arr,
230     void *                              src_arr)
231 0 {
232 0     return ds_SignaturePropertyType_choice_array_copy_contents(
233         (ds_SignaturePropertyType_choice_array *) dest_arr,
234         (ds_SignaturePropertyType_choice_array *) src_arr);
235 }
236
237 struct globus_xsd_type_info_s ds_SignaturePropertyType_choice_array_info =
238 {
239     &ds_SignaturePropertyType_choice_qname,
240     ds_SignaturePropertyType_choice_array_serialize_wrapper,
241     ds_SignaturePropertyType_choice_array_deserialize_wrapper,
242     ds_SignaturePropertyType_choice_array_init_wrapper,
243     ds_SignaturePropertyType_choice_array_destroy_wrapper,
244     ds_SignaturePropertyType_choice_array_copy_wrapper,
245     ds_SignaturePropertyType_choice_array_init_contents_wrapper,
246     ds_SignaturePropertyType_choice_array_destroy_contents_wrapper,
247     ds_SignaturePropertyType_choice_array_copy_contents_wrapper,
248     sizeof(ds_SignaturePropertyType_choice),
249     ds_SignaturePropertyType_choice_array_push_wrapper,
250     NULL,
251     NULL
252 };
253
254 struct globus_xsd_type_info_s ds_SignaturePropertyType_choice_contents_info =
255 {
256     &ds_SignaturePropertyType_choice_qname,
257     ds_SignaturePropertyType_choice_serialize_contents_wrapper,
258     ds_SignaturePropertyType_choice_deserialize_contents_wrapper,
259     ds_SignaturePropertyType_choice_init_wrapper,
260     ds_SignaturePropertyType_choice_destroy_wrapper,
261     ds_SignaturePropertyType_choice_copy_wrapper,
262     ds_SignaturePropertyType_choice_init_contents_wrapper,
263     ds_SignaturePropertyType_choice_destroy_contents_wrapper,
264     ds_SignaturePropertyType_choice_copy_contents_wrapper,
265     sizeof(ds_SignaturePropertyType_choice),
266     NULL,
267     NULL,
268     NULL
269 };
270
271 struct globus_xsd_type_info_s ds_SignaturePropertyType_choice_info =
272 {
273     &ds_SignaturePropertyType_choice_qname,
274     ds_SignaturePropertyType_choice_serialize_wrapper,
275     ds_SignaturePropertyType_choice_deserialize_pointer_wrapper,
276     ds_SignaturePropertyType_choice_init_wrapper,
277     ds_SignaturePropertyType_choice_destroy_wrapper,
278     ds_SignaturePropertyType_choice_copy_wrapper,
279     ds_SignaturePropertyType_choice_init_contents_wrapper,
280     ds_SignaturePropertyType_choice_destroy_contents_wrapper,
281     ds_SignaturePropertyType_choice_copy_contents_wrapper,
282     sizeof(ds_SignaturePropertyType),
283     NULL,
284     &ds_SignaturePropertyType_choice_contents_info,
285     &ds_SignaturePropertyType_choice_array_info
286 };
287
288 globus_result_t
289 ds_SignaturePropertyType_choice_init_contents(
290     ds_SignaturePropertyType_choice *                    instance)
291 0 {
292 0     globus_result_t                     result = GLOBUS_SUCCESS;
293 0     GlobusFuncName(ds_SignaturePropertyType_choice_init_contents);
294 0     GlobusSoapMessageDebugEnter();
295
296 0     memset(instance, 0, sizeof(ds_SignaturePropertyType));
297
298 0     GlobusSoapMessageDebugExit();
299 0     return result;
300 }
301
302 globus_result_t
303 ds_SignaturePropertyType_choice_init(
304     ds_SignaturePropertyType_choice ** object)
305 0 {
306 0     ds_SignaturePropertyType_choice * instance;
307 0     globus_result_t                     result = GLOBUS_SUCCESS;
308 0     GlobusFuncName(ds_SignaturePropertyType_choice_init);
309 0     GlobusSoapMessageDebugEnter();
310
311 0     instance = globus_malloc(sizeof(ds_SignaturePropertyType_choice));
312 0     if(!instance)
313     {
314 0         result = GlobusSoapMessageErrorOutOfMemory;
315 0         goto exit;
316     }
317
318 0     memset(instance, 0, sizeof(ds_SignaturePropertyType_choice));
319
320 0     *object = instance;
321
322  exit:
323 0     GlobusSoapMessageDebugExit();
324 0     return result;
325 }
326
327 void
328 ds_SignaturePropertyType_choice_destroy(
329     ds_SignaturePropertyType_choice * instance)
330 0 {
331 0     GlobusFuncName(ds_SignaturePropertyType_choice_destroy);
332 0     GlobusSoapMessageDebugEnter();
333
334 0     if(!instance)
335     {
336 0         goto exit;
337     }
338
339 0     ds_SignaturePropertyType_choice_destroy_contents(instance);
340 0     free(instance);
341
342  exit:
343
344 0     GlobusSoapMessageDebugExit();
345 }
346
347
348
349 void
350 ds_SignaturePropertyType_choice_destroy_contents(
351     ds_SignaturePropertyType_choice * instance)
352 0 {
353 0     GlobusFuncName(ds_SignaturePropertyType_choice_destroy_contents);
354 0     GlobusSoapMessageDebugEnter();
355
356 0     switch(instance->type)
357     {
358
359     case ds_SignaturePropertyType_any:
360
361 0         xsd_any_destroy_contents(
362              &instance->value.any);
363         break;
364
365         default:
366 0             break;
367     }
368
369 0     instance->type = ds_SignaturePropertyType_undefined;
370
371 0     GlobusSoapMessageDebugExit();
372 }
373
374 globus_result_t
375 ds_SignaturePropertyType_choice_copy(
376     ds_SignaturePropertyType_choice ** dest_obj,
377     const ds_SignaturePropertyType_choice * src_obj)
378 0 {
379 0     globus_result_t                     result = GLOBUS_SUCCESS;
380 0     ds_SignaturePropertyType_choice * instance;
381 0     GlobusFuncName(ds_SignaturePropertyType_choice_copy);
382
383 0     GlobusSoapMessageDebugEnter();
384
385 0     instance = malloc(sizeof(ds_SignaturePropertyType_choice));
386 0     if (instance == NULL)
387     {
388 0         GlobusSoapMessageDebugExit();
389 0         return GlobusSoapMessageErrorOutOfMemory;
390     }
391
392 0     result = ds_SignaturePropertyType_choice_copy_contents(instance, src_obj);
393 0     if(result != GLOBUS_SUCCESS)
394     {
395 0         globus_free(instance);
396 0         GlobusSoapMessageDebugExit();
397 0         return GlobusSoapMessageErrorOutOfMemory;
398     }
399
400 0     *dest_obj = instance;
401 0     GlobusSoapMessageDebugExit();
402 0     return result;
403 }
404
405
406
407 globus_result_t
408 ds_SignaturePropertyType_choice_copy_contents(
409     ds_SignaturePropertyType_choice * instance,
410     const ds_SignaturePropertyType_choice * src_obj)
411 0 {
412 0     xsd_QName                           subelement;
413 0     globus_result_t                     result = GLOBUS_SUCCESS;
414 0     GlobusFuncName(ds_SignaturePropertyType_choice_copy_contents);
415
416 0     GlobusSoapMessageDebugEnter();
417
418 0     switch(src_obj->type)
419     {
420
421     case ds_SignaturePropertyType_any:
422 0         instance->type = ds_SignaturePropertyType_any;
423 0         result = xsd_any_copy_contents(
424             &instance->value.any,
425             &src_obj->value.any);
426 0         if(result != GLOBUS_SUCCESS)
427         {
428 0             result = GlobusSoapMessageErrorSerializeFailed(
429                 result, NULL, &ds_SignaturePropertyType_choice_qname);
430             goto exit;
431         }
432
433 0         break;
434
435     default:
436 0         break;
437     }
438
439  exit:
440
441 0     GlobusSoapMessageDebugExit();
442 0     return result;
443 }
444
445
446
447
448
449 globus_result_t
450 ds_SignaturePropertyType_choice_serialize_contents(
451     xsd_QName *                         element_qname, /* ignored */
452     ds_SignaturePropertyType_choice * instance,
453     globus_soap_message_handle_t        message_handle,
454     globus_xsd_element_options_t        options)
455 0 {
456 0     xsd_QName                           subelement;
457 0     globus_result_t                     result = GLOBUS_SUCCESS;
458 0     GlobusFuncName(ds_SignaturePropertyType_choice_serialize_contents);
459 0     GlobusSoapMessageDebugEnter();
460
461 0     switch(instance->type)
462     {
463
464     case ds_SignaturePropertyType_any:
465
466 0         subelement.local = "any";
467 0         subelement.Namespace = "http://www.w3.org/2001/XMLSchema";
468 0         result = xsd_any_serialize(
469             &subelement,
470             &instance->value.any,
471             message_handle,
472             options);
473 0         if(result != GLOBUS_SUCCESS)
474         {
475 0             result = GlobusSoapMessageErrorSerializeFailed(
476                 result, NULL, &ds_SignaturePropertyType_choice_qname);
477             goto exit;
478         }
479
480 0         break;
481
482         default:
483 0             break;
484     }
485
486  exit:
487
488 0     GlobusSoapMessageDebugExit();
489 0     return result;
490 }
491
492
493
494 globus_result_t
495 ds_SignaturePropertyType_choice_serialize(
496     xsd_QName *                         element_qname,
497     ds_SignaturePropertyType_choice *             instance,
498     globus_soap_message_handle_t        message_handle,
499     globus_xsd_element_options_t        options)
500 0 {
501 0     globus_result_t                     result = GLOBUS_SUCCESS;
502 0     GlobusFuncName(ds_SignaturePropertyType_choice_serialize);
503 0     GlobusSoapMessageDebugEnter();
504
505 0     result = ds_SignaturePropertyType_choice_serialize_contents(
506         element_qname,
507         instance,
508         message_handle,
509         options);
510 0     if(result != GLOBUS_SUCCESS)
511     {
512 0         result = GlobusSoapMessageErrorSerializeFailed(
513             result, NULL, &ds_SignaturePropertyType_choice_qname);
514         goto exit;
515     }
516
517  exit:
518 0     GlobusSoapMessageDebugExit();
519 0     return result;
520 }
521
522
523
524
525
526 globus_result_t
527 ds_SignaturePropertyType_choice_deserialize_contents(
528     xsd_QName *                         element_qname, /* ignored */
529     ds_SignaturePropertyType_choice * instance,
530     globus_soap_message_handle_t        message_handle,
531     globus_xsd_element_options_t        options)
532 0 {
533 0     globus_result_t                     result = GLOBUS_SUCCESS;
534 0     GlobusFuncName(ds_SignaturePropertyType_choice_deserialize_contents);
535 0     GlobusSoapMessageDebugEnter();
536
537 0     result = ds_SignaturePropertyType_choice_deserialize(
538         NULL,
539         instance,
540         message_handle,
541         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
542 0     if(result != GLOBUS_SUCCESS)
543     {
544 0         result = GlobusSoapMessageErrorDeserializeFailed(
545             result, element_qname);
546         goto exit;
547     }
548
549  exit:
550
551 0     GlobusSoapMessageDebugExit();
552 0     return result;
553 }
554
555
556
557 globus_result_t
558 ds_SignaturePropertyType_choice_deserialize(
559     xsd_QName *                         element_qname,
560     ds_SignaturePropertyType_choice * instance,
561     globus_soap_message_handle_t        message_handle,
562     globus_xsd_element_options_t        options)
563 0 {
564 0     globus_result_t                     result = GLOBUS_SUCCESS;
565 0     xsd_QName                           subelement;
566 0     xsd_QName                           deselem_qname = { NULL, NULL } ;
567 0     GlobusFuncName(ds_SignaturePropertyType_choice_deserialize);
568 0     GlobusSoapMessageDebugEnter();
569
570 0     xsd_QName_init_contents(&deselem_qname);
571
572 0     do
573     {
574 0         result = globus_soap_message_deserialize_element_unknown(
575             message_handle, &deselem_qname);
576 0         if(result != GLOBUS_SUCCESS)
577         {
578 0             result = GlobusSoapMessageErrorDeserializeFailed(
579                 result, &ds_SignaturePropertyType_choice_qname);
580 0             goto exit;
581         }
582
583 0         if(globus_soap_message_deserialize_element_is_nil(message_handle))
584         {
585 0             xsd_QName_destroy_contents(&deselem_qname);
586 0             result = globus_soap_message_deserialize_element_end(
587                 message_handle,
588                 element_qname);
589 0             if(result != GLOBUS_SUCCESS)
590             {
591 0                 result = GlobusSoapMessageErrorDeserializeFailed(
592                     result, &ds_SignaturePropertyType_choice_qname);
593 0                 goto exit;
594             }
595         }
596         else
597         {
598 0             break;
599         }
600 0     } while(1);
601
602 0     globus_soap_message_deserialize_push_element(message_handle);
603
604     /* try to parse as any element */
605 0     result = xsd_any_deserialize(
606         &subelement,
607         &instance->value.any,
608         message_handle,
609         options);
610 0     if(result != GLOBUS_SUCCESS)
611     {
612 0         result = GlobusSoapMessageErrorDeserializeFailed(
613             result, &ds_SignaturePropertyType_choice_qname);
614 0         goto any_destroy;
615     }
616     else
617     {
618 0         instance->type=ds_SignaturePropertyType_any;
619         goto exit;
620     }
621
622 0     instance->type = ds_SignaturePropertyType_undefined;
623  
624 0     goto exit;
625
626  deserialize_failed:
627
628  any_destroy: 
629
630  exit:
631
632 0     xsd_QName_destroy_contents(&deselem_qname);
633
634 0     if(result == GLOBUS_SUCCESS)
635     {
636 0         do
637         {
638 0             result = globus_soap_message_deserialize_element(
639                 message_handle, NULL);
640 0             if(result != GLOBUS_SUCCESS &&
641                (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
642                 GlobusSoapMessageStatusFailedElementCheck(result) ||
643                 GlobusSoapMessageStatusFailedWithTextCheck(result)))
644             {
645 0                 result = GLOBUS_SUCCESS;
646 0                 break;
647             }
648
649 0             if(globus_soap_message_deserialize_element_is_nil(
650                    message_handle))
651             {
652 0                 result = globus_soap_message_deserialize_element_end(
653                     message_handle,
654                     element_qname);
655 0                 if(result != GLOBUS_SUCCESS)
656                 {
657 0                     result = GlobusSoapMessageErrorDeserializeFailed(
658                         result, &ds_SignaturePropertyType_choice_qname);
659                     break;
660                 }
661             }
662             else
663             {
664 0                 break;
665             }
666
667 0         } while(1);
668     }
669
670 0     xsd_QName_destroy_contents(&deselem_qname);
671
672 0     GlobusSoapMessageDebugExit();
673 0     return result;
674 }
675
676
677
678 globus_result_t
679 ds_SignaturePropertyType_choice_deserialize_pointer(
680     xsd_QName *                         element_qname,
681     ds_SignaturePropertyType_choice ** ip,
682     globus_soap_message_handle_t        message_handle,
683     globus_xsd_element_options_t        options)
684 0 {
685 0     ds_SignaturePropertyType_choice * instance = NULL;
686 0     globus_result_t                     result = GLOBUS_SUCCESS;
687 0     xsd_QName                           subelement;
688 0     GlobusFuncName(ds_SignaturePropertyType_choice_deserialize_pointer);
689 0     GlobusSoapMessageDebugEnter();
690
691 0     *ip = NULL;
692
693 0     result = ds_SignaturePropertyType_choice_init(&instance);
694 0     if(result != GLOBUS_SUCCESS)
695     {
696 0         result = GlobusSoapMessageErrorDeserializeFailed(
697             result, element_qname);
698 0         goto exit;
699     }
700
701 0     result = ds_SignaturePropertyType_choice_deserialize_contents(
702         element_qname,
703         instance,
704         message_handle,
705         options);
706 0     if(result != GLOBUS_SUCCESS)
707     {
708 0         goto exit;
709     }
710
711 0     *ip = instance;
712
713  exit:
714
715 0     GlobusSoapMessageDebugExit();
716 0     return result;
717 }
718
719
720
721 globus_result_t
722 ds_SignaturePropertyType_choice_array_init_contents(
723     ds_SignaturePropertyType_choice_array * array)
724 0 {
725 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_init_contents);
726 0     GlobusSoapMessageDebugEnter();
727
728 0     memset(array, 0, sizeof(ds_SignaturePropertyType_choice_array));
729
730 0     GlobusSoapMessageDebugExit();
731 0     return GLOBUS_SUCCESS;
732 }
733
734 globus_result_t
735 ds_SignaturePropertyType_choice_array_init(
736     ds_SignaturePropertyType_choice_array ** arr)
737 0 {
738 0     ds_SignaturePropertyType_choice_array * array;
739 0     globus_result_t                     result;
740 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_init);
741 0     GlobusSoapMessageDebugEnter();
742
743 0     array = (ds_SignaturePropertyType_choice_array *)
744         globus_malloc(sizeof(ds_SignaturePropertyType_choice_array));
745 0     if(!array)
746     {
747 0         result = GlobusSoapMessageErrorOutOfMemory;
748 0         goto exit;
749     }
750        
751 0     result = ds_SignaturePropertyType_choice_array_init_contents(array);
752 0     if(result != GLOBUS_SUCCESS)
753     {
754 0         globus_free(array);
755 0         array = NULL;
756     }
757
758 0     *arr = array;
759
760  exit:
761 0     GlobusSoapMessageDebugExit();
762 0     return result;
763 }
764
765 void
766 ds_SignaturePropertyType_choice_array_destroy_contents(
767     ds_SignaturePropertyType_choice_array * array)
768 0 {
769 0     int                                 i = 0;
770 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_destroy_contents);
771 0     GlobusSoapMessageDebugEnter();
772
773 0     for(; i < array->length; ++i)
774     {
775 0         ds_SignaturePropertyType_choice_destroy_contents(&array->elements[i]);
776     }
777
778 0     if(array->elements)
779     {
780 0         globus_free(array->elements);
781 0         array->elements = NULL;
782     }
783 0     array->length = 0;
784
785 0     GlobusSoapMessageDebugExit();
786 }
787
788 void
789 ds_SignaturePropertyType_choice_array_destroy(
790     ds_SignaturePropertyType_choice_array * array)
791 0 {
792 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_destroy);
793 0     GlobusSoapMessageDebugEnter();
794
795 0     ds_SignaturePropertyType_choice_array_destroy_contents(array);
796 0     globus_free(array);
797
798 0     GlobusSoapMessageDebugExit();
799 }
800
801 globus_result_t
802 ds_SignaturePropertyType_choice_array_copy(
803     ds_SignaturePropertyType_choice_array ** dest_arr,
804     const ds_SignaturePropertyType_choice_array * src_arr)
805 0 {
806 0     ds_SignaturePropertyType_choice_array * array;
807 0     globus_result_t                     result;
808 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_copy);
809 0     GlobusSoapMessageDebugEnter();
810
811 0     array = (ds_SignaturePropertyType_choice_array *) malloc(
812         sizeof(ds_SignaturePropertyType_choice_array));
813 0     if(!array)
814     {
815 0         result = GlobusSoapMessageErrorOutOfMemory;
816 0         GlobusSoapMessageDebugExit();
817 0         return result;
818     }
819
820 0     result = ds_SignaturePropertyType_choice_array_copy_contents(array, src_arr);
821 0     if(result != GLOBUS_SUCCESS)
822     {
823 0         globus_free(array);
824 0         GlobusSoapMessageDebugExit();
825 0         return result;
826     }
827
828 0     *dest_arr = array;
829
830 0     GlobusSoapMessageDebugExit();
831 0     return GLOBUS_SUCCESS;
832 }
833
834 globus_result_t
835 ds_SignaturePropertyType_choice_array_copy_contents(
836     ds_SignaturePropertyType_choice_array * dest_arr,
837     const ds_SignaturePropertyType_choice_array * src_arr)
838 0 {
839 0     int                                 i;
840 0     globus_result_t                     result = GLOBUS_SUCCESS;
841 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_copy_contents);
842 0     GlobusSoapMessageDebugEnter();
843
844 0     dest_arr->length = src_arr->length;
845 0     if(dest_arr->length > 0)
846     {
847 0         dest_arr->elements = (ds_SignaturePropertyType_choice *) malloc(
848             sizeof(ds_SignaturePropertyType_choice) * dest_arr->length);
849 0         if(!dest_arr->elements)
850         {
851 0             result = GlobusSoapMessageErrorOutOfMemory;
852 0             goto exit;
853         }
854     }
855     else
856     {
857 0         dest_arr->elements = NULL;
858     }
859     
860 0     for(i = 0; i < dest_arr->length; i++)
861     {
862 0         result = ds_SignaturePropertyType_choice_copy_contents(
863             &dest_arr->elements[i], &src_arr->elements[i]);
864 0         if(result != GLOBUS_SUCCESS)
865         {
866 0             while(i--)
867             {
868 0                 ds_SignaturePropertyType_choice_destroy_contents(&dest_arr->elements[i]);
869             }
870
871 0             globus_free(dest_arr->elements);
872 0             dest_arr->elements = NULL;
873 0             dest_arr->length = 0;
874 0             break;
875         }
876     }
877
878  exit:
879 0     GlobusSoapMessageDebugExit();
880 0     return result;
881 }
882
883 ds_SignaturePropertyType_choice *
884 ds_SignaturePropertyType_choice_array_push(
885     ds_SignaturePropertyType_choice_array * array)
886 0 {
887 0     ds_SignaturePropertyType_choice *             tmp;
888
889 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_push);
890 0     GlobusSoapMessageDebugEnter();
891
892 0     tmp = realloc(array->elements,
893                           sizeof(ds_SignaturePropertyType_choice) *
894                           (array->length + 1));
895 0     if (tmp == NULL)
896     {
897 0         goto error;
898     }
899 0     array->elements = tmp;
900
901 0     memset(&array->elements[array->length], 0, sizeof(ds_SignaturePropertyType_choice));
902 0     array->length++;
903
904 0     GlobusSoapMessageDebugExit();
905 0     return (&array->elements[array->length - 1]);
906 error:
907 0     GlobusSoapMessageDebugExit();
908 0     return NULL;
909 }
910
911 void *
912 ds_SignaturePropertyType_choice_array_push_wrapper(
913     void * array)
914 0 {
915 0     return (void *) ds_SignaturePropertyType_choice_array_push(
916         (ds_SignaturePropertyType_choice_array *) array);
917 }
918
919 globus_result_t
920 ds_SignaturePropertyType_choice_array_serialize(
921     xsd_QName *                         element_qname,
922     ds_SignaturePropertyType_choice_array * array,
923     globus_soap_message_handle_t        message,
924     globus_xsd_element_options_t        options)
925 0 {
926 0     globus_result_t                     result = GLOBUS_SUCCESS;
927 0     int                                 i = 0;
928 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_serialize);
929 0     GlobusSoapMessageDebugEnter();
930
931 0     for(; i < array->length; ++i)
932     {
933 0         result = ds_SignaturePropertyType_choice_serialize(
934             element_qname,
935             &array->elements[i],
936             message,
937             options);
938 0         if(result != GLOBUS_SUCCESS)
939         {
940 0             goto exit;
941         }
942     }
943
944 exit:
945
946 0     GlobusSoapMessageDebugExit();
947 0     return result;
948 }
949
950 globus_result_t
951 ds_SignaturePropertyType_choice_array_deserialize(
952     xsd_QName *                         element_qname,
953     ds_SignaturePropertyType_choice_array * array,
954     globus_soap_message_handle_t        message,
955     globus_xsd_element_options_t        options)
956 0 {
957 0     globus_result_t                     result = GLOBUS_SUCCESS;
958 0     int                                 i = 0;
959 0     int                                 pre_length;
960 0     GlobusFuncName(ds_SignaturePropertyType_choice_array_deserialize);
961 0     GlobusSoapMessageDebugEnter();
962
963 0     pre_length = array->length;
964
965 0     for(i = 0; i < pre_length; ++i)
966     {
967 0         result = ds_SignaturePropertyType_choice_deserialize(
968             element_qname,
969             &array->elements[i],
970             message,
971             options);
972 0         if(result != GLOBUS_SUCCESS)
973         {
974 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
975                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
976                GlobusSoapMessageStatusFailedWithTextCheck(result))
977             {
978 0                 result = GLOBUS_SUCCESS;
979 0                 break;
980             }
981
982 0             result = GlobusSoapMessageErrorDeserializeFailed(
983                 result, element_qname);
984 0             goto exit;
985         }
986     }
987
988 0     while(result == GLOBUS_SUCCESS)
989     {
990 0         ds_SignaturePropertyType_choice next;
991 0         memset(&next, 0, sizeof(ds_SignaturePropertyType_choice));
992
993 0         result = ds_SignaturePropertyType_choice_deserialize(
994             element_qname,
995             &next,
996             message,
997             options);
998 0         if(result != GLOBUS_SUCCESS)
999         {
1000 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1001                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1002                GlobusSoapMessageStatusFailedWithTextCheck(result))
1003             {
1004 0                 result = GLOBUS_SUCCESS;
1005 0                 break;
1006             }
1007
1008 0             result = GlobusSoapMessageErrorDeserializeFailed(
1009                 result, element_qname);
1010 0             goto exit;
1011         }
1012
1013 0         array->elements = realloc(
1014             array->elements,
1015             (array->length + 1) * sizeof(ds_SignaturePropertyType_choice));
1016 0         if(!array->elements)
1017         {
1018 0             result = GlobusSoapMessageErrorOutOfMemory;
1019 0             goto exit;
1020         }
1021 0         array->elements[array->length] = next;
1022 0         array->length++;
1023 0         ++i;
1024     }
1025
1026   exit:
1027
1028 0     if(result != GLOBUS_SUCCESS)
1029     {
1030 0         int                             di = 0;
1031 0         for(; di < i; ++di)
1032         {
1033 0             ds_SignaturePropertyType_choice_destroy_contents(
1034                 &array->elements[di]);
1035 0             memset(&array->elements[di], 0, sizeof(ds_SignaturePropertyType_choice));
1036         }
1037     }
1038
1039 0     GlobusSoapMessageDebugExit();
1040 0     return result;