|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/object/objproj.c |
source navigation diff markup identifier search freetext search file search |
1 #include <asn.h>
2
3 #define NLM_GENERATED_CODE_PROTO
4
5 #include <mapproj.h>
6 #include <objproj.h>
7
8 static Boolean loaded = FALSE;
9
10 #include <asnproj.h>
11
12 #ifndef NLM_EXTERN_LOADS
13 #define NLM_EXTERN_LOADS {}
14 #endif
15
16 static Pointer LIBCALLBACK ProjectNewFunc (void)
17 {
18 return (Pointer) ProjectNew();
19 }
20
21 static Pointer LIBCALLBACK ProjectFreeFunc (Pointer data)
22 {
23 return (Pointer) ProjectFree ((ProjectPtr) data);
24 }
25
26 static Boolean LIBCALLBACK ProjectAsnWriteFunc (Pointer data, AsnIoPtr aip, AsnTypePtr atp)
27 {
28 return ProjectAsnWrite ((ProjectPtr) data, aip, atp);
29 }
30
31 static Pointer LIBCALLBACK ProjectAsnReadFunc (AsnIoPtr aip, AsnTypePtr atp)
32 {
33 return (Pointer) ProjectAsnRead (aip, atp);
34 }
35
36 static Int2 LIBCALLBACK ProjectLabelFunc (Pointer data, CharPtr buffer, Int2 buflen, Uint1 content)
37 {
38 return ProjectLabel ((ProjectPtr) data, buffer, buflen, content);
39 }
40
41 NLM_EXTERN Boolean LIBCALL
42 objprojAsnLoad(void)
43 {
44
45 if ( ! loaded) {
46 NLM_EXTERN_LOADS
47
48 if ( ! AsnLoad ())
49 return FALSE;
50 loaded = TRUE;
51 }
52
53 ObjMgrTypeLoad (OBJ_PROJECT, "Project", "Project", "NCBI Project",
54 PROJECT, ProjectNewFunc, ProjectAsnReadFunc, ProjectAsnWriteFunc,
55 ProjectFreeFunc, ProjectLabelFunc, ProjectSubTypeFunc);
56
57 return TRUE;
58 }
59
60
61
62 /**************************************************
63 * Generated object loaders for Module NCBI-Project
64 * Generated using ASNCODE Revision: 6.1 at Mar 25, 1998 6:32 PM
65 *
66 **************************************************/
67
68
69 /**************************************************
70 *
71 * ProjectNew()
72 *
73 **************************************************/
74 NLM_EXTERN
75 ProjectPtr LIBCALL
76 ProjectNew(void)
77 {
78 ProjectPtr ptr = MemNew((size_t) sizeof(Project));
79
80 return ptr;
81
82 }
83
84
85 /**************************************************
86 *
87 * ProjectFree()
88 *
89 **************************************************/
90 NLM_EXTERN
91 ProjectPtr LIBCALL
92 ProjectFree(ProjectPtr ptr)
93 {
94
95 if(ptr == NULL) {
96 return NULL;
97 }
98 ProjectDescrFree(ptr -> descr);
99 ProjectItemFree(ptr -> data);
100 return MemFree(ptr);
101 }
102
103
104 /**************************************************
105 *
106 * ProjectAsnRead()
107 *
108 **************************************************/
109 NLM_EXTERN
110 ProjectPtr LIBCALL
111 ProjectAsnRead(AsnIoPtr aip, AsnTypePtr orig)
112 {
113 DataVal av;
114 AsnTypePtr atp;
115 Boolean isError = FALSE;
116 AsnReadFunc func;
117 ProjectPtr ptr;
118
119 if (! loaded)
120 {
121 if (! objprojAsnLoad()) {
122 return NULL;
123 }
124 }
125
126 if (aip == NULL) {
127 return NULL;
128 }
129
130 if (orig == NULL) { /* Project ::= (self contained) */
131 atp = AsnReadId(aip, amp, PROJECT);
132 } else {
133 atp = AsnLinkType(orig, PROJECT);
134 }
135 /* link in local tree */
136 if (atp == NULL) {
137 return NULL;
138 }
139
140 ptr = ProjectNew();
141 if (ptr == NULL) {
142 goto erret;
143 }
144 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
145 goto erret;
146 }
147
148 atp = AsnReadId(aip,amp, atp);
149 func = NULL;
150
151 if (atp == PROJECT_descr) {
152 ptr -> descr = ProjectDescrAsnRead(aip, atp);
153 if (aip -> io_failure) {
154 goto erret;
155 }
156 atp = AsnReadId(aip,amp, atp);
157 }
158 if (atp == PROJECT_data) {
159 ptr -> data = ProjectItemAsnRead(aip, atp);
160 if (aip -> io_failure) {
161 goto erret;
162 }
163 atp = AsnReadId(aip,amp, atp);
164 }
165
166 if (AsnReadVal(aip, atp, &av) <= 0) {
167 goto erret;
168 }
169 /* end struct */
170
171 ret:
172 AsnUnlinkType(orig); /* unlink local tree */
173 return ptr;
174
175 erret:
176 aip -> io_failure = TRUE;
177 ptr = ProjectFree(ptr);
178 goto ret;
179 }
180
181
182
183 /**************************************************
184 *
185 * ProjectAsnWrite()
186 *
187 **************************************************/
188 NLM_EXTERN Boolean LIBCALL
189 ProjectAsnWrite(ProjectPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
190 {
191 AsnTypePtr atp;
192 Boolean retval = FALSE;
193
194 if (! loaded)
195 {
196 if (! objprojAsnLoad()) {
197 return FALSE;
198 }
199 }
200
201 if (aip == NULL) {
202 return FALSE;
203 }
204
205 atp = AsnLinkType(orig, PROJECT); /* link local tree */
206 if (atp == NULL) {
207 return FALSE;
208 }
209
210 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
211 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
212 goto erret;
213 }
214
215 if (ptr -> descr != NULL) {
216 if ( ! ProjectDescrAsnWrite(ptr -> descr, aip, PROJECT_descr)) {
217 goto erret;
218 }
219 }
220 if (ptr -> data != NULL) {
221 if ( ! ProjectItemAsnWrite(ptr -> data, aip, PROJECT_data)) {
222 goto erret;
223 }
224 }
225 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
226 goto erret;
227 }
228 retval = TRUE;
229
230 erret:
231 AsnUnlinkType(orig); /* unlink local tree */
232 return retval;
233 }
234
235
236
237 /**************************************************
238 *
239 * ProjectItemFree()
240 *
241 **************************************************/
242 NLM_EXTERN
243 ProjectItemPtr LIBCALL
244 ProjectItemFree(ValNodePtr anp)
245 {
246 Pointer pnt;
247
248 if (anp == NULL) {
249 return NULL;
250 }
251
252 pnt = anp->data.ptrvalue;
253 switch (anp->choice)
254 {
255 default:
256 break;
257 case ProjectItem_pmuid:
258 AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
259 break;
260 case ProjectItem_protuid:
261 AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
262 break;
263 case ProjectItem_nucuid:
264 AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
265 break;
266 case ProjectItem_sequid:
267 AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
268 break;
269 case ProjectItem_genomeuid:
270 AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
271 break;
272 case ProjectItem_structuid:
273 AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
274 break;
275 case ProjectItem_pmid:
276 AsnGenericBaseSeqOfFree((ValNodePtr) pnt,ASNCODE_INTVAL_SLOT);
277 break;
278 case ProjectItem_protid:
279 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
280 break;
281 case ProjectItem_nucid:
282 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
283 break;
284 case ProjectItem_seqid:
285 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
286 break;
287 case ProjectItem_genomeid:
288 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqIdFree);
289 break;
290 case ProjectItem_pment:
291 AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) PubmedEntryFree);
292 break;
293 case ProjectItem_protent:
294 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
295 break;
296 case ProjectItem_nucent:
297 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
298 break;
299 case ProjectItem_seqent:
300 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
301 break;
302 case ProjectItem_genomeent:
303 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqEntryFree);
304 break;
305 case ProjectItem_seqannot:
306 AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqAnnotFree);
307 break;
308 case ProjectItem_loc:
309 AsnGenericChoiceSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) SeqLocFree);
310 break;
311 case ProjectItem_proj:
312 AsnGenericUserSeqOfFree((Pointer) pnt, (AsnOptFreeFunc) ProjectFree);
313 break;
314 }
315 return MemFree(anp);
316 }
317
318
319 /**************************************************
320 *
321 * ProjectItemAsnRead()
322 *
323 **************************************************/
324 NLM_EXTERN
325 ProjectItemPtr LIBCALL
326 ProjectItemAsnRead(AsnIoPtr aip, AsnTypePtr orig)
327 {
328 DataVal av;
329 AsnTypePtr atp;
330 ValNodePtr anp;
331 Uint1 choice;
332 Boolean isError = FALSE;
333 Boolean nullIsError = FALSE;
334 AsnReadFunc func;
335
336 if (! loaded)
337 {
338 if (! objprojAsnLoad()) {
339 return NULL;
340 }
341 }
342
343 if (aip == NULL) {
344 return NULL;
345 }
346
347 if (orig == NULL) { /* ProjectItem ::= (self contained) */
348 atp = AsnReadId(aip, amp, PROJECT_ITEM);
349 } else {
350 atp = AsnLinkType(orig, PROJECT_ITEM); /* link in local tree */
351 }
352 if (atp == NULL) {
353 return NULL;
354 }
355
356 anp = ValNodeNew(NULL);
357 if (anp == NULL) {
358 goto erret;
359 }
360 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
361 goto erret;
362 }
363
364 func = NULL;
365
366 atp = AsnReadId(aip, amp, atp); /* find the choice */
367 if (atp == NULL) {
368 goto erret;
369 }
370 if (atp == PROJECT_ITEM_pmuid) {
371 choice = ProjectItem_pmuid;
372 anp -> data.ptrvalue =
373 AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
374 if (isError && anp -> data.ptrvalue == NULL) {
375 goto erret;
376 }
377 }
378 else if (atp == PROJECT_ITEM_protuid) {
379 choice = ProjectItem_protuid;
380 anp -> data.ptrvalue =
381 AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
382 if (isError && anp -> data.ptrvalue == NULL) {
383 goto erret;
384 }
385 }
386 else if (atp == PROJECT_ITEM_nucuid) {
387 choice = ProjectItem_nucuid;
388 anp -> data.ptrvalue =
389 AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
390 if (isError && anp -> data.ptrvalue == NULL) {
391 goto erret;
392 }
393 }
394 else if (atp == PROJECT_ITEM_sequid) {
395 choice = ProjectItem_sequid;
396 anp -> data.ptrvalue =
397 AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
398 if (isError && anp -> data.ptrvalue == NULL) {
399 goto erret;
400 }
401 }
402 else if (atp == PROJECT_ITEM_genomeuid) {
403 choice = ProjectItem_genomeuid;
404 anp -> data.ptrvalue =
405 AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
406 if (isError && anp -> data.ptrvalue == NULL) {
407 goto erret;
408 }
409 }
410 else if (atp == PROJECT_ITEM_structuid) {
411 choice = ProjectItem_structuid;
412 anp -> data.ptrvalue =
413 AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
414 if (isError && anp -> data.ptrvalue == NULL) {
415 goto erret;
416 }
417 }
418 else if (atp == PROJECT_ITEM_pmid) {
419 choice = ProjectItem_pmid;
420 anp -> data.ptrvalue =
421 AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_INTVAL_SLOT, &isError);
422 if (isError && anp -> data.ptrvalue == NULL) {
423 goto erret;
424 }
425 }
426 else if (atp == PROJECT_ITEM_protid) {
427 choice = ProjectItem_protid;
428 anp -> data.ptrvalue =
429 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead, (AsnOptFreeFunc) SeqIdFree);
430 if (isError && anp -> data.ptrvalue == NULL) {
431 goto erret;
432 }
433 }
434 else if (atp == PROJECT_ITEM_nucid) {
435 choice = ProjectItem_nucid;
436 anp -> data.ptrvalue =
437 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead, (AsnOptFreeFunc) SeqIdFree);
438 if (isError && anp -> data.ptrvalue == NULL) {
439 goto erret;
440 }
441 }
442 else if (atp == PROJECT_ITEM_seqid) {
443 choice = ProjectItem_seqid;
444 anp -> data.ptrvalue =
445 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead, (AsnOptFreeFunc) SeqIdFree);
446 if (isError && anp -> data.ptrvalue == NULL) {
447 goto erret;
448 }
449 }
450 else if (atp == PROJECT_ITEM_genomeid) {
451 choice = ProjectItem_genomeid;
452 anp -> data.ptrvalue =
453 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqIdAsnRead, (AsnOptFreeFunc) SeqIdFree);
454 if (isError && anp -> data.ptrvalue == NULL) {
455 goto erret;
456 }
457 }
458 else if (atp == PROJECT_ITEM_structid) {
459 choice = ProjectItem_structid;
460 if (AsnReadVal(aip, atp, &av) <= 0) {
461 goto erret;
462 }
463 anp->data.boolvalue = av.boolvalue;
464 }
465 else if (atp == PROJECT_ITEM_pment) {
466 choice = ProjectItem_pment;
467 anp -> data.ptrvalue =
468 AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) PubmedEntryAsnRead, (AsnOptFreeFunc) PubmedEntryFree);
469 if (isError && anp -> data.ptrvalue == NULL) {
470 goto erret;
471 }
472 }
473 else if (atp == PROJECT_ITEM_protent) {
474 choice = ProjectItem_protent;
475 anp -> data.ptrvalue =
476 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
477 if (isError && anp -> data.ptrvalue == NULL) {
478 goto erret;
479 }
480 }
481 else if (atp == PROJECT_ITEM_nucent) {
482 choice = ProjectItem_nucent;
483 anp -> data.ptrvalue =
484 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
485 if (isError && anp -> data.ptrvalue == NULL) {
486 goto erret;
487 }
488 }
489 else if (atp == PROJECT_ITEM_seqent) {
490 choice = ProjectItem_seqent;
491 anp -> data.ptrvalue =
492 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
493 if (isError && anp -> data.ptrvalue == NULL) {
494 goto erret;
495 }
496 }
497 else if (atp == PROJECT_ITEM_genomeent) {
498 choice = ProjectItem_genomeent;
499 anp -> data.ptrvalue =
500 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqEntryAsnRead, (AsnOptFreeFunc) SeqEntryFree);
501 if (isError && anp -> data.ptrvalue == NULL) {
502 goto erret;
503 }
504 }
505 else if (atp == PROJECT_ITEM_structent) {
506 choice = ProjectItem_structent;
507 if (AsnReadVal(aip, atp, &av) <= 0) {
508 goto erret;
509 }
510 anp->data.boolvalue = av.boolvalue;
511 }
512 else if (atp == PROJECT_ITEM_seqannot) {
513 choice = ProjectItem_seqannot;
514 anp -> data.ptrvalue =
515 AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqAnnotAsnRead, (AsnOptFreeFunc) SeqAnnotFree);
516 if (isError && anp -> data.ptrvalue == NULL) {
517 goto erret;
518 }
519 }
520 else if (atp == PROJECT_ITEM_loc) {
521 choice = ProjectItem_loc;
522 anp -> data.ptrvalue =
523 AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) SeqLocAsnRead, (AsnOptFreeFunc) SeqLocFree);
524 if (isError && anp -> data.ptrvalue == NULL) {
525 goto erret;
526 }
527 }
528 else if (atp == PROJECT_ITEM_proj) {
529 choice = ProjectItem_proj;
530 anp -> data.ptrvalue =
531 AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ProjectAsnRead, (AsnOptFreeFunc) ProjectFree);
532 if (isError && anp -> data.ptrvalue == NULL) {
533 goto erret;
534 }
535 }
536 anp->choice = choice;
537 if (func != NULL)
538 {
539 anp->data.ptrvalue = (* func)(aip, atp);
540 if (aip -> io_failure) goto erret;
541
542 if (nullIsError && anp->data.ptrvalue == NULL) {
543 goto erret;
544 }
545 }
546
547 ret:
548 AsnUnlinkType(orig); /* unlink local tree */
549 return anp;
550
551 erret:
552 anp = MemFree(anp);
553 aip -> io_failure = TRUE;
554 goto ret;
555 }
556
557
558 /**************************************************
559 *
560 * ProjectItemAsnWrite()
561 *
562 **************************************************/
563 NLM_EXTERN Boolean LIBCALL
564 ProjectItemAsnWrite(ProjectItemPtr anp, AsnIoPtr aip, AsnTypePtr orig)
565
566 {
567 DataVal av;
568 AsnTypePtr atp, writetype = NULL;
569 Pointer pnt;
570 AsnWriteFunc func = NULL;
571 Boolean retval = FALSE;
572
573 if (! loaded)
574 {
575 if (! objprojAsnLoad())
576 return FALSE;
577 }
578
579 if (aip == NULL)
580 return FALSE;
581
582 atp = AsnLinkType(orig, PROJECT_ITEM); /* link local tree */
583 if (atp == NULL) {
584 return FALSE;
585 }
586
587 if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
588
589 av.ptrvalue = (Pointer)anp;
590 if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
591 goto erret;
592 }
593
594 pnt = anp->data.ptrvalue;
595 switch (anp->choice)
596 {
597 case ProjectItem_pmuid:
598 retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_pmuid, PROJECT_ITEM_pmuid_E); break;
599 case ProjectItem_protuid:
600 retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_protuid, PROJECT_ITEM_protuid_E); break;
601 case ProjectItem_nucuid:
602 retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_nucuid, PROJECT_ITEM_nucuid_E); break;
603 case ProjectItem_sequid:
604 retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_sequid, PROJECT_ITEM_sequid_E); break;
605 case ProjectItem_genomeuid:
606 retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_genomeuid, PROJECT_ITEM_genomeuid_E); break;
607 case ProjectItem_structuid:
608 retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_structuid, PROJECT_ITEM_structuid_E); break;
609 case ProjectItem_pmid:
610 retval = AsnGenericBaseSeqOfAsnWrite((Pointer) pnt,ASNCODE_INTVAL_SLOT, aip, PROJECT_ITEM_pmid, PROJECT_ITEM_pmid_E); break;
611 case ProjectItem_protid:
612 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_protid, PROJECT_ITEM_protid_E);
613 break;
614 case ProjectItem_nucid:
615 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_nucid, PROJECT_ITEM_nucid_E);
616 break;
617 case ProjectItem_seqid:
618 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_seqid, PROJECT_ITEM_seqid_E);
619 break;
620 case ProjectItem_genomeid:
621 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqIdAsnWrite, aip, PROJECT_ITEM_genomeid, PROJECT_ITEM_genomeid_E);
622 break;
623 case ProjectItem_structid:
624 av.boolvalue = anp->data.boolvalue;
625 retval = AsnWrite(aip, PROJECT_ITEM_structid, &av);
626 break;
627 case ProjectItem_pment:
628 retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) PubmedEntryAsnWrite, aip, PROJECT_ITEM_pment, PROJECT_ITEM_pment_E);
629 break;
630 case ProjectItem_protent:
631 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_protent, PROJECT_ITEM_protent_E);
632 break;
633 case ProjectItem_nucent:
634 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_nucent, PROJECT_ITEM_nucent_E);
635 break;
636 case ProjectItem_seqent:
637 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_seqent, PROJECT_ITEM_seqent_E);
638 break;
639 case ProjectItem_genomeent:
640 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqEntryAsnWrite, aip, PROJECT_ITEM_genomeent, PROJECT_ITEM_genomeent_E);
641 break;
642 case ProjectItem_structent:
643 av.boolvalue = anp->data.boolvalue;
644 retval = AsnWrite(aip, PROJECT_ITEM_structent, &av);
645 break;
646 case ProjectItem_seqannot:
647 retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqAnnotAsnWrite, aip, PROJECT_ITEM_seqannot, PROJECT_ITEM_seqannot_E);
648 break;
649 case ProjectItem_loc:
650 retval = AsnGenericChoiceSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) SeqLocAsnWrite, aip, PROJECT_ITEM_loc, PROJECT_ITEM_loc_E);
651 break;
652 case ProjectItem_proj:
653 retval = AsnGenericUserSeqOfAsnWrite((Pointer) pnt, (AsnWriteFunc) ProjectAsnWrite, aip, PROJECT_ITEM_proj, PROJECT_ITEM_proj_E);
654 break;
655 }
656 if (writetype != NULL) {
657 retval = (* func)(pnt, aip, writetype); /* write it out */
658 }
659 if (!retval) {
660 goto erret;
661 }
662 retval = TRUE;
663
664 erret:
665 AsnUnlinkType(orig); /* unlink local tree */
666 return retval;
667 }
668
669
670 /**************************************************
671 *
672 * ProjectDescrNew()
673 *
674 **************************************************/
675 NLM_EXTERN
676 ProjectDescrPtr LIBCALL
677 ProjectDescrNew(void)
678 {
679 ProjectDescrPtr ptr = MemNew((size_t) sizeof(ProjectDescr));
680
681 return ptr;
682
683 }
684
685
686 /**************************************************
687 *
688 * ProjectDescrFree()
689 *
690 **************************************************/
691 NLM_EXTERN
692 ProjectDescrPtr LIBCALL
693 ProjectDescrFree(ProjectDescrPtr ptr)
694 {
695
696 if(ptr == NULL) {
697 return NULL;
698 }
699 AsnGenericBaseSeqOfFree(ptr -> id ,ASNCODE_PTRVAL_SLOT);
700 MemFree(ptr -> name);
701 AsnGenericChoiceSeqOfFree(ptr -> descr, (AsnOptFreeFunc) ProjdescFree);
702 return MemFree(ptr);
703 }
704
705
706 /**************************************************
707 *
708 * ProjectDescrAsnRead()
709 *
710 **************************************************/
711 NLM_EXTERN
712 ProjectDescrPtr LIBCALL
713 ProjectDescrAsnRead(AsnIoPtr aip, AsnTypePtr orig)
714 {
715 DataVal av;
716 AsnTypePtr atp;
717 Boolean isError = FALSE;
718 AsnReadFunc func;
719 ProjectDescrPtr ptr;
720
721 if (! loaded)
722 {
723 if (! objprojAsnLoad()) {
724 return NULL;
725 }
726 }
727
728 if (aip == NULL) {
729 return NULL;
730 }
731
732 if (orig == NULL) { /* ProjectDescr ::= (self contained) */
733 atp = AsnReadId(aip, amp, PROJECT_DESCR);
734 } else {
735 atp = AsnLinkType(orig, PROJECT_DESCR);
736 }
737 /* link in local tree */
738 if (atp == NULL) {
739 return NULL;
740 }
741
742 ptr = ProjectDescrNew();
743 if (ptr == NULL) {
744 goto erret;
745 }
746 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
747 goto erret;
748 }
749
750 atp = AsnReadId(aip,amp, atp);
751 func = NULL;
752
753 if (atp == PROJECT_DESCR_id) {
754 ptr -> id = AsnGenericBaseSeqOfAsnRead(aip, amp, atp, ASNCODE_PTRVAL_SLOT, &isError);
755 if (isError && ptr -> id == NULL) {
756 goto erret;
757 }
758 atp = AsnReadId(aip,amp, atp);
759 }
760 if (atp == PROJECT_DESCR_name) {
761 if ( AsnReadVal(aip, atp, &av) <= 0) {
762 goto erret;
763 }
764 ptr -> name = av.ptrvalue;
765 atp = AsnReadId(aip,amp, atp);
766 }
767 if (atp == PROJECT_DESCR_descr) {
768 ptr -> descr = AsnGenericChoiceSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) ProjdescAsnRead, (AsnOptFreeFunc) ProjdescFree);
769 if (isError && ptr -> descr == NULL) {
770 goto erret;
771 }
772 atp = AsnReadId(aip,amp, atp);
773 }
774
775 if (AsnReadVal(aip, atp, &av) <= 0) {
776 goto erret;
777 }
778 /* end struct */
779
780 ret:
781 AsnUnlinkType(orig); /* unlink local tree */
782 return ptr;
783
784 erret:
785 aip -> io_failure = TRUE;
786 ptr = ProjectDescrFree(ptr);
787 goto ret;
788 }
789
790
791
792 /**************************************************
793 *
794 * ProjectDescrAsnWrite()
795 *
796 **************************************************/
797 NLM_EXTERN Boolean LIBCALL
798 ProjectDescrAsnWrite(ProjectDescrPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
799 {
800 DataVal av;
801 AsnTypePtr atp;
802 Boolean retval = FALSE;
803
804 if (! loaded)
805 {
806 if (! objprojAsnLoad()) {
807 return FALSE;
808 }
809 }
810
811 if (aip == NULL) {
812 return FALSE;
813 }
814
815 atp = AsnLinkType(orig, PROJECT_DESCR); /* link local tree */
816 if (atp == NULL) {
817 return FALSE;
818 }
819
820 if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
821 if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
822 goto erret;
823 }
824
825 retval = AsnGenericBaseSeqOfAsnWrite(ptr -> id ,ASNCODE_PTRVAL_SLOT, aip, PROJECT_DESCR_id, PROJECT_DESCR_id_E);
826 if (ptr -> name != NULL) {
827 av.ptrvalue = ptr -> name;
828 retval = AsnWrite(aip, PROJECT_DESCR_name, &av);
829 }
830 AsnGenericChoiceSeqOfAsnWrite(ptr -> descr, (AsnWriteFunc) ProjdescAsnWrite, aip, PROJECT_DESCR_descr, PROJECT_DESCR_descr_E);
831 if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
832 goto erret;
833 }
834 retval = TRUE;
835
836 erret:
837 AsnUnlinkType(orig); /* unlink local tree */
838 return retval;
839 }
840
841
842
843 /**************************************************
844 *
845 * ProjdescFree()
846 *
847 **************************************************/
848 NLM_EXTERN
849 ProjdescPtr LIBCALL
850 ProjdescFree(ValNodePtr anp)
851 {
852 Pointer pnt;
853
854 if (anp == NULL) {
855 return NULL;
856 }
857
858 pnt = anp->data.ptrvalue;
859 switch (anp->choice)
860 {
861 default:
862 break;
863 case Projdesc_pub:
864 PubdescFree(anp -> data.ptrvalue);
865 break;
866 case Projdesc_date:
867 DateFree(anp -> data.ptrvalue);
868 break;
869 case Projdesc_comment:
870 MemFree(anp -> data.ptrvalue);
871 break;
872 case Projdesc_title:
873 MemFree(anp -> data.ptrvalue);
874 break;
875 }
876 return MemFree(anp);
877 }
878
879
880 /**************************************************
881 *
882 * ProjdescAsnRead()
883 *
884 **************************************************/
885 NLM_EXTERN
886 ProjdescPtr LIBCALL
887 ProjdescAsnRead(AsnIoPtr aip, AsnTypePtr orig)
888 {
889 DataVal av;
890 AsnTypePtr atp;
891 ValNodePtr anp;
892 Uint1 choice;
893 Boolean isError = FALSE;
894 Boolean nullIsError = FALSE;
895 AsnReadFunc func;
896
897 if (! loaded)
898 {
899 if (! objprojAsnLoad()) {
900 return NULL;
901 }
902 }
903
904 if (aip == NULL) {
905 return NULL;
906 }
907
908 if (orig == NULL) { /* Projdesc ::= (self contained) */
909 atp = AsnReadId(aip, amp, PROJDESC);
910 } else {
911 atp = AsnLinkType(orig, PROJDESC); /* link in local tree */
912 }
913 if (atp == NULL) {
914 return NULL;
915 }
916
917 anp = ValNodeNew(NULL);
918 if (anp == NULL) {
919 goto erret;
920 }
921 if (AsnReadVal(aip, atp, &av) <= 0) { /* read the CHOICE or OpenStruct value (nothing) */
922 goto erret;
923 }
924
925 func = NULL;
926
927 atp = AsnReadId(aip, amp, atp); /* find the choice */
928 if (atp == NULL) {
929 goto erret;
930 }
931 if (atp == PROJDESC_pub) {
932 choice = Projdesc_pub;
933 func = (AsnReadFunc) PubdescAsnRead;
934 }
935 else if (atp == PROJDESC_date) {
936 choice = Projdesc_date;
937 func = (AsnReadFunc) DateAsnRead;
938 }
939 else if (atp == PROJDESC_comment) {
940 choice = Projdesc_comment;
941 if (AsnReadVal(aip, atp, &av) <= 0) {
942 goto erret;
943 }
944 anp->data.ptrvalue = av.ptrvalue;
945 }
946 else if (atp == PROJDESC_title) {
947 choice = Projdesc_title;
948 if (AsnReadVal(aip, atp, &av) <= 0) {
949 goto erret;
950 }
951 anp->data.ptrvalue = av.ptrvalue;
952 }
953 anp->choice = choice;
954 if (func != NULL)
955 {
956 anp->data.ptrvalue = (* func)(aip, atp);
957 if (aip -> io_failure) goto erret;
958
959 if (nullIsError && anp->data.ptrvalue == NULL) {
960 goto erret;
961 }
962 }
963
964 ret:
965 AsnUnlinkType(orig); /* unlink local tree */
966 return anp;
967
968 erret:
969 anp = MemFree(anp);
970 aip -> io_failure = TRUE;
971 goto ret;
972 }
973
974
975 /**************************************************
976 *
977 * ProjdescAsnWrite()
978 *
979 **************************************************/
980 NLM_EXTERN Boolean LIBCALL
981 ProjdescAsnWrite(ProjdescPtr anp, AsnIoPtr aip, AsnTypePtr orig)
982
983 {
984 DataVal av;
985 AsnTypePtr atp, writetype = NULL;
986 Pointer pnt;
987 AsnWriteFunc func = NULL;
988 Boolean retval = FALSE;
989
990 if (! loaded)
991 {
992 if (! objprojAsnLoad())
993 return FALSE;
994 }
995
996 if (aip == NULL)
997 return FALSE;
998
999 atp = AsnLinkType(orig, PROJDESC); /* link local tree */
1000 if (atp == NULL) {
1001 return FALSE;
1002 }
1003
1004 if (anp == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1005
1006 av.ptrvalue = (Pointer)anp;
1007 if (! AsnWriteChoice(aip, atp, (Int2)anp->choice, &av)) {
1008 goto erret;
1009 }
1010
1011 pnt = anp->data.ptrvalue;
1012 switch (anp->choice)
1013 {
1014 case Projdesc_pub:
1015 writetype = PROJDESC_pub;
1016 func = (AsnWriteFunc) PubdescAsnWrite;
1017 break;
1018 case Projdesc_date:
1019 writetype = PROJDESC_date;
1020 func = (AsnWriteFunc) DateAsnWrite;
1021 break;
1022 case Projdesc_comment:
1023 av.ptrvalue = anp->data.ptrvalue;
1024 retval = AsnWrite(aip, PROJDESC_comment, &av);
1025 break;
1026 case Projdesc_title:
1027 av.ptrvalue = anp->data.ptrvalue;
1028 retval = AsnWrite(aip, PROJDESC_title, &av);
1029 break;
1030 }
1031 if (writetype != NULL) {
1032 retval = (* func)(pnt, aip, writetype); /* write it out */
1033 }
1034 if (!retval) {
1035 goto erret;
1036 }
1037 retval = TRUE;
1038
1039 erret:
1040 AsnUnlinkType(orig); /* unlink local tree */
1041 return retval;
1042 }
1043 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |