1 /*
2 * Copyright 1999-2006 University of Chicago
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 /*
19 * This file is automatically generated from source-type-builtin.tmpl
20 */
21
22 #include "globus_common.h"
23 #include "globus_xsd_types.h"
24 #include "globus_soap_message.h"
25 #include "globus_xsd_type_info.h"
26 #include "xsd_anyType.h"
27 #include "globus_xsd_generic.h"
28 #include "globus_xsd_generic_array.h"
29 #include "globus_i_soap_message.h"
30 #include "xsd_QName.h"
31 #include "libxml/schemasInternals.h"
32 #include "libxml/xmlschemastypes.h"
33
34 /**
35 * QName of the xsd_anyType builtin type
36 * @ingroup xsd_anyType
37 */
38 xsd_QName xsd_anyType_qname =
39 {
40 "http://www.w3.org/2001/XMLSchema",
41 "anyType"
42
43 };
44
45 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
46 static
47 globus_result_t
48 xsd_anyType_serialize_wrapper(
49 const xsd_QName * element_qname,
50 const void * instance,
51 globus_soap_message_handle_t message_handle,
52 globus_xsd_element_options_t options)
53 36 {
54 36 return xsd_anyType_serialize(
55 element_qname,
56 (xsd_anyType *) instance,
57 message_handle, options);
58 }
59 /* xsd_anyType_serialize_wrapper() */
60
61 static
62 globus_result_t
63 xsd_anyType_deserialize_pointer_wrapper(
64 const xsd_QName * element_qname,
65 void ** ip,
66 globus_soap_message_handle_t message_handle,
67 globus_xsd_element_options_t options)
68 90 {
69 90 return xsd_anyType_deserialize_pointer(
70 element_qname,
71 (xsd_anyType **) ip,
72 message_handle, options);
73 }
74 /* xsd_anyType_deserialize_pointer_wrapper() */
75
76 static
77 globus_result_t
78 xsd_anyType_init_wrapper(void **object)
79 0 {
80 0 return xsd_anyType_init(
81 (xsd_anyType **) object);
82 }
83 /* xsd_anyType_init_wrapper() */
84
85 static
86 void
87 xsd_anyType_destroy_wrapper(
88 void * object)
89 72 {
90 72 xsd_anyType_destroy(
91 (xsd_anyType *) object);
92 72 }
93 /* xsd_anyType_destroy_wrapper() */
94
95 static
96 globus_result_t
97 xsd_anyType_copy_wrapper(
98 void ** dest_obj,
99 const void * src_obj)
100 72 {
101 72 return xsd_anyType_copy(
102 (xsd_anyType **) dest_obj,
103 (const xsd_anyType *) src_obj);
104 }
105 /* xsd_anyType_copy_wrapper() */
106
107 static
108 globus_result_t
109 xsd_anyType_init_contents_wrapper(void *object)
110 0 {
111 0 return xsd_anyType_init_contents(
112 (xsd_anyType *) object);
113 }
114 /* xsd_anyType_init_contents_wrapper() */
115
116 static
117 void
118 xsd_anyType_destroy_contents_wrapper(
119 void * object)
120 0 {
121 0 xsd_anyType_destroy_contents(
122 (xsd_anyType *) object);
123 0 }
124 /* xsd_anyType_destroy_contents_wrapper() */
125
126 static
127 globus_result_t
128 xsd_anyType_copy_contents_wrapper(
129 void * dest_obj,
130 const void * src_obj)
131 0 {
132 0 return xsd_anyType_copy_contents(
133 (xsd_anyType *) dest_obj,
134 (const xsd_anyType *) src_obj);
135 }
136 /* xsd_anyType_copy_contents_wrapper() */
137
138 static
139 globus_result_t
140 xsd_anyType_serialize_contents_wrapper(
141 const xsd_QName * element_qname,
142 const void * instance,
143 globus_soap_message_handle_t message_handle,
144 globus_xsd_element_options_t options)
145 0 {
146 0 return xsd_anyType_serialize_contents(
147 element_qname,
148 (xsd_anyType *) instance,
149 message_handle, options);
150 }
151 /* xsd_anyType_serialize_contents_wrapper() */
152
153 static
154 globus_result_t
155 xsd_anyType_deserialize_contents_wrapper(
156 const xsd_QName * element_qname,
157 void ** instance,
158 globus_soap_message_handle_t message_handle,
159 globus_xsd_element_options_t options)
160 0 {
161 globus_result_t result;
162 0 globus_bool_t allocated = GLOBUS_FALSE;
163 GlobusFuncName(xsd_anyType_deserialize_contents_wrapper);
164 0 GlobusSoapMessageDebugEnter();
165
166 0 if(!*instance)
167 {
168 0 result = xsd_anyType_init(
169 (xsd_anyType **)instance);
170 0 if(result != GLOBUS_SUCCESS)
171 {
172 0 goto error;
173 }
174 0 allocated = GLOBUS_TRUE;
175 }
176
177 0 result = xsd_anyType_deserialize_contents(
178 element_qname,
179 *(xsd_anyType **)instance,
180 message_handle, options);
181 0 error:
182 0 if (result != GLOBUS_SUCCESS && allocated)
183 {
184 0 xsd_anyType_destroy(*(xsd_anyType **)instance);
185 0 *instance = NULL;
186 }
187 0 GlobusSoapMessageDebugExit();
188 0 return result;
189 }
190 /* xsd_anyType_deserialize_contents_wrapper() */
191
192 static
193 globus_result_t
194 xsd_anyType_array_serialize_wrapper(
195 const xsd_QName * element,
196 const void * instance,
197 globus_soap_message_handle_t message,
198 globus_xsd_element_options_t options)
199 0 {
200 0 return xsd_anyType_array_serialize(
201 element,
202 (xsd_anyType_array *) instance,
203 message, options);
204 }
205 /* xsd_anyType_array_serialize_wrapper() */
206
207 static
208 globus_result_t
209 xsd_anyType_array_deserialize_wrapper(
210 const xsd_QName * element_qname,
211 void ** inst,
212 globus_soap_message_handle_t message,
213 globus_xsd_element_options_t options)
214 0 {
215 0 globus_bool_t allocated = GLOBUS_FALSE;
216
217 globus_result_t result;
218 0 if(!*inst)
219 {
220 0 result = xsd_anyType_array_init(
221 (xsd_anyType_array **)inst);
222 0 if(result != GLOBUS_SUCCESS)
223 {
224 0 return result;
225 }
226 0 allocated = GLOBUS_TRUE;
227 }
228
229 0 result = xsd_anyType_array_deserialize(
230 element_qname,
231 *(xsd_anyType_array **) inst,
232 message, options);
233 0 if (result != GLOBUS_SUCCESS && allocated)
234 {
235 0 xsd_anyType_array_destroy(*(xsd_anyType_array **) inst);
236 0 *inst = NULL;
237 }
238 0 return result;
239 }
240 /* xsd_anyType_array_deserialize_wrapper() */
241
242 static
243 globus_result_t
244 xsd_anyType_array_init_wrapper(
245 void ** arr)
246 0 {
247 0 return xsd_anyType_array_init(
248 (xsd_anyType_array **) arr);
249 }
250 /* xsd_anyType_array_init_wrapper() */
251
252 static
253 void
254 xsd_anyType_array_destroy_wrapper(
255 void * arr)
256 0 {
257 0 xsd_anyType_array_destroy(
258 (xsd_anyType_array *) arr);
259 0 }
260 /* xsd_anyType_array_destroy_wrapper() */
261
262 static
263 globus_result_t
264 xsd_anyType_array_copy_wrapper(
265 void ** dest_arr,
266 const void * src_arr)
267 0 {
268 0 return xsd_anyType_array_copy(
269 (xsd_anyType_array **) dest_arr,
270 (const xsd_anyType_array *) src_arr);
271 }
272 /* xsd_anyType_array_copy_wrapper() */
273
274 static
275 globus_result_t
276 xsd_anyType_array_init_contents_wrapper(
277 void * arr)
278 0 {
279 0 return xsd_anyType_array_init_contents(
280 (xsd_anyType_array *) arr);
281 }
282 /* xsd_anyType_array_init_contents_wrapper() */
283
284 static
285 void
286 xsd_anyType_array_destroy_contents_wrapper(
287 void * arr)
288 0 {
289 0 xsd_anyType_array_destroy_contents(
290 (xsd_anyType_array *) arr);
291 0 }
292 /* xsd_anyType_array_destroy_contents_wrapper() */
293
294 static
295 globus_result_t
296 xsd_anyType_array_copy_contents_wrapper(
297 void * dest_arr,
298 const void * src_arr)
299 0 {
300 0 return xsd_anyType_array_copy_contents(
301 (xsd_anyType_array *) dest_arr,
302 (const xsd_anyType_array *) src_arr);
303 }
304 /* xsd_anyType_array_copy_contents_wrapper() */
305
306 static
307 void *
308 xsd_anyType_array_push_wrapper(
309 void * array)
310 0 {
311 0 return (void *) xsd_anyType_array_push((xsd_anyType_array *) array);
312 }
313 /* xsd_anyType_array_push_wrapper() */
314 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
315
316 /**
317 * Type info for xsd_anyType
318 * @ingroup xsd_anyType
319 * This type info is used when serializing/deserializing an xsd:any
320 * which contains array values of this type.
321 */
322 struct globus_xsd_type_info_s xsd_anyType_array_info =
323 {
324 &xsd_anyType_qname,
325 xsd_anyType_array_serialize_wrapper,
326 xsd_anyType_array_deserialize_wrapper,
327 xsd_anyType_array_init_wrapper,
328 xsd_anyType_array_destroy_wrapper,
329 xsd_anyType_array_copy_wrapper,
330 xsd_anyType_array_init_contents_wrapper,
331 xsd_anyType_array_destroy_contents_wrapper,
332 xsd_anyType_array_copy_contents_wrapper,
333 sizeof(xsd_anyType),
334 xsd_anyType_array_push_wrapper,
335 NULL,
336 NULL
337 };
338
339 /**
340 * Type info for xsd_anyType
341 * @ingroup xsd_anyType
342 * This type info is used when serializing/deserializing an xsd:anyType
343 * which contains values of this type.
344 */
345 struct globus_xsd_type_info_s xsd_anyType_contents_info =
346 {
347 &xsd_anyType_qname,
348 xsd_anyType_serialize_contents_wrapper,
349 xsd_anyType_deserialize_contents_wrapper,
350 xsd_anyType_init_wrapper,
351 xsd_anyType_destroy_wrapper,
352 xsd_anyType_copy_wrapper,
353 xsd_anyType_init_contents_wrapper,
354 xsd_anyType_destroy_contents_wrapper,
355 xsd_anyType_copy_contents_wrapper,
356 sizeof(xsd_anyType),
357 NULL,
358 NULL,
359 NULL
360 };
361
362 /**
363 * Type info for xsd_anyType
364 * @ingroup xsd_anyType
365 * This type info is used when serializing/deserializing an xsd:any
366 * which contains values of this type.
367 */
368 struct globus_xsd_type_info_s xsd_anyType_info =
369 {
370 &xsd_anyType_qname,
371 xsd_anyType_serialize_wrapper,
372 xsd_anyType_deserialize_pointer_wrapper,
373 xsd_anyType_init_wrapper,
374 xsd_anyType_destroy_wrapper,
375 xsd_anyType_copy_wrapper,
376 xsd_anyType_init_contents_wrapper,
377 xsd_anyType_destroy_contents_wrapper,
378 xsd_anyType_copy_contents_wrapper,
379 sizeof(xsd_anyType),
380 NULL,
381 &xsd_anyType_contents_info,
382 &xsd_anyType_array_info
383 };
384
385
386 /**
387 * Initialize the contents of a xsd_anyType
388 * @ingroup xsd_anyType
389 *
390 * Initialize the contents of a xsd_anyType. This should be used
391 * when the structure is allocated on the stack or by a some allocator besides
392 * xsd_anyType_init(). The contents may be freed
393 * by calling xsd_anyType_destroy_contents().
394 *
395 * @param instance
396 * Pointer to an allocated but uninitialized xsd_anyType.
397 */
398 globus_result_t
399 xsd_anyType_init_contents(
400 xsd_anyType * instance)
401 382 {
402 382 globus_result_t result = GLOBUS_SUCCESS;
403 GlobusFuncName(xsd_anyType_init_contents);
404 382 GlobusSoapMessageDebugEnter();
405
406 382 memset(instance, 0, sizeof(xsd_anyType));
407
408 382 GlobusSoapMessageDebugExit();
409 382 return result;
410 }
411
412
413
414 /**
415 * Initialize a xsd_anyType
416 * @ingroup xsd_anyType
417 *
418 * Allocates a new xsd_anyType and initializes its contents. When the
419 * structure is no longer needed, it should be freed by calling
420 * xsd_anyType_destroy().
421 *
422 * @param object
423 * Pointer to set to a newly allocated instance.
424 */
425 globus_result_t
426 xsd_anyType_init(
427 xsd_anyType ** object)
428 126 {
429 126 globus_result_t result = GLOBUS_SUCCESS;
430 GlobusFuncName(xsd_anyType_init);
431 126 GlobusSoapMessageDebugEnter();
432
433 126 *object = malloc(sizeof(xsd_anyType));
434 126 if (*object == NULL)
435 {
436 0 result = GlobusSoapMessageErrorOutOfMemory;
437
438 0 goto exit;
439 }
440 126 result = xsd_anyType_init_contents(*object);
441 126 if (result != GLOBUS_SUCCESS)
442 {
443 0 free(*object);
444 0 *object = NULL;
445 }
446 126 exit:
447 126 GlobusSoapMessageDebugExit();
448 126 return result;
449 }
450 /* xsd_anyType_init() */
451
452
453
454 /**
455 * Destroy a xsd_anyType
456 * @ingroup xsd_anyType
457 *
458 * Frees a xsd_anyType.
459 *
460 * @param instance
461 * Pointer to the instance to destroy.
462 */
463 void
464 xsd_anyType_destroy(
465 xsd_anyType * instance)
466 540 {
467 GlobusFuncName(xsd_anyType_destroy);
468 540 GlobusSoapMessageDebugEnter();
469
470 540 if(!instance)
471 {
472 342 goto exit;
473 }
474
475 198 xsd_anyType_destroy_contents(instance);
476 198 free(instance);
477
478 540 exit:
479
480 540 GlobusSoapMessageDebugExit();
481 540 }
482 /* xsd_anyType_destroy() */
483
484
485
486
487
488
489 /**
490 * Copy a xsd_anyType
491 * @ingroup xsd_anyType
492 *
493 * Perform a copy of a xsd_anyType.
494 * The @a dest_obj will be allocated, and then a copy of the contents
495 * of @a src to it. The caller is responsible for destroying @a dest_objb
496 *
497 * @param dest_obj
498 * The xsd_anyType to be initialized with a copy of the
499 * contents of the @a src_obj structure.
500 * @param src_obj
501 * Source xsd_anyType to be copied.
502 */
503 globus_result_t
504 xsd_anyType_copy(
505 xsd_anyType ** dest_obj,
506 const xsd_anyType * src_obj)
507 72 {
508 72 globus_result_t result = GLOBUS_SUCCESS;
509 xsd_anyType * instance;
510 GlobusFuncName(xsd_anyType_copy);
511
512 72 GlobusSoapMessageDebugEnter();
513
514 72 instance = malloc(sizeof(xsd_anyType));
515 72 if (instance == NULL)
516 {
517 0 GlobusSoapMessageDebugExit();
518 0 return GlobusSoapMessageErrorOutOfMemory;
519 }
520
521 72 result = xsd_anyType_copy_contents(instance, src_obj);
522 72 if(result != GLOBUS_SUCCESS)
523 {
524 0 free(instance);
525 0 instance = NULL;
526 0 result = GlobusSoapMessageErrorOutOfMemory;
527 }
528
529 72 *dest_obj = instance;
530 72 GlobusSoapMessageDebugExit();
531 72 return result;
532 }
533 /* xsd_anyType_copy() */
534
535
536
537
538 /**
539 * @fn globus_result_t xsd_anyType_serialize_contents(const xsd_QName *element_qname, const xsd_anyType * inst, globus_soap_message_handle_t message_handle, globus_xsd_element_options_t options)
540 * Serialize the contents of a xsd_anyType
541 * @ingroup xsd_anyType
542 * Serialize a xsd_anyType without an enclosing element.
543 *
544 * @param element_qname
545 * Ignored parameter.
546 * @param inst
547 * The xsd_anyType to serialize.
548 * @param message_handle
549 * The handle to serialize the contents on.
550 * @param options
551 * Serialization options.
552 */
553
554 globus_result_t
555 xsd_anyType_serialize_contents(
556 const xsd_QName * element_qname, /* ignored */
557 const xsd_anyType * inst,
558 globus_soap_message_handle_t message_handle,
559 globus_xsd_element_options_t options)
560 0 {
561 0 globus_result_t result = GLOBUS_SUCCESS;
562 GlobusFuncName(xsd_anyType_serialize_contents);
563 0 GlobusSoapMessageDebugEnter();
564
565
566 0 result = xsd_anyType_serialize(
567 NULL,
568 inst,
569 message_handle,
570 options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
571
572
573
574 0 GlobusSoapMessageDebugExit();
575 0 return result;
576 }
577 /* xsd_anyType_serialize_contents() */
578
579
580
581
582
583 globus_result_t
584 xsd_anyType_deserialize_contents(
585 const xsd_QName * element_qname, /* ignored */
586 xsd_anyType * inst,
587 globus_soap_message_handle_t message_handle,
588 globus_xsd_element_options_t options)
589 0 {
590 0 globus_result_t result = GLOBUS_SUCCESS;
591 GlobusFuncName(xsd_anyType_deserialize_contents);
592 0 GlobusSoapMessageDebugEnter();
593
594
595 0 result = xsd_anyType_deserialize(
596 NULL,
597 inst,
598 message_handle,
599 options | GLOBUS_XSD_ELEMENT_CONTENTS_ONLY);
600
601
602 0 GlobusSoapMessageDebugExit();
603 0 return result;
604 }
605 /* xsd_anyType_deserialize_contents() */
606
607
608
609
610
611 globus_result_t
612 xsd_anyType_array_init_contents(
613 xsd_anyType_array * array)
614 0 {
615 GlobusFuncName(xsd_anyType_array_init_contents);
616 0 GlobusSoapMessageDebugEnter();
617
618 0 array->elements = NULL;
619 0 array->length = 0;
620 0 array->type_info = &xsd_anyType_info;
621
622 0 GlobusSoapMessageDebugExit();
623 0 return GLOBUS_SUCCESS;
624 }
625 /* xsd_anyType_array_init_contents() */
626
627
628
629 globus_result_t
630 xsd_anyType_array_init(
631 xsd_anyType_array ** arr)
632 0 {
633 0 return globus_xsd_generic_array_init(
634 (globus_xsd_generic_array_t **) arr,
635 &xsd_anyType_info);
636 }
637 /* xsd_anyType_array_init() */
638
639
640
641 void
642 xsd_anyType_array_destroy_contents(
643 xsd_anyType_array * array)
644 0 {
645 0 globus_xsd_generic_array_destroy_contents(
646 (globus_xsd_generic_array_t *) array);
647 0 }
648 /* xsd_anyType_array_destroy_contents() */
649
650
651
652 void
653 xsd_anyType_array_destroy(
654 xsd_anyType_array * array)
655 0 {
656
657 0 globus_xsd_generic_array_destroy(
658 (globus_xsd_generic_array_t *) array);
659 0 }
660 /* xsd_anyType_array_destroy() */
661
662
663
664
665 globus_result_t
666 xsd_anyType_array_copy(
667 xsd_anyType_array ** dest_arr,
668 const xsd_anyType_array * src_arr)
669 0 {
670 0 return globus_xsd_generic_array_copy(
671 (globus_xsd_generic_array_t **) dest_arr,
672 (const globus_xsd_generic_array_t *) src_arr);
673 }
674 /* xsd_anyType_array_copy() */
675
676
677
678 globus_result_t
679 xsd_anyType_array_copy_contents(
680 xsd_anyType_array * dest_arr,
681 const xsd_anyType_array * src_arr)
682 0 {
683 0 return globus_xsd_generic_array_copy_contents(
684 (globus_xsd_generic_array_t *) dest_arr,
685 (const globus_xsd_generic_array_t *) src_arr);
686 }
687 /* xsd_anyType_array_copy_contents() */
688
689
690
691 xsd_anyType *
692 xsd_anyType_array_push(
693 xsd_anyType_array * array)
694 0 {
695 /* Some contents initializers don't initialize subelments but to set their
696 * values to be NULL
697 */
698 0 if (array->type_info == NULL)
699 {
700 0 array->type_info = &xsd_anyType_info;
701 }
702 0 return globus_xsd_generic_array_push(
703 (globus_xsd_generic_array_t *) array);
704 }
705 /* xsd_anyType_array_push() */
706
707
708
709 globus_result_t
710 xsd_anyType_array_serialize(
711 const xsd_QName * element_qname,
712 const xsd_anyType_array * array,
713 globus_soap_message_handle_t message,
714 globus_xsd_element_options_t options)
715 0 {
716 0 return globus_xsd_generic_array_serialize(
717 element_qname,
718 (const globus_xsd_generic_array_t *) array,
719 message,
720 options);
721 }
722 /* xsd_anyType_array_serialize() */
723
724
725
726
727 globus_result_t
728 xsd_anyType_array_deserialize(
729 const xsd_QName * element_qname,
730 xsd_anyType_array * array,
731 globus_soap_message_handle_t message,
732 globus_xsd_element_options_t options)
733 0 {
734 /* Some initializers set the array contents to NULL */
735 0 if (array->type_info == NULL)
736 {
737 0 array->type_info = &xsd_anyType_info;
738 }
739
740 0 return globus_xsd_generic_array_deserialize(
741 element_qname,
742 (globus_xsd_generic_array_t *) array,
743 message,
744 options);
745 }