|
NCBI Home IEB Home C Toolkit docs C++ Toolkit source browser C Toolkit source browser (2) |
NCBI C Toolkit Cross ReferenceC/object/objgen.h |
source navigation diff markup identifier search freetext search file search |
1 /* objgen.h
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * File Name: objgen.h
27 *
28 * Author: James Ostell
29 *
30 * Version Creation Date: 1/1/91
31 *
32 * $Revision: 6.15 $
33 *
34 * File Description: Object manager interface for module NCBI-General
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * Date Name Description of modification
39 * ------- ---------- -----------------------------------------------------
40 *
41 * ==========================================================================
42 */
43
44 #ifndef _NCBI_General_
45 #define _NCBI_General_
46
47 #ifndef _ASNTOOL_
48 #include <asn.h>
49 #endif
50
51 #undef NLM_EXTERN
52 #ifdef NLM_IMPORT
53 #define NLM_EXTERN NLM_IMPORT
54 #else
55 #define NLM_EXTERN extern
56 #endif
57
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61
62 /* gather/objmgr fields to be added to bioseq, features, descriptors, etc. */
63
64 #define EXTRA_OBJMGR_FIELDS \
65 Uint2 entityID; \
66 Uint2 itemtype; \
67 Uint1 subtype; \
68 Uint1 deleteme; \
69 Uint2 parenttype; \
70 Uint4 itemID; \
71 Pointer parentptr; \
72 Pointer PNTR prevlink; \
73 Pointer scratch;
74
75 /* structure containing gather/objmgr fields to add as a block to other structures */
76
77 typedef struct gatherindex {
78 EXTRA_OBJMGR_FIELDS
79 } GatherIndex, PNTR GatherIndexPtr;
80
81 /* extended valnode for linking seqdesc, perhaps seqid and seqloc */
82
83 typedef struct objvalnode {
84 ValNode vn;
85 GatherIndex idx;
86 } ObjValNode, PNTR ObjValNodePtr;
87
88 /* ValNode equivalent functions that allocate ObjValNode size */
89
90 NLM_EXTERN ValNodePtr LIBCALL SeqDescrNew (ValNodePtr vnp);
91 NLM_EXTERN ValNodePtr LIBCALL SeqDescrAdd (ValNodePtr PNTR head);
92 NLM_EXTERN ValNodePtr LIBCALL SeqDescrAddPointer (ValNodePtr PNTR head, Int2 choice, VoidPtr value);
93
94 /*****************************************************************************
95 *
96 * loader
97 *
98 *****************************************************************************/
99 NLM_EXTERN Boolean LIBCALL GeneralAsnLoad PROTO((void));
100
101 /*****************************************************************************
102 *
103 * internal structures for NCBI-General objects
104 *
105 *****************************************************************************/
106
107 /*****************************************************************************
108 *
109 * Date, Date-std share the same structure
110 * any data[2] or data[3] values = 0 means not set or not present
111 * data [0] - CHOICE of date ,0=str, 1=std
112 * [1] - year (- 1900)
113 * [2] - month (1-12) optional
114 * [3] - day (1-31) optional
115 * [4] - hour (0-23) optional 255=not set
116 * [5] - minute (0-59) optional 255=not set
117 * [6] - second (0-59) optional 255=not set
118 * [7] - not currently used
119 *
120 *****************************************************************************/
121
122 #define NOT_SET 255
123
124 typedef struct date {
125 Uint1 data[8]; /* see box above */
126 CharPtr str; /* str or season or NULL */
127 } NCBI_Date, PNTR NCBI_DatePtr;
128 #define DatePtr NCBI_DatePtr
129
130
131 NLM_EXTERN NCBI_DatePtr LIBCALL DateNew PROTO((void));
132 NLM_EXTERN NCBI_DatePtr LIBCALL DateClean PROTO((NCBI_DatePtr dp));
133 NLM_EXTERN NCBI_DatePtr LIBCALL DateFree PROTO((NCBI_DatePtr dp));
134 NLM_EXTERN Boolean LIBCALL DateWrite PROTO((NCBI_DatePtr dp, Int2 year, Int2 month, Int2 day, CharPtr season));
135 NLM_EXTERN Boolean LIBCALL DateRead PROTO((NCBI_DatePtr dp, Int2Ptr year, Int2Ptr month, Int2Ptr day, CharPtr season));
136 NLM_EXTERN Boolean LIBCALL DatePrint PROTO((NCBI_DatePtr dp, CharPtr buf));
137 NLM_EXTERN NCBI_DatePtr LIBCALL DateCurr PROTO((void)); /* time fields not set */
138 NLM_EXTERN NCBI_DatePtr LIBCALL DateTimeCurr PROTO((void)); /* fills time fields too */
139 NLM_EXTERN NCBI_DatePtr LIBCALL DateDup PROTO((NCBI_DatePtr dp));
140 NLM_EXTERN Boolean LIBCALL DateAsnWrite PROTO((NCBI_DatePtr dp, AsnIoPtr aip, AsnTypePtr atp));
141 NLM_EXTERN NCBI_DatePtr LIBCALL DateAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
142 NLM_EXTERN Int2 LIBCALL DateMatch PROTO((DatePtr a, DatePtr b, Boolean all));
143 NLM_EXTERN DatePtr LIBCALL DateParse (CharPtr str);
144
145 /*****************************************************************************
146 *
147 * DateCheck (dp)
148 * Checks the date and month values in a date structure
149 * returns:
150 * -4 = NULL pointer passed in
151 * -3 = string date, can't be checked
152 * -2 = month not set (but otherwise ok)
153 * -1 = day not set (but otherwise ok)
154 * 0 = date ok, month,day,year all set
155 * 1 = day invalid
156 * 2 = month invalid
157 * 3 = year not set (required for date)
158 *
159 *****************************************************************************/
160 NLM_EXTERN Int2 LIBCALL DateCheck PROTO((DatePtr dp));
161
162 /*****************************************************************************
163 *
164 * Object-id stuff
165 *
166 *****************************************************************************/
167 typedef struct objid {
168 Int4 id;
169 CharPtr str;
170 } ObjectId, PNTR ObjectIdPtr;
171
172 NLM_EXTERN ObjectIdPtr LIBCALL ObjectIdNew PROTO((void));
173 NLM_EXTERN ObjectIdPtr LIBCALL ObjectIdFree PROTO(( ObjectIdPtr oid));
174 NLM_EXTERN ObjectIdPtr LIBCALL ObjectIdAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
175 NLM_EXTERN Boolean LIBCALL ObjectIdAsnWrite PROTO((ObjectIdPtr oid, AsnIoPtr aip, AsnTypePtr atp));
176 NLM_EXTERN Boolean LIBCALL ObjectIdMatch PROTO((ObjectIdPtr a, ObjectIdPtr b));
177 NLM_EXTERN Boolean LIBCALL ObjectIdMatchEx PROTO((ObjectIdPtr a, ObjectIdPtr b, Boolean case_sensitive));
178 NLM_EXTERN ObjectIdPtr LIBCALL ObjectIdDup PROTO((ObjectIdPtr oldid));
179
180 /*****************************************************************************
181 *
182 * DBtag stuff
183 *
184 *****************************************************************************/
185 typedef struct dbtag {
186 CharPtr db;
187 ObjectIdPtr tag;
188 } Dbtag, PNTR DbtagPtr;
189
190 NLM_EXTERN DbtagPtr LIBCALL DbtagNew PROTO((void));
191 NLM_EXTERN DbtagPtr LIBCALL DbtagFree PROTO(( DbtagPtr dbt));
192 NLM_EXTERN DbtagPtr LIBCALL DbtagAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
193 NLM_EXTERN Boolean LIBCALL DbtagAsnWrite PROTO((DbtagPtr dbt, AsnIoPtr aip, AsnTypePtr atp));
194 NLM_EXTERN Boolean LIBCALL DbtagMatchEx PROTO((DbtagPtr a, DbtagPtr b, Boolean case_sensitive));
195 NLM_EXTERN Boolean LIBCALL DbtagMatch PROTO((DbtagPtr a, DbtagPtr b));
196 NLM_EXTERN DbtagPtr LIBCALL DbtagDup PROTO((DbtagPtr oldtag));
197 NLM_EXTERN Int2 LIBCALL DbtagLabel PROTO((DbtagPtr dbt, CharPtr buf, Int2 buflen));
198
199 /*****************************************************************************
200 *
201 * Name-std
202 * names[0] = last
203 * [1] = first
204 * [2] = middle
205 * [3] = full
206 * [4] = initials
207 * [5] = suffix
208 * [6] = title
209 *
210 *****************************************************************************/
211 typedef struct namestd {
212 CharPtr names[7];
213 } NameStd, PNTR NameStdPtr;
214
215 NLM_EXTERN NameStdPtr LIBCALL NameStdNew PROTO((void));
216 NLM_EXTERN NameStdPtr LIBCALL NameStdFree PROTO(( NameStdPtr nsp));
217 NLM_EXTERN NameStdPtr LIBCALL NameStdAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
218 NLM_EXTERN Boolean LIBCALL NameStdAsnWrite PROTO((NameStdPtr nsp, AsnIoPtr aip, AsnTypePtr atp));
219 NLM_EXTERN Boolean LIBCALL NameStdMatch (NameStdPtr nsp1, NameStdPtr nsp2);
220
221 /*****************************************************************************
222 *
223 * Person-id
224 * choice = 0 = not set
225 * 1 = dbtag
226 * 2 = name
227 * 3 = ml
228 * 4 = str
229 * 5 = consortium
230 *
231 *****************************************************************************/
232 typedef struct personid {
233 Uint1 choice; /* which CHOICE, see above */
234 Pointer data; /* points to appropriate data structure */
235 } PersonId, PNTR PersonIdPtr;
236
237 NLM_EXTERN PersonIdPtr LIBCALL PersonIdNew PROTO((void));
238 NLM_EXTERN PersonIdPtr LIBCALL PersonIdFree PROTO(( PersonIdPtr pid));
239 NLM_EXTERN PersonIdPtr LIBCALL PersonIdAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
240 NLM_EXTERN Boolean LIBCALL PersonIdAsnWrite PROTO((PersonIdPtr pid, AsnIoPtr aip, AsnTypePtr atp));
241 NLM_EXTERN Boolean LIBCALL PersonIdMatch (PersonIdPtr pip1, PersonIdPtr pip2);
242
243 /*****************************************************************************
244 *
245 * PersonIdLabel(pid, buf, buflen, format)
246 * Makes a short label, lastname then initials if it can
247 * format = PIDLABEL_GENBANK last,initials
248 * PIDLABEL_EMBL last initials
249 *
250 * Modeled from GBGetAuthNames in asn2ff
251 * returns number of bytes in buf
252 * buf MUST be at least (buflen + 1) long
253 *
254 *****************************************************************************/
255 NLM_EXTERN Int2 LIBCALL PersonIdLabel PROTO((PersonIdPtr pid, CharPtr buf, Int2 buflen, Int2 format));
256 #define PIDLABEL_GENBANK 1
257 #define PIDLABEL_EMBL 2
258
259 /*****************************************************************************
260 *
261 * Int-fuzz
262 *
263 *****************************************************************************/
264 typedef struct intfuzz {
265 Uint1 choice; /* 1=p-m, 2=range, 3=pct, 4=lim 5=alt */
266 Int4 a, b; /* a=p-m,max,pct,orlim, b=min */
267 Int4Ptr alt; /* alternate positions, a=num alts, b=array size */
268 } IntFuzz, PNTR IntFuzzPtr;
269
270 NLM_EXTERN IntFuzzPtr LIBCALL IntFuzzNew PROTO((void));
271 NLM_EXTERN IntFuzzPtr LIBCALL IntFuzzFree PROTO(( IntFuzzPtr ifp));
272 NLM_EXTERN IntFuzzPtr LIBCALL IntFuzzAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
273 NLM_EXTERN Boolean LIBCALL IntFuzzAsnWrite PROTO((IntFuzzPtr ifp, AsnIoPtr aip, AsnTypePtr atp));
274
275 /*****************************************************************************
276 *
277 * User-field
278 * data is an DataVal where:
279 * choice asn1 data. =
280 1 = str VisibleString , ptrvalue = CharPtr
281 2 = int INTEGER , intvalue
282 3 = real REAL , realvalue
283 4 = bool BOOLEAN , boolvalue
284 5 = os OCTET STRING , ptrvalue = ByteStorePtr
285 6 = object User-object , ptrvalue = UserObjectPtr
286 7 = strs SEQUENCE OF VisibleString , ptrvalue = CharPtr PNTR
287 8 = ints SEQUENCE OF INTEGER , ptrvalue = Int4Ptr
288 9 = reals SEQUENCE OF REAL , ptrvalue = FloatHiPtr
289 10 = oss SEQUENCE OF OCTET STRING , ptrvalue = ByteStorePtr PNTR
290 11 = fields SEQUENCE OF User-field , ptrvalue = UserFieldPtr
291 12 = objects SEQUENCE OF User-object } } ptrvalue = UserObjectPtr
292
293 * User-object
294 *
295 *****************************************************************************/
296 typedef struct userfield {
297 ObjectIdPtr label;
298 Int4 num;
299 Uint1 choice;
300 DataVal data;
301 struct userfield PNTR next;
302 } UserField, PNTR UserFieldPtr;
303
304 NLM_EXTERN UserFieldPtr LIBCALL UserFieldNew PROTO((void));
305 NLM_EXTERN UserFieldPtr LIBCALL UserFieldFree PROTO(( UserFieldPtr ufp));
306 NLM_EXTERN UserFieldPtr LIBCALL UserFieldAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
307 NLM_EXTERN Boolean LIBCALL UserFieldAsnWrite PROTO((UserFieldPtr ufp, AsnIoPtr aip, AsnTypePtr atp));
308
309 typedef struct userobj {
310 CharPtr _class;
311 ObjectIdPtr type;
312 UserFieldPtr data;
313 struct userobj PNTR next; /* for SEQUENCE OF User-object */
314 } UserObject, PNTR UserObjectPtr;
315
316 NLM_EXTERN UserObjectPtr LIBCALL UserObjectNew PROTO((void));
317 NLM_EXTERN UserObjectPtr LIBCALL UserObjectFree PROTO(( UserObjectPtr uop));
318 NLM_EXTERN UserObjectPtr LIBCALL UserObjectAsnRead PROTO((AsnIoPtr aip, AsnTypePtr atp));
319 NLM_EXTERN Boolean LIBCALL UserObjectAsnWrite PROTO((UserObjectPtr uop, AsnIoPtr aip, AsnTypePtr atp));
320
321 #ifdef __cplusplus
322 }
323 #endif
324
325 #undef NLM_EXTERN
326 #ifdef NLM_EXPORT
327 #define NLM_EXTERN NLM_EXPORT
328 #else
329 #define NLM_EXTERN
330 #endif
331
332 #endif
333
334 |
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |