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 "wsu_TimestampType.h"
21
22 xsd_QName wsu_TimestampType_choice_qname =
23 {
24     "http://schemas.xmlsoap.org/ws/2002/07/utility",
25     "TimestampType_choice"
26 };
27
28 globus_result_t
29 wsu_TimestampType_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 wsu_TimestampType_choice_serialize(
36         element_qname,
37         (wsu_TimestampType_choice *) instance,
38         message_handle, options);
39 }
40
41 globus_result_t
42 wsu_TimestampType_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 wsu_TimestampType_choice_deserialize_pointer(
49         element_qname,
50         (wsu_TimestampType_choice **) ip,
51         message_handle, options);
52 }
53
54 globus_result_t
55 wsu_TimestampType_choice_init_wrapper(void **object)
56 0 {
57 0     return wsu_TimestampType_choice_init(
58         (wsu_TimestampType_choice **) object);
59 }
60
61 void
62 wsu_TimestampType_choice_destroy_wrapper(
63     void *                          object)
64 0 {
65 0     wsu_TimestampType_choice_destroy(
66         (wsu_TimestampType_choice *) object);
67 }
68
69 globus_result_t
70 wsu_TimestampType_choice_copy_wrapper(
71     void **                         dest_obj,
72     void *                          src_obj)
73 0 {
74 0     return wsu_TimestampType_choice_copy(
75         (wsu_TimestampType_choice **) dest_obj,
76         (wsu_TimestampType_choice *) src_obj);
77 }
78
79 globus_result_t
80 wsu_TimestampType_choice_init_contents_wrapper(void *object)
81 0 {
82 0     return wsu_TimestampType_choice_init_contents(
83         (wsu_TimestampType_choice *) object);
84 }
85
86 void
87 wsu_TimestampType_choice_destroy_contents_wrapper(
88     void *                          object)
89 0 {
90 0     wsu_TimestampType_choice_destroy_contents(
91         (wsu_TimestampType_choice *) object);
92 }
93
94 globus_result_t
95 wsu_TimestampType_choice_copy_contents_wrapper(
96     void *                          dest_obj,
97     void *                          src_obj)
98 0 {
99 0     return wsu_TimestampType_choice_copy_contents(
100         (wsu_TimestampType_choice *) dest_obj,
101         (wsu_TimestampType_choice *) src_obj);
102 }
103
104 globus_result_t
105 wsu_TimestampType_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 wsu_TimestampType_choice_serialize_contents(
112         element_qname,
113         (wsu_TimestampType_choice *) instance,
114         message_handle, options);
115 }
116
117 globus_result_t
118 wsu_TimestampType_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(wsu_TimestampType_choice_deserialize_contents_wrapper);
126 0     GlobusSoapMessageDebugEnter();
127
128 0     if(!*instance)
129     {
130 0         result = wsu_TimestampType_choice_init(
131             (wsu_TimestampType_choice **)instance);
132 0         if(result != GLOBUS_SUCCESS)
133         {
134 0             goto error;
135         }
136     }
137
138 0     result = wsu_TimestampType_choice_deserialize_contents(
139         element_qname,
140         *(wsu_TimestampType_choice **)instance,
141         message_handle, options);
142 error:
143 0     GlobusSoapMessageDebugExit();
144 0     return result;
145 }
146
147 globus_result_t
148 wsu_TimestampType_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 wsu_TimestampType_choice_array_serialize(
155         element,
156         (wsu_TimestampType_choice_array *) instance,
157         message, options);
158 }
159
160 globus_result_t
161 wsu_TimestampType_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 = wsu_TimestampType_choice_array_init(
172             (wsu_TimestampType_choice_array **)inst);
173 0         if(result != GLOBUS_SUCCESS)
174         {
175 0             return result;
176         }
177     }
178
179 0     return wsu_TimestampType_choice_array_deserialize(
180         element_qname,
181         *(wsu_TimestampType_choice_array **) inst,
182         message, options);
183 }
184
185 globus_result_t
186 wsu_TimestampType_choice_array_init_wrapper(
187     void **                             arr)
188 0 {
189 0     return wsu_TimestampType_choice_array_init(
190         (wsu_TimestampType_choice_array **) arr);
191 }
192
193 void
194 wsu_TimestampType_choice_array_destroy_wrapper(
195     void *                              arr)
196 0 {
197 0     wsu_TimestampType_choice_array_destroy(
198         (wsu_TimestampType_choice_array *) arr);
199 }
200
201 globus_result_t
202 wsu_TimestampType_choice_array_copy_wrapper(
203     void **                             dest_arr,
204     void *                              src_arr)
205 0 {
206 0     return wsu_TimestampType_choice_array_copy(
207         (wsu_TimestampType_choice_array **) dest_arr,
208         (wsu_TimestampType_choice_array *) src_arr);
209 }
210
211 globus_result_t
212 wsu_TimestampType_choice_array_init_contents_wrapper(
213     void *                              arr)
214 0 {
215 0     return wsu_TimestampType_choice_array_init_contents(
216         (wsu_TimestampType_choice_array *) arr);
217 }
218
219 void
220 wsu_TimestampType_choice_array_destroy_contents_wrapper(
221     void *                              arr)
222 0 {
223 0     wsu_TimestampType_choice_array_destroy_contents(
224         (wsu_TimestampType_choice_array *) arr);
225 }
226
227 globus_result_t
228 wsu_TimestampType_choice_array_copy_contents_wrapper(
229     void *                              dest_arr,
230     void *                              src_arr)
231 0 {
232 0     return wsu_TimestampType_choice_array_copy_contents(
233         (wsu_TimestampType_choice_array *) dest_arr,
234         (wsu_TimestampType_choice_array *) src_arr);
235 }
236
237 struct globus_xsd_type_info_s wsu_TimestampType_choice_array_info =
238 {
239     &wsu_TimestampType_choice_qname,
240     wsu_TimestampType_choice_array_serialize_wrapper,
241     wsu_TimestampType_choice_array_deserialize_wrapper,
242     wsu_TimestampType_choice_array_init_wrapper,
243     wsu_TimestampType_choice_array_destroy_wrapper,
244     wsu_TimestampType_choice_array_copy_wrapper,
245     wsu_TimestampType_choice_array_init_contents_wrapper,
246     wsu_TimestampType_choice_array_destroy_contents_wrapper,
247     wsu_TimestampType_choice_array_copy_contents_wrapper,
248     sizeof(wsu_TimestampType_choice),
249     wsu_TimestampType_choice_array_push_wrapper,
250     NULL,
251     NULL
252 };
253
254 struct globus_xsd_type_info_s wsu_TimestampType_choice_contents_info =
255 {
256     &wsu_TimestampType_choice_qname,
257     wsu_TimestampType_choice_serialize_contents_wrapper,
258     wsu_TimestampType_choice_deserialize_contents_wrapper,
259     wsu_TimestampType_choice_init_wrapper,
260     wsu_TimestampType_choice_destroy_wrapper,
261     wsu_TimestampType_choice_copy_wrapper,
262     wsu_TimestampType_choice_init_contents_wrapper,
263     wsu_TimestampType_choice_destroy_contents_wrapper,
264     wsu_TimestampType_choice_copy_contents_wrapper,
265     sizeof(wsu_TimestampType_choice),
266     NULL,
267     NULL,
268     NULL
269 };
270
271 struct globus_xsd_type_info_s wsu_TimestampType_choice_info =
272 {
273     &wsu_TimestampType_choice_qname,
274     wsu_TimestampType_choice_serialize_wrapper,
275     wsu_TimestampType_choice_deserialize_pointer_wrapper,
276     wsu_TimestampType_choice_init_wrapper,
277     wsu_TimestampType_choice_destroy_wrapper,
278     wsu_TimestampType_choice_copy_wrapper,
279     wsu_TimestampType_choice_init_contents_wrapper,
280     wsu_TimestampType_choice_destroy_contents_wrapper,
281     wsu_TimestampType_choice_copy_contents_wrapper,
282     sizeof(wsu_TimestampType),
283     NULL,
284     &wsu_TimestampType_choice_contents_info,
285     &wsu_TimestampType_choice_array_info
286 };
287
288 globus_result_t
289 wsu_TimestampType_choice_init_contents(
290     wsu_TimestampType_choice *                    instance)
291 0 {
292 0     globus_result_t                     result = GLOBUS_SUCCESS;
293 0     GlobusFuncName(wsu_TimestampType_choice_init_contents);
294 0     GlobusSoapMessageDebugEnter();
295
296 0     memset(instance, 0, sizeof(wsu_TimestampType));
297
298 0     GlobusSoapMessageDebugExit();
299 0     return result;
300 }
301
302 globus_result_t
303 wsu_TimestampType_choice_init(
304     wsu_TimestampType_choice ** object)
305 0 {
306 0     wsu_TimestampType_choice * instance;
307 0     globus_result_t                     result = GLOBUS_SUCCESS;
308 0     GlobusFuncName(wsu_TimestampType_choice_init);
309 0     GlobusSoapMessageDebugEnter();
310
311 0     instance = globus_malloc(sizeof(wsu_TimestampType_choice));
312 0     if(!instance)
313     {
314 0         result = GlobusSoapMessageErrorOutOfMemory;
315 0         goto exit;
316     }
317
318 0     memset(instance, 0, sizeof(wsu_TimestampType_choice));
319
320 0     *object = instance;
321
322  exit:
323 0     GlobusSoapMessageDebugExit();
324 0     return result;
325 }
326
327 void
328 wsu_TimestampType_choice_destroy(
329     wsu_TimestampType_choice * instance)
330 0 {
331 0     GlobusFuncName(wsu_TimestampType_choice_destroy);
332 0     GlobusSoapMessageDebugEnter();
333
334 0     if(!instance)
335     {
336 0         goto exit;
337     }
338
339 0     wsu_TimestampType_choice_destroy_contents(instance);
340 0     free(instance);
341
342  exit:
343
344 0     GlobusSoapMessageDebugExit();
345 }
346
347
348
349 void
350 wsu_TimestampType_choice_destroy_contents(
351     wsu_TimestampType_choice * instance)
352 0 {
353 0     GlobusFuncName(wsu_TimestampType_choice_destroy_contents);
354 0     GlobusSoapMessageDebugEnter();
355
356 0     switch(instance->type)
357     {
358
359     case wsu_TimestampType_Received:
360
361 0         wsu_ReceivedType_destroy_contents(
362              &instance->value.Received);
363 0         break;
364
365     case wsu_TimestampType_any:
366
367 0         xsd_any_destroy_contents(
368              &instance->value.any);
369         break;
370
371         default:
372 0             break;
373     }
374
375 0     instance->type = wsu_TimestampType_undefined;
376
377 0     GlobusSoapMessageDebugExit();
378 }
379
380 globus_result_t
381 wsu_TimestampType_choice_copy(
382     wsu_TimestampType_choice ** dest_obj,
383     const wsu_TimestampType_choice * src_obj)
384 0 {
385 0     globus_result_t                     result = GLOBUS_SUCCESS;
386 0     wsu_TimestampType_choice * instance;
387 0     GlobusFuncName(wsu_TimestampType_choice_copy);
388
389 0     GlobusSoapMessageDebugEnter();
390
391 0     instance = malloc(sizeof(wsu_TimestampType_choice));
392 0     if (instance == NULL)
393     {
394 0         GlobusSoapMessageDebugExit();
395 0         return GlobusSoapMessageErrorOutOfMemory;
396     }
397
398 0     result = wsu_TimestampType_choice_copy_contents(instance, src_obj);
399 0     if(result != GLOBUS_SUCCESS)
400     {
401 0         globus_free(instance);
402 0         GlobusSoapMessageDebugExit();
403 0         return GlobusSoapMessageErrorOutOfMemory;
404     }
405
406 0     *dest_obj = instance;
407 0     GlobusSoapMessageDebugExit();
408 0     return result;
409 }
410
411
412
413 globus_result_t
414 wsu_TimestampType_choice_copy_contents(
415     wsu_TimestampType_choice * instance,
416     const wsu_TimestampType_choice * src_obj)
417 0 {
418 0     xsd_QName                           subelement;
419 0     globus_result_t                     result = GLOBUS_SUCCESS;
420 0     GlobusFuncName(wsu_TimestampType_choice_copy_contents);
421
422 0     GlobusSoapMessageDebugEnter();
423
424 0     switch(src_obj->type)
425     {
426
427     case wsu_TimestampType_Received:
428 0         instance->type = wsu_TimestampType_Received;
429 0         result = wsu_ReceivedType_copy_contents(
430             &instance->value.Received,
431             &src_obj->value.Received);
432 0         if(result != GLOBUS_SUCCESS)
433         {
434 0             result = GlobusSoapMessageErrorSerializeFailed(
435                 result, NULL, &wsu_TimestampType_choice_qname);
436 0             goto exit;
437         }
438
439 0         break;
440
441     case wsu_TimestampType_any:
442 0         instance->type = wsu_TimestampType_any;
443 0         result = xsd_any_copy_contents(
444             &instance->value.any,
445             &src_obj->value.any);
446 0         if(result != GLOBUS_SUCCESS)
447         {
448 0             result = GlobusSoapMessageErrorSerializeFailed(
449                 result, NULL, &wsu_TimestampType_choice_qname);
450             goto exit;
451         }
452
453 0         break;
454
455     default:
456 0         break;
457     }
458
459  exit:
460
461 0     GlobusSoapMessageDebugExit();
462 0     return result;
463 }
464
465
466
467
468
469 globus_result_t
470 wsu_TimestampType_choice_serialize_contents(
471     xsd_QName *                         element_qname, /* ignored */
472     wsu_TimestampType_choice * instance,
473     globus_soap_message_handle_t        message_handle,
474     globus_xsd_element_options_t        options)
475 0 {
476 0     xsd_QName                           subelement;
477 0     globus_result_t                     result = GLOBUS_SUCCESS;
478 0     GlobusFuncName(wsu_TimestampType_choice_serialize_contents);
479 0     GlobusSoapMessageDebugEnter();
480
481 0     switch(instance->type)
482     {
483
484     case wsu_TimestampType_Received:
485
486 0         subelement.local = "Received";
487 0         subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
488 0         result = wsu_ReceivedType_serialize(
489             &subelement,
490             &instance->value.Received,
491             message_handle,
492             options);
493 0         if(result != GLOBUS_SUCCESS)
494         {
495 0             result = GlobusSoapMessageErrorSerializeFailed(
496                 result, NULL, &wsu_TimestampType_choice_qname);
497 0             goto exit;
498         }
499
500 0         break;
501
502     case wsu_TimestampType_any:
503
504 0         subelement.local = "any";
505 0         subelement.Namespace = "http://www.w3.org/2001/XMLSchema";
506 0         result = xsd_any_serialize(
507             &subelement,
508             &instance->value.any,
509             message_handle,
510             options);
511 0         if(result != GLOBUS_SUCCESS)
512         {
513 0             result = GlobusSoapMessageErrorSerializeFailed(
514                 result, NULL, &wsu_TimestampType_choice_qname);
515             goto exit;
516         }
517
518 0         break;
519
520         default:
521 0             break;
522     }
523
524  exit:
525
526 0     GlobusSoapMessageDebugExit();
527 0     return result;
528 }
529
530
531
532 globus_result_t
533 wsu_TimestampType_choice_serialize(
534     xsd_QName *                         element_qname,
535     wsu_TimestampType_choice *             instance,
536     globus_soap_message_handle_t        message_handle,
537     globus_xsd_element_options_t        options)
538 0 {
539 0     globus_result_t                     result = GLOBUS_SUCCESS;
540 0     GlobusFuncName(wsu_TimestampType_choice_serialize);
541 0     GlobusSoapMessageDebugEnter();
542
543 0     result = wsu_TimestampType_choice_serialize_contents(
544         element_qname,
545         instance,
546         message_handle,
547         options);
548 0     if(result != GLOBUS_SUCCESS)
549     {
550 0         result = GlobusSoapMessageErrorSerializeFailed(
551             result, NULL, &wsu_TimestampType_choice_qname);
552         goto exit;
553     }
554
555  exit:
556 0     GlobusSoapMessageDebugExit();
557 0     return result;
558 }
559
560
561
562
563
564 globus_result_t
565 wsu_TimestampType_choice_deserialize_contents(
566     xsd_QName *                         element_qname, /* ignored */
567     wsu_TimestampType_choice * instance,
568     globus_soap_message_handle_t        message_handle,
569     globus_xsd_element_options_t        options)
570 0 {
571 0     globus_result_t                     result = GLOBUS_SUCCESS;
572 0     GlobusFuncName(wsu_TimestampType_choice_deserialize_contents);
573 0     GlobusSoapMessageDebugEnter();
574
575 0     result = wsu_TimestampType_choice_deserialize(
576         NULL,
577         instance,
578         message_handle,
579         options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
580 0     if(result != GLOBUS_SUCCESS)
581     {
582 0         result = GlobusSoapMessageErrorDeserializeFailed(
583             result, element_qname);
584         goto exit;
585     }
586
587  exit:
588
589 0     GlobusSoapMessageDebugExit();
590 0     return result;
591 }
592
593
594
595 globus_result_t
596 wsu_TimestampType_choice_deserialize(
597     xsd_QName *                         element_qname,
598     wsu_TimestampType_choice * instance,
599     globus_soap_message_handle_t        message_handle,
600     globus_xsd_element_options_t        options)
601 0 {
602 0     globus_result_t                     result = GLOBUS_SUCCESS;
603 0     xsd_QName                           subelement;
604 0     xsd_QName                           deselem_qname = { NULL, NULL } ;
605 0     GlobusFuncName(wsu_TimestampType_choice_deserialize);
606 0     GlobusSoapMessageDebugEnter();
607
608 0     xsd_QName_init_contents(&deselem_qname);
609
610 0     do
611     {
612 0         result = globus_soap_message_deserialize_element_unknown(
613             message_handle, &deselem_qname);
614 0         if(result != GLOBUS_SUCCESS)
615         {
616 0             result = GlobusSoapMessageErrorDeserializeFailed(
617                 result, &wsu_TimestampType_choice_qname);
618 0             goto exit;
619         }
620
621 0         if(globus_soap_message_deserialize_element_is_nil(message_handle))
622         {
623 0             xsd_QName_destroy_contents(&deselem_qname);
624 0             result = globus_soap_message_deserialize_element_end(
625                 message_handle,
626                 element_qname);
627 0             if(result != GLOBUS_SUCCESS)
628             {
629 0                 result = GlobusSoapMessageErrorDeserializeFailed(
630                     result, &wsu_TimestampType_choice_qname);
631 0                 goto exit;
632             }
633         }
634         else
635         {
636 0             break;
637         }
638 0     } while(1);
639
640 0     globus_soap_message_deserialize_push_element(message_handle);
641
642 0     subelement.local = "Received";
643 0     subelement.Namespace = "http://schemas.xmlsoap.org/ws/2002/07/utility";
644 0     if(xsd_QName_keyeq((void *)&subelement, (void *)&deselem_qname))
645     {
646 0         instance->type=wsu_TimestampType_Received;
647 0         result = wsu_ReceivedType_deserialize(
648             &subelement,
649             &instance->value.Received,
650             message_handle,
651             options);
652 0         if(result != GLOBUS_SUCCESS)
653         {
654 0             result = GlobusSoapMessageErrorDeserializeFailed(
655                 result, &wsu_TimestampType_choice_qname);
656 0             goto Received_destroy;
657         }
658
659 0         goto exit;
660     }
661
662     /* try to parse as any element */
663 0     result = xsd_any_deserialize(
664         &subelement,
665         &instance->value.any,
666         message_handle,
667         options);
668 0     if(result != GLOBUS_SUCCESS)
669     {
670 0         result = GlobusSoapMessageErrorDeserializeFailed(
671             result, &wsu_TimestampType_choice_qname);
672 0         goto any_destroy;
673     }
674     else
675     {
676 0         instance->type=wsu_TimestampType_any;
677         goto exit;
678     }
679
680 0     instance->type = wsu_TimestampType_undefined;
681  
682 0     goto exit;
683
684  deserialize_failed:
685
686  any_destroy: 
687
688  Received_destroy:
689
690  exit:
691
692 0     xsd_QName_destroy_contents(&deselem_qname);
693
694 0     if(result == GLOBUS_SUCCESS)
695     {
696 0         do
697         {
698 0             result = globus_soap_message_deserialize_element(
699                 message_handle, NULL);
700 0             if(result != GLOBUS_SUCCESS &&
701                (GlobusSoapMessageStatusElementNotFoundCheck(result) ||
702                 GlobusSoapMessageStatusFailedElementCheck(result) ||
703                 GlobusSoapMessageStatusFailedWithTextCheck(result)))
704             {
705 0                 result = GLOBUS_SUCCESS;
706 0                 break;
707             }
708
709 0             if(globus_soap_message_deserialize_element_is_nil(
710                    message_handle))
711             {
712 0                 result = globus_soap_message_deserialize_element_end(
713                     message_handle,
714                     element_qname);
715 0                 if(result != GLOBUS_SUCCESS)
716                 {
717 0                     result = GlobusSoapMessageErrorDeserializeFailed(
718                         result, &wsu_TimestampType_choice_qname);
719                     break;
720                 }
721             }
722             else
723             {
724 0                 break;
725             }
726
727 0         } while(1);
728     }
729
730 0     xsd_QName_destroy_contents(&deselem_qname);
731
732 0     GlobusSoapMessageDebugExit();
733 0     return result;
734 }
735
736
737
738 globus_result_t
739 wsu_TimestampType_choice_deserialize_pointer(
740     xsd_QName *                         element_qname,
741     wsu_TimestampType_choice ** ip,
742     globus_soap_message_handle_t        message_handle,
743     globus_xsd_element_options_t        options)
744 0 {
745 0     wsu_TimestampType_choice * instance = NULL;
746 0     globus_result_t                     result = GLOBUS_SUCCESS;
747 0     xsd_QName                           subelement;
748 0     GlobusFuncName(wsu_TimestampType_choice_deserialize_pointer);
749 0     GlobusSoapMessageDebugEnter();
750
751 0     *ip = NULL;
752
753 0     result = wsu_TimestampType_choice_init(&instance);
754 0     if(result != GLOBUS_SUCCESS)
755     {
756 0         result = GlobusSoapMessageErrorDeserializeFailed(
757             result, element_qname);
758 0         goto exit;
759     }
760
761 0     result = wsu_TimestampType_choice_deserialize_contents(
762         element_qname,
763         instance,
764         message_handle,
765         options);
766 0     if(result != GLOBUS_SUCCESS)
767     {
768 0         goto exit;
769     }
770
771 0     *ip = instance;
772
773  exit:
774
775 0     GlobusSoapMessageDebugExit();
776 0     return result;
777 }
778
779
780
781 globus_result_t
782 wsu_TimestampType_choice_array_init_contents(
783     wsu_TimestampType_choice_array * array)
784 0 {
785 0     GlobusFuncName(wsu_TimestampType_choice_array_init_contents);
786 0     GlobusSoapMessageDebugEnter();
787
788 0     memset(array, 0, sizeof(wsu_TimestampType_choice_array));
789
790 0     GlobusSoapMessageDebugExit();
791 0     return GLOBUS_SUCCESS;
792 }
793
794 globus_result_t
795 wsu_TimestampType_choice_array_init(
796     wsu_TimestampType_choice_array ** arr)
797 0 {
798 0     wsu_TimestampType_choice_array * array;
799 0     globus_result_t                     result;
800 0     GlobusFuncName(wsu_TimestampType_choice_array_init);
801 0     GlobusSoapMessageDebugEnter();
802
803 0     array = (wsu_TimestampType_choice_array *)
804         globus_malloc(sizeof(wsu_TimestampType_choice_array));
805 0     if(!array)
806     {
807 0         result = GlobusSoapMessageErrorOutOfMemory;
808 0         goto exit;
809     }
810        
811 0     result = wsu_TimestampType_choice_array_init_contents(array);
812 0     if(result != GLOBUS_SUCCESS)
813     {
814 0         globus_free(array);
815 0         array = NULL;
816     }
817
818 0     *arr = array;
819
820  exit:
821 0     GlobusSoapMessageDebugExit();
822 0     return result;
823 }
824
825 void
826 wsu_TimestampType_choice_array_destroy_contents(
827     wsu_TimestampType_choice_array * array)
828 0 {
829 0     int                                 i = 0;
830 0     GlobusFuncName(wsu_TimestampType_choice_array_destroy_contents);
831 0     GlobusSoapMessageDebugEnter();
832
833 0     for(; i < array->length; ++i)
834     {
835 0         wsu_TimestampType_choice_destroy_contents(&array->elements[i]);
836     }
837
838 0     if(array->elements)
839     {
840 0         globus_free(array->elements);
841 0         array->elements = NULL;
842     }
843 0     array->length = 0;
844
845 0     GlobusSoapMessageDebugExit();
846 }
847
848 void
849 wsu_TimestampType_choice_array_destroy(
850     wsu_TimestampType_choice_array * array)
851 0 {
852 0     GlobusFuncName(wsu_TimestampType_choice_array_destroy);
853 0     GlobusSoapMessageDebugEnter();
854
855 0     wsu_TimestampType_choice_array_destroy_contents(array);
856 0     globus_free(array);
857
858 0     GlobusSoapMessageDebugExit();
859 }
860
861 globus_result_t
862 wsu_TimestampType_choice_array_copy(
863     wsu_TimestampType_choice_array ** dest_arr,
864     const wsu_TimestampType_choice_array * src_arr)
865 0 {
866 0     wsu_TimestampType_choice_array * array;
867 0     globus_result_t                     result;
868 0     GlobusFuncName(wsu_TimestampType_choice_array_copy);
869 0     GlobusSoapMessageDebugEnter();
870
871 0     array = (wsu_TimestampType_choice_array *) malloc(
872         sizeof(wsu_TimestampType_choice_array));
873 0     if(!array)
874     {
875 0         result = GlobusSoapMessageErrorOutOfMemory;
876 0         GlobusSoapMessageDebugExit();
877 0         return result;
878     }
879
880 0     result = wsu_TimestampType_choice_array_copy_contents(array, src_arr);
881 0     if(result != GLOBUS_SUCCESS)
882     {
883 0         globus_free(array);
884 0         GlobusSoapMessageDebugExit();
885 0         return result;
886     }
887
888 0     *dest_arr = array;
889
890 0     GlobusSoapMessageDebugExit();
891 0     return GLOBUS_SUCCESS;
892 }
893
894 globus_result_t
895 wsu_TimestampType_choice_array_copy_contents(
896     wsu_TimestampType_choice_array * dest_arr,
897     const wsu_TimestampType_choice_array * src_arr)
898 0 {
899 0     int                                 i;
900 0     globus_result_t                     result = GLOBUS_SUCCESS;
901 0     GlobusFuncName(wsu_TimestampType_choice_array_copy_contents);
902 0     GlobusSoapMessageDebugEnter();
903
904 0     dest_arr->length = src_arr->length;
905 0     if(dest_arr->length > 0)
906     {
907 0         dest_arr->elements = (wsu_TimestampType_choice *) malloc(
908             sizeof(wsu_TimestampType_choice) * dest_arr->length);
909 0         if(!dest_arr->elements)
910         {
911 0             result = GlobusSoapMessageErrorOutOfMemory;
912 0             goto exit;
913         }
914     }
915     else
916     {
917 0         dest_arr->elements = NULL;
918     }
919     
920 0     for(i = 0; i < dest_arr->length; i++)
921     {
922 0         result = wsu_TimestampType_choice_copy_contents(
923             &dest_arr->elements[i], &src_arr->elements[i]);
924 0         if(result != GLOBUS_SUCCESS)
925         {
926 0             while(i--)
927             {
928 0                 wsu_TimestampType_choice_destroy_contents(&dest_arr->elements[i]);
929             }
930
931 0             globus_free(dest_arr->elements);
932 0             dest_arr->elements = NULL;
933 0             dest_arr->length = 0;
934 0             break;
935         }
936     }
937
938  exit:
939 0     GlobusSoapMessageDebugExit();
940 0     return result;
941 }
942
943 wsu_TimestampType_choice *
944 wsu_TimestampType_choice_array_push(
945     wsu_TimestampType_choice_array * array)
946 0 {
947 0     wsu_TimestampType_choice *             tmp;
948
949 0     GlobusFuncName(wsu_TimestampType_choice_array_push);
950 0     GlobusSoapMessageDebugEnter();
951
952 0     tmp = realloc(array->elements,
953                           sizeof(wsu_TimestampType_choice) *
954                           (array->length + 1));
955 0     if (tmp == NULL)
956     {
957 0         goto error;
958     }
959 0     array->elements = tmp;
960
961 0     memset(&array->elements[array->length], 0, sizeof(wsu_TimestampType_choice));
962 0     array->length++;
963
964 0     GlobusSoapMessageDebugExit();
965 0     return (&array->elements[array->length - 1]);
966 error:
967 0     GlobusSoapMessageDebugExit();
968 0     return NULL;
969 }
970
971 void *
972 wsu_TimestampType_choice_array_push_wrapper(
973     void * array)
974 0 {
975 0     return (void *) wsu_TimestampType_choice_array_push(
976         (wsu_TimestampType_choice_array *) array);
977 }
978
979 globus_result_t
980 wsu_TimestampType_choice_array_serialize(
981     xsd_QName *                         element_qname,
982     wsu_TimestampType_choice_array * array,
983     globus_soap_message_handle_t        message,
984     globus_xsd_element_options_t        options)
985 0 {
986 0     globus_result_t                     result = GLOBUS_SUCCESS;
987 0     int                                 i = 0;
988 0     GlobusFuncName(wsu_TimestampType_choice_array_serialize);
989 0     GlobusSoapMessageDebugEnter();
990
991 0     for(; i < array->length; ++i)
992     {
993 0         result = wsu_TimestampType_choice_serialize(
994             element_qname,
995             &array->elements[i],
996             message,
997             options);
998 0         if(result != GLOBUS_SUCCESS)
999         {
1000 0             goto exit;
1001         }
1002     }
1003
1004 exit:
1005
1006 0     GlobusSoapMessageDebugExit();
1007 0     return result;
1008 }
1009
1010 globus_result_t
1011 wsu_TimestampType_choice_array_deserialize(
1012     xsd_QName *                         element_qname,
1013     wsu_TimestampType_choice_array * array,
1014     globus_soap_message_handle_t        message,
1015     globus_xsd_element_options_t        options)
1016 0 {
1017 0     globus_result_t                     result = GLOBUS_SUCCESS;
1018 0     int                                 i = 0;
1019 0     int                                 pre_length;
1020 0     GlobusFuncName(wsu_TimestampType_choice_array_deserialize);
1021 0     GlobusSoapMessageDebugEnter();
1022
1023 0     pre_length = array->length;
1024
1025 0     for(i = 0; i < pre_length; ++i)
1026     {
1027 0         result = wsu_TimestampType_choice_deserialize(
1028             element_qname,
1029             &array->elements[i],
1030             message,
1031             options);
1032 0         if(result != GLOBUS_SUCCESS)
1033         {
1034 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1035                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1036                GlobusSoapMessageStatusFailedWithTextCheck(result))
1037             {
1038 0                 result = GLOBUS_SUCCESS;
1039 0                 break;
1040             }
1041
1042 0             result = GlobusSoapMessageErrorDeserializeFailed(
1043                 result, element_qname);
1044 0             goto exit;
1045         }
1046     }
1047
1048 0     while(result == GLOBUS_SUCCESS)
1049     {
1050 0         wsu_TimestampType_choice next;
1051 0         memset(&next, 0, sizeof(wsu_TimestampType_choice));
1052
1053 0         result = wsu_TimestampType_choice_deserialize(
1054             element_qname,
1055             &next,
1056             message,
1057             options);
1058 0         if(result != GLOBUS_SUCCESS)
1059         {
1060 0             if(GlobusSoapMessageStatusFailedElementCheck(result) ||
1061                GlobusSoapMessageStatusElementNotFoundCheck(result) ||
1062                GlobusSoapMessageStatusFailedWithTextCheck(result))
1063             {
1064 0                 result = GLOBUS_SUCCESS;
1065 0                 break;
1066             }
1067
1068 0             result = GlobusSoapMessageErrorDeserializeFailed(
1069                 result, element_qname);
1070 0             goto exit;
1071         }
1072
1073 0         array->elements = realloc(
1074             array->elements,
1075             (array->length + 1) * sizeof(wsu_TimestampType_choice));
1076 0         if(!array->elements)
1077         {
1078 0             result = GlobusSoapMessageErrorOutOfMemory;
1079 0             goto exit;
1080         }
1081 0         array->elements[array->length] = next;
1082 0         array->length++;
1083 0         ++i;
1084     }
1085
1086   exit:
1087
1088 0     if(result != GLOBUS_SUCCESS)
1089     {
1090 0         int                             di = 0;
1091 0         for(; di < i; ++di)
1092         {
1093 0             wsu_TimestampType_choice_destroy_contents(
1094                 &array->elements[di]);
1095 0             memset(&array->elements[di], 0, sizeof(wsu_TimestampType_choice));
1096         }
1097     }
1098
1099 0     GlobusSoapMessageDebugExit();
1100 0     return result;