Elaboradar 0.1
Caricamento in corso...
Ricerca in corso...
Nessun risultato
meteo_db.h
Vai alla documentazione di questo file.
1
5/*---------------------------------------------------------------------------*
6 * NAME/VERSION : meteo_db.h *
7 * *
8 * C.I. : *
9 * *
10 * AUTHOR : Michele Dassisti *
11 * *
12 * *
13 * DESCRIPTION : *
14 * *
15 * Yet implements a new meteo_db architecture whose main features are: *
16 * *
17 * 1. index file (old e_file) plus a data file : dense index and main file*
18 * architecture. *
19 * *
20 * 2. The index file is organized in two queue double lists of record (idx_rec)
21 * , the available and free lists. Each record contains a couple of *
22 * pointers to the next and previous record in the queue. The record
23 * information part embeds the most important attributes that a meteo
24 * map can have, among them the starting point offset value of the map *
25 * data in the associated data file. *
26 * *
27 * 3. The data file has in its top position the related idx rec plus, if
28 * necessary, a certain amount of more attribute information called *
29 * expansion data. After that header there's the map meteo data. *
30 * *
31 * 4. Extensive bit field data coding has been used in order to minimize *
32 * disk space use. *
33 * *
34 * 5. Data file name are created at run time as soon as needed elaborating *
35 * the suitable attribute information in the idx_rec. This for saving space
36 * on disk. *
37 * *
38 * 6. Access to an item by attribute value requires a sequential search *
39 * along the pointers chain. *
40 * *
41 * 7. Insertion requires either a move of a idx rec from free list to the *
42 * available list bottom position or a deletion of the oldest idx rec *
43 * in available list at top position. *
44 * *
45 * 8. Deletion requires a move from the available list to the free one plus
46 * a data file deletion. *
47 * *
48 * 9. A series of idx rec status flag has been implemented for saving maps *
49 * from deletion and for automatic backup. *
50 * CODING DATE : 2/5/91 *
51 * *
52 * MASTER LIBRARY TRANSFERT DATE : 3/5/91 *
53 * *
54 * *
55 * *
56 *--------------------- MODIFICATION HISTORY ------------------------------*
57 * *
58 * MODIFICATION DATE : *
59 * 3-jun-1991 F. Di Pace
60 * *
61 * MODIFICATION AUTHOR : *
62 * *
63 * MODIFICATION DESCRIPTION : *
64 * *
65 * *
66 * *
67 * RATIONALE : *
68 * *
69 * *
70 *---------------------------------------------------------------------------*/
71
72#ifndef METEO_DB_DEFINITION
73#define METEO_DB_DEFINITION
74
75
76#define MDB_SIGN "MDB_2.0"
77
78/* open MDB MODES */
79
80#define UPDATE 1L
81#define WRITE UPDATE
82#define READ 2L
83#define CREATE 3L
84
85#define MDB_UPDATE 1L
86#define MDB_WRITE UPDATE
87#define MDB_READ 2L
88#define MDB_CREATE 3L
89#define MDB_DELETE 4L
90#define MDB_KEEP 5L
91#define MDB_INSERT 6L
92#define MDB_RECOVERY 7L
93
94#define MDB_PAR_SYS_KEEP 1L /* usato per i dbp di declutter*/
95#define MDB_PAR_KEEP 2L /*usato per rat,utr,clb ecc.*/
96#define MDB_PAR_BUSY 3L /*usato per il backup su nastro*/
97#define MDB_PAR_BACKUP 4L
98
99/* MDB_ compression falg */
100#define MDB_ENCODE 0L
101#define MDB_DECODE 1L
102
103
104/* MDB ERRROR CODES */
105
106#define E_UNABLE -1
107#define E_LOCK -2
108#define E_DMODE -3 /* return by del fil */
109
110/* MDB_FUNCTIONS command codes */
111
112#define NEWEST 1
113#define OLDEST 2
114#define ACC_by_OFFSET 3
115#define ACC_by_NAME 4
116
117
118
119/* stato record */
120#define DELETED 0 /* e_rec is logically deleted adn data file phisically erased */
121#define UNLINKED 1 /* e_rec hasn't associate data file -- start up condition */
122#define LINKED 2 /* e_rec has a link with a data file */
123
124#define DBP_GRAND_Z 1
125#define DBP_GRAND_D 2
126#define DBP_GRAND_V 4
127#define DBP_GRAND_S 8
128
129 /* Tipi ASM */
130#define ASM_AZ 1
131#define ASM_VER 2
132#define ASM_RAD 4
133 /* piani rife HVMI */
134#define HVMI_XZ 1
135#define HVMI_YZ 2
136#define HVMI_XY 4
137 /* tipo estrazione SRT/ART */
138#define MOD_INT_AUT 0
139#define MOD_INT_MAN 1
140
141 /* piano riferimento */
142
143#define PLAN_XZ 0
144#define PLAN_YZ 1
145#define PLAN_XY 2
146#define PLAN_Z 3
147
148 /* tipo di riempimento */
149#define FILL_RAS 0
150#define FILL_NUM 1
151 /* tipo di compression */
152#define NO_COMPRESSION 0
153#define HUFFMAN_COMPONENTS_COMPRESSION 1
154
155
156 /*---------------------------------*
157 * PARAMETERS DEFINITION *
158 *---------------------------------*/
159 /*---------------------------------*
160 * STUFFS TYPE DEFINITION *
161 *---------------------------------*/
162
163 /*---------------------------------*
164 * data_files types *
165 *---------------------------------*/
166#define MDB_max_e_type 9
167typedef enum {DBP_IDX, /* 0 */
168 RT_PROD_IDX, /* 1 */
169 SEC_PROD_IDX, /* 2 */
170 INT_PROD_IDX, /* 3 */
171 DECL_MAP_IDX, /* 4 */
172 SENS_DATA_SIAP_IDX, /* 5 */
173 SENS_DATA_CAE_IDX, /* 6 */
174 RAT_IDX, /* 7 */
175 CDS_A_SET_IDX, /* 8 */
176 UTRM_IDX /* 9 */
177 } T_MDB_e_set_name;
178
179#define RASTER_IDX INT_PROD_IDX
180
181/**** e_file item number ***/
182
183#define TOT_DBP 10 /*dbp completi nel db */
184#define E_DBP_NUM TOT_DBP*4
185 /* num file nel dbp 1 per grande*/
186#define E_RTP_NUM 40
187#define E_SEP_NUM 40
188/* num. prod integrati = cmm+srt+art number */
189#define E_INP_NUM 10
190#define E_DEC_NUM 56
191#define E_SEN_NUM 50
192#define A_SET_NUM 30 /* num of a_set files from cds*/
193#define E_PRO_NUM E_RTP_NUM + E_SEP_NUM
194#define E_RAT_NUM 200
195#define E_UTRM_NUM 200
196#define E_ARCHIVE_NUM 50
197
198/* dimensione file dei prodotti componenti un dato prodotto integrato */
199
200
201
202
203/* data space parms */
204
205#define QUANT_NUM 4 /* z,d,s,v */
206#define ONE_QUANT_DBP_SIZE 8 * 1024* 1024 /* in bytes */
207#define ONE_DBP_SPACE QUANT_NUM * ONE_QUANT_DBP_SIZE
208/* deve essere = ONE_DBP_SPACE / 4 = index file size + data file size +
209 acq header infi size (T_MDB_acq_header*/
210
211#define DBP_DATA_SPACE TOT_DBP * ONE_DBP_SPACE /* in bytes */
212#define RTP_DATA_SPACE E_RTP_NUM *400 *1024 /* 2 sri da 512 * 512 */
213#define SEP_DATA_SPACE E_SEP_NUM *400*1024 /* in bytes */
214#define INP_DATA_SPACE E_INP_NUM *100*1024 /* in bytes */
215#define DEC_DATA_SPACE 1 /* in bytes */
216#define SEN_DATA_SPACE 1 /* in bytes */
217#define CDS_DATA_SPACE 10 * 8 *30 /* in bytes */
218#define PRO_DATA_SPACE RTP_DATA_SPACE + SEP_DATA_SPACE
219#define RAT_DATA_SPACE E_RAT_NUM * 100 * 1024
220#define UTRM_DATA_SPACE E_UTRM_NUM * 10 * 1024 +\
221 E_ARCHIVE_NUM * 600 *1024
222/* num record acquisizione per stazione */
223#define SIAP_SEN_REC_NUM 72
224#define CAE_SEN_REC_NUM 144
225
226
227#define DATA_REC_SIZE 64*1024
228
229
230/* acquisition el number */
231#define EL_MAX_NUM 20
232
233#define MAX_BEAM_SIZE 1024
234
235
236/* max comp in a multifile */
237#define MAX_COMP 60
238#define MULTI_COMP_MAX_NUM MAX_COMP /* 4*4 */
239#define MULTI_FILE_MAX_NUM 4
240#define MAX_CLASS_TYPE 30
241#define NULL_INDEX 0
242
243 /*------------------------------
244 * post el counters array *
245 * sizes. used for sep and *
246 * inp . *
247 *----------------------------*/
248
249#define SEP_NUM 14 /* different sep+ intp num */
250#define ACQ_NUM 999 /* max aqc count val in mod 999*/
251
252
253
254
255
256
257 /*------------------------------
258 * sel_sri.c start sri set mark val
259 * separes differant sri-name-sets
260 *----------------------------*/
261
262
263#define START_OF_SET_MARK 0xff
264
265
266
267/*** max num of componemt slot in array struct for integr product ****/
268#define COMP_MAX_NUM 270
269
270
271
272/*** max num of a_set name in meteo_db , cds area file selection ****/
273#define A_SET_MAX_NUM 10
274
275
276
277
278
279 /*------------------------------
280 * prod name ->index value *
281 * association in array *
282 *----------------------------*/
283
284/* meteo_db.c data acq timeout **************************/
285
286#define DBP_DATA_TIMEOUT 5 *60 /*sec */
287#define RTP_DATA_TIMEOUT 5 *60 /*sec */
288
289
290
291
292
293
294/* meteo_db.c find function out file name****************/
295
296
297
298#define FIND_FILE "/tmp/find.tmp"
299
300
301
302/* meteo_db.c select_sri function out file name****************/
303
304#define SRI_SET_FILE "/proj/tmp/sel_sri.tmp"
305#define VOL_ACQ_SRI 1 /* selection critaria */
306#define MATCH_SECT_SRI 2 /* selection critaria */
307
308
309/* meteo_db.c queues conf parms **************************/
310
311
312
313#define HIGH_DATA_SIZE 1
314#define LOW_DATA_SIZE 26
315
316
317
318/*queues selector coding -- prov. oper. ***********/
319#define QUERY 1
320#define INS_DBP 2 /* high queue */
321#define INS_RTPRO 3 /* high queue */
322#define INS_INTPRO 4
323#define INS_DECL 5
324#define INS_SECPRO 6
325#define INS_SD 7
326#define START 8
327#define STOP 9
328#define CLOSE_FILE 10
329
330
331/* meteo_db queue msg parms ****************************/
332
333#define PROD_INFO_MSG_SIZE 1
334#define FILE_NAME_MSG_SIZE 1
335#define CLOSE_FILE_MSG_SIZE 1
336
337/* part_dbp.c parms *************************/
338
339
340#define MAX_NUM_AZ_BEAMS 500 /* num max di bam su una scans cic az*/
341 /* serveper allocare un'array (n_elev
342 acq corr , n_max beam in az ) */
343
344
345/* max num of prod comp in inp_e_rec ********************/
346
347#define INP_COMP_MAX_NUM 270
348
349
350
351/* inp prod type in norm_inp.c ********************/
352
353#define INP_SRT PROD_ID_SRT
354#define INP_ART PROD_ID_ART
355
356
357/* rain values from siap net meteo_station ***************/
358
359#define RAIN_VAL_NUM 6
360
361
362
363typedef
364 unsigned char T_MDB_rt_prod_name [8]; /* 1 campo rt prod header da 286 */
365
366
367typedef
368 unsigned char T_MDB_e_file_name[16];
369
370typedef
371 unsigned char T_MDB_d_file_name[16];
372
373typedef
374 struct
375 {
376 unsigned char c[12];
377 }T_MDB_s_file_name;
378
379typedef
380 struct
381 {
382 unsigned char c[16];
383
384 }T_MDB_file_name;
385
386typedef
387 unsigned char T_MDB_file_path[50];
388
389typedef
390 unsigned char T_MDB_date[18];
391
392
393typedef
394 int T_MDB_num_date;
395
396typedef
397 char T_MDB_sos_mark;/* separes sri-name-sets relative to
398 dillfernt time interval in
399 sri_set_file(output of the
400 sel_sri_function */
401
402typedef
403 char T_MDB_cds_annotation[21];
404typedef
405 char T_MDB_annotation[52];
406
407/* used by get_name (output) and delete_data_file as input************/
408/* list of data files associated to one idx_rec */
409
410typedef struct
411{
412 unsigned int n_comp;
413 T_MDB_d_file_name name[MULTI_FILE_MAX_NUM];
414 T_MDB_d_file_name idx_name[MULTI_FILE_MAX_NUM];
415} T_MDB_name_des;
416
417/* makes up a_set file from cds */
418typedef struct
419{
420 int x1;
421 int y1;
422 int x2;
423 int y2;
424
425}T_MDB_a_set_rec;
426
427typedef
428 char T_MDB_cds_file[A_SET_NUM * sizeof(T_MDB_a_set_rec)];
429
430 /*---------------------------------*
431 * EXTERNAL DATA TYPES *
432 *---------------------------------*/
433
434 /**********************************/
435 /* Descrizione file indice e dati */
436 /**********************************/
437
438
439/***********************************************/
440/* index file descriptors */
441/***********************************************/
442/* link :4 int */
443typedef struct
444{
445 T_MDB_num_date cre_date;
446 unsigned int d_file_size;
447
448 unsigned int busy_flag:1;
449 unsigned int keep_flag:1;
450 unsigned int sys_keep_flag:1;
451 unsigned int backup_flag:1;
452 unsigned int exp_flag:1;
453 unsigned int extr_type:2; /* 0: real time, 1: no */
454
455 unsigned int del_status:2; /*
456 0: deleted
457 1: unlinked;
458 2: linked;
459 */
460 unsigned int prod_type:7;
461 /* 0.. 128 */
462
463 unsigned int qualif:4;
464 /*
465 1: Z
466 2: Zdr
467 4: V
468 8 sV per cappi
469 */
470 /* per DBP grand presenti
471 1: Z
472 2: Zdr
473 4: V
474 8 sV
475 */
476
477 /*
478 0: automatica, 1: progra per SRT/ART
479 */
480
481 unsigned int type_compression:2;
482
483 /* 0: non compresso
484 1: compressione 1
485 2: compressione 2
486 3: compressione 3
487 */
488
489 unsigned int counter:10;
490
491 unsigned int radar:7;
492
493} T_MDB_link_compr;
494
495/* derivabili: multifile, acq dependent, integrato, utente, mappa, prodotto */
496typedef
497 struct
498 {
499 T_MDB_num_date cre_date;
500 unsigned int d_file_size;
501 unsigned int rec_offset;
502
503 unsigned short counter;
504
505 unsigned char prod_type;
506 unsigned char prod_class; /*
507 0 map acq
508 1 pro acq
509 2 pro_ut maq
510 3 map Int
511 4 pro int der
512 5 pro
513 */
514 unsigned char qualif;
515 unsigned char type_compression;
516 unsigned char extr_type;
517 unsigned char radar; /* 0 SPC */
518 } T_MDB_general;
519
520
521typedef struct
522 {
523 unsigned int scans_type:2;
524 /*
525 0: oraria
526 1: antioraria
527 2: sett azimutale
528 3: sett verticale
529 */
530 unsigned int rot_vel:5;
531 /* 0..30 g/s step 1*/
532
533 unsigned int grand:4;
534 /*
535 1: Z
536 2: Zdr = dual polarization
537 4: V
538 8: sV
539 */
540
541 unsigned int resolution:3;
542 /*
543 0: 62.5
544 1: 125
545 2: 250
546 3: 500
547 4: 1000
548 5: 2000 metri
549 */
550 unsigned int vel_range:1;
551 /*
552 0: 16.5= no prf2
553 1: 49 = si prf2
554 */
555
556 unsigned int declutter_rsp:1;
557 /* 0: no 1: si */
558
559 unsigned int type_declutter:1;
560 /* 0: uniforme 1: mappato */
561 unsigned int filter_value:4;
562 /* codice 0..15 */
563 unsigned int corr_Z:1;
564 /* 0: no 1: si */
565 unsigned int num_imp:10;
566 /* 0..1023 */
567/* int */
568
569 unsigned int declutter_sw:3;
570 /* 0: no,
571 1..3: declutter 1..3
572 */
573 unsigned int quota_cut_sw:5;
574
575 unsigned int el_ini:12;
576 /* 0..4095 */
577 unsigned int el_fin:12;
578 /* 0..4095 */
579/* int */
580 unsigned int imp_duration:2;
581 /*
582 0: lunga= 3. micros = 300 prf
583 1: media= 1.5 micros = 600 prf
584 2: corta= 0.5 micros = 1200 prf
585 */
586 unsigned int coverage:3;
587 /*
588 0: 16 km
589 1: 32
590 2: 64
591 3: 128
592 4: 256
593 5: 512
594 */
595
596 unsigned int acq_count:10;
597 unsigned int acq_duration:10; /* sec *8 */
598 unsigned int prec_z:7;
599/* int 3 */
600 unsigned int num_el:8; /* 0..256 */
601 /*
602 unsigned int az_step:4;
603 unsigned int el_step:4;
604 */
605 unsigned int az_ini:12; /* 0..4095 */
606 unsigned int az_fin:12; /* 0..4095 */
607
608 unsigned int acq_date;
609
610 } T_MAQ_compr;
611/*
612dati derivabili:
613 copertura effettiva = min(f(durata_impulso,velocita),copertura richiesta)
614 precisione=f(numero_impulsi,risoluzione,velocita)
615*/
616
617typedef struct
618 {
619 int acq_date;
620
621 unsigned short num_el;
622 unsigned short num_az;
623
624 unsigned short coverage;
625 unsigned short num_imp;
626
627 unsigned short az_ini;
628 unsigned short az_fin;
629
630 unsigned short el_ini;
631 unsigned short el_fin;
632
633 unsigned short acq_duration; /* Tempo di esecuzione rat */
634 unsigned short acq_count;
635
636 unsigned short value[30]; /* valori per scans. sett. 0->4095 */
637
638
639 unsigned char grand;
640 unsigned char declutter_rsp;
641 unsigned char type_declutter;
642 unsigned char filter_value;
643
644 unsigned char corr_Z;
645 unsigned char declutter_sw;
646 unsigned char quota_cut_sw;
647 unsigned char imp_duration;
648
649 unsigned char resolution;
650 unsigned char rot_vel;
651 unsigned char az_step;
652 unsigned char el_step;
653
654 unsigned char scans_type;
655 unsigned char vel_range;
656 unsigned char dual;
657 unsigned char spare[1];
658
659 unsigned char prec[4]; /* precisioni*/
660 }T_MAQ;
661
662
663/* MAP : 4 int */
664typedef struct
665 {
666 unsigned int alt_azim:12; /* 0..4095
667 0.0879121 gradi
668 62.5 metri
669 */
670
671 unsigned int quadr:3; /* 0:pieno,
672 1,2,3,4
673 */
674
675 unsigned int type_map:1; /* 0: numerica
676 1: raster
677 */
678
679 unsigned int gray_level:2; /* 0: 256
680 1: 16
681 */
682 unsigned int num_pix_x:14;
683
684 unsigned short num_pix_y;
685 unsigned short num_pix_z;
686
687 unsigned char latitude[3];
688 unsigned char intitude[3];
689
690 unsigned short map_x_resolution;
691 unsigned short map_y_resolution;
692 unsigned short map_z_resolution;
693
694 }T_MDB_map_info_compr;
695
696#define T_MDB_base_compr T_MDB_map_info_compr
697typedef struct
698 {
699 unsigned int map_x_resolution;
700 unsigned int map_y_resolution;
701 unsigned int map_z_resolution;
702
703 unsigned short quadr; /* TOTAL per immagini raster */
704 unsigned short alt_azim;
705
706 unsigned short type_map;
707 unsigned short gray_level;
708
709 unsigned short num_pix_x;
710 unsigned short num_pix_y;
711
712 unsigned short num_pix_z;
713 unsigned short az_ini;
714
715 unsigned short az_fin;
716 unsigned short az_ini2;
717
718 unsigned short az_fin2;
719
720 unsigned char latitude[3];
721 unsigned char longitude[3];
722
723
724 }T_MDB_map_info;
725
726#define T_MDB_base T_MDB_map_info;
727
728
729typedef
730 struct
731 {
732 unsigned int end_intgr;
733 unsigned short start_az,
734 end_az;
735 unsigned short int_intgr;
736 unsigned short minuti_integrati;
737 }T_MDB_map_int;
738
739typedef
740 struct
741 {
742 unsigned int end_intgr;
743 unsigned short int_intgr;
744 unsigned short spare;
745 } T_MDB_pro_int;
746
747/* Mappe standard dipendenti dall'acquisizione : cappi, sri, vmi etc */
748typedef
749 struct{
750 T_MAQ_compr maq;
751 T_MDB_map_info_compr map;
752 }T_MDB_map_acq_e_rec;
753
754#define T_MDB_rtp_e_rec T_MDB_map_acq_e_rec
755#define T_MDB_sep_e_rec T_MDB_map_acq_e_rec
756
757/* Prodotto standard dipendente dall'acquisizione: DBP ,Declutter_sw */
758typedef
759 struct
760 {
761 T_MAQ_compr maq;
762 T_MDB_s_file_name s_file;
763 }T_MDB_pro_acq_e_rec;
764
765#define T_MDB_dbp_e_rec T_MDB_pro_acq_e_rec
766#define T_MDB_clu_e_rec T_MDB_pro_acq_e_rec
767
768/* Prodotto utente dipendente da modalita' acquisizione: RAT, MAQ , */
769typedef
770 struct
771 {
772 T_MAQ_compr maq;
773 T_MDB_file_name file;
774 }T_MDB_pro_ut_maq_e_rec;
775
776#define T_MDB_rat_e_rec T_MDB_pro_ut_maq_e_rec
777#define T_MDB_maq_e_rec T_MDB_pro_ut_maq_e_rec
778
779/* Mappe standard integ nel tempo : SRT */
780typedef
781 struct{
782 T_MDB_map_int int_inf;
783 T_MDB_map_info_compr map;
784 }T_MDB_map_int_e_rec;
785
786#define T_MDB_srt_e_rec T_MDB_map_int_e_rec
787
788/* Prodotto integr tempo e dipendente da descrittore : ART */
789
790typedef
791 struct
792 {
793 T_MDB_pro_int int_inf;
794 T_MDB_file_name file_dip;
795 }T_MDB_pro_int_dip_e_rec;
796
797#define T_MDB_art_e_rec T_MDB_pro_int_dip_e_rec
798
799
800/* Prodotto standard indipendente dall'acquisizione: SENSORI , areole */
801/* Prodotto utente indipendente dall'acquisizione: SAT */
802typedef
803 struct
804 {
805 T_MDB_file_name file;
806 }T_MDB_pro_ut_e_rec;
807
808typedef
809 struct
810 {
811 T_MDB_link_compr link;
812 union
813 {
814 T_MDB_map_acq_e_rec map_acq;
815 T_MDB_pro_acq_e_rec pro_acq;
816 T_MDB_pro_ut_maq_e_rec pro_ut_maq;
817 T_MDB_map_int_e_rec map_int;
818 T_MDB_pro_int_dip_e_rec pro_int_dip;
819 T_MDB_pro_ut_e_rec pro;
820 }prod;
821 }T_MDB_idx_info;
822
823typedef struct
824{
825 unsigned int next;
826 unsigned int prev;
827} T_MDB_idx_rec_head;
828
829/* record del file indice */
830typedef struct
831 {
832 T_MDB_idx_rec_head head;
833 T_MDB_idx_info info;
834 } T_MDB_idx_rec;
835
836/************************/
837/* Struttura index file */
838/************************/
839
840typedef struct
841{
842 unsigned int avail_start;
843 unsigned int avail_end;
844 unsigned int free_start;
845 unsigned int free_end;
846
847 unsigned int e_rec_num;
848 unsigned int tot_d_space;
849 unsigned int av_d_space;
850 unsigned int acq_count;
851
852}T_MDB_idx_file_header;
853
854typedef
855 struct
856 {
857 T_MDB_name_des names;
858 char spare[4-sizeof(T_MDB_name_des)%4];
859
860 T_MDB_general general;
861 char spare1[4-sizeof(T_MDB_general)%4];
862
863 T_MAQ maq;
864 char spare2[4-sizeof(T_MAQ)%4];
865
866 T_MDB_map_info map;
867/* char spare3[4-sizeof(T_MDB_map_info)%4];*/
868
869 T_MDB_file_name file_dip;
870 char spare4[4-sizeof(T_MDB_file_name)%4];
871
872 T_MDB_map_int int_inf;
873 char spare5[4-sizeof(T_MDB_map_int)%4];
874
875 T_MDB_annotation annotation;
876 char spare6[4-sizeof(T_MDB_annotation)%4];
877 }T_MDB_norm_e_rec;
878
879/*DATA TYPES THAT MADE UP THE EXPANSION INFO AFTER THE DATA FILE HEADER */
880typedef
881 struct
882 {
883 T_MDB_d_file_name comp[INP_COMP_MAX_NUM];
884 char spare[INP_COMP_MAX_NUM];
885 char spare1[2];
886 }T_MDB_srt_exp_attr;
887
888typedef
889 struct
890 {
891 unsigned int inf[128];
892 }T_MDB_sri_exp_attr;
893
894typedef
895 struct
896 {
897 T_MDB_d_file_name comp[INP_COMP_MAX_NUM];
898 char spare[INP_COMP_MAX_NUM];
899 char spare1[2];
900 T_MDB_cds_file cds;/* is the cds selected areas where
901 art comes from*/
902 }T_MDB_art_exp_attr;
903
904
905#define STATUS_BIT_OFF 0
906#define STATUS_BIT_ON 1
907 /* Stati dei bit per il campo che definisce */
908 /* lo stato della classe: STATUS_mask */
909typedef struct {
910 unsigned int to_create : 1;
911 unsigned int to_destroy : 1;
912 unsigned int to_save : 1;
913 unsigned int to_load : 1;
914 unsigned int saved : 1;
915 unsigned int modified : 1;
916 unsigned int loaded : 1;
917 unsigned int cannot_encode : 1;
918 unsigned int to_encode : 1;
919 unsigned int to_not_decode : 1;
920 unsigned int to_append : 1;
921 unsigned int resize : 3;
922 unsigned int spare :18;
923} STATUS_mask;
924
925
926#define UNIX_CLASS 1
927#define VMS_CLASS 2
928#define MSDOS_CLASS 3
929 /* Costanti che definiscono l'ambiente dove e'*/
930 /* stata creata la classe o il file */
931
932typedef struct { /* Tale struttura definisce qualsiasi classe */
933 /* che risiede in memoria o in un file */
934 unsigned int pointer; /* Puntatore alla posizione della classe: */
935 /* indirizzo di memoria o offset sul file */
936 int space; /* Size in byte della memoria allocata per la */
937 /* classe */
938 int size; /* Size in byte della classe */
939 STATUS_mask status_mask;/* Stato della classe */
940 unsigned char type_compression;
941 /* Eventuale codice del tipo di compressio- */
942 /* ne applicato sulla classe */
943 unsigned char environ; /* Ambiente operativo dove e' stato creata la */
944 /* classe: */
945 /* UNIX_CLASS - VMS_CLASS - MSDOS_CLASS */
946 /* 2014-01-15 renamed from class to class_code to make it valid C++ */
947 unsigned char class_code; /* Codice della classe */
948 unsigned char index; /* Indice della componente nel file */
949} CLASS_pointer;
950
951
952typedef struct { /* CLASS_HEADER_CLASS */
953 unsigned char signature[9];
954 /* Firma di riconoscimento dell'header */
955 /* costante MDB_SIGN */
956 unsigned char environ; /* Ambiente operativo dove e' stato creato il */
957 /* file: */
958 /* UNIX_CLASS - VMS_CLASS - MSDOS_CLASS */
959 unsigned short max_comp;/* MAX_COMP */
960 unsigned short max_class_type;
961 /* MAX_CLASS_TYPE */
962 unsigned short n_comp; /* Maggiore indice delle componenti contenute */
963 /* nel file */
964 CLASS_pointer compDesc[MAX_COMP+1];
965} CLASS_header;
966
967
968
969typedef
970 struct
971 {
972 CLASS_header class_header;
973 T_MDB_norm_e_rec norm;
974 }T_MDB_data_header;
975
976#define T_MDB_acq_header T_MDB_data_header
977
978
979/*-------------------------------------------------------------*/
980/***** strutture dati che arrivano dal 286; linea dati rt ******/
981/*-------------------------------------------------------------*/
982
983/* header dei dati polari estratti dal 286 */
984
985typedef struct
986 {
987 short coverage;
988 char grand;
989 char vel_range;
990 char resolution;
991 char precision[4];
992 char date[17];
993 short prf;
994 char prf2;
995 char imp_duration;
996 char dual_pol;
997 char rot_vel;
998 short acq_duration;
999 short num_az;
1000 short num_el;
1001 short start_az;
1002 short end_az;
1003 short start_el;
1004 short end_el;
1005 char scans_type;
1006 char declutter_rsp;
1007 char corr_z;
1008 char filter_value;
1009 char num_prod;
1010 char declutter_sw;
1011 char el_list[EL_MAX_NUM];
1012 char az_step;
1013 char el_step;
1014 }T_MDB_286_acq_header;
1015
1016
1017/* header dei prodotti estratti dal 286 */
1018typedef struct
1019{
1020 char prod_type[8]; /* */
1021 char resolution; /* */
1022 char dimension; /* */
1023 short altitude; /* */
1024 char ref_plane; /* 1:xz, 2: yz, 3:xy, 4:z */
1025 char extr_type; /* */
1026 short coverage; /* Km */
1027}T_MDB_286_pro_header;
1028
1029 /*--------------------------------------*
1030 * HEADER dei beam 286 *
1031 *---------------------------------------*/
1032
1033typedef struct
1034 {
1035 short teta; /* 0..184 */
1036 short alfa; /* 0..399 */
1037 short tipo_gran;
1038 short max_bin;
1039
1040 }T_MDB_ap_beam_header;
1041
1042 /*-----------------------------------------------------------------*/
1043 /* Pacchetto informativo fornito dal produttore prodotti secondari */
1044 /*-----------------------------------------------------------------*/
1045
1046struct coord_descr
1047 {
1048 char spare;
1049 char gradi;
1050 char primi;
1051 char secondi;
1052};
1053typedef struct
1054{
1055 unsigned char prod_type;
1056 unsigned char quadr;
1057
1058 unsigned char extr_type;
1059 unsigned char type_compression;
1060 unsigned short gray_level;
1061
1062 unsigned short alt_azim; /* quota in metri o az 0:4095 */
1063 unsigned short num_pix_x;
1064 unsigned short num_pix_y;
1065 unsigned short num_pix_z;
1066
1067 float map_x_resolution;
1068 float map_y_resolution;
1069 float map_z_resolution;
1070
1071 struct coord_descr latitudine;
1072 struct coord_descr intitudine;
1073}T_MDB_sep_info;
1074
1075typedef struct
1076{
1077
1078 unsigned int newest_data;
1079 unsigned short int_intgr;
1080 unsigned short minuti_integrati;
1081}T_MDB_inp_info;
1082
1083 /*---------------------------------------------------------------*/
1084 /* Pacchetto informativo fornito dal produttore prodotti ART/SRT */
1085 /*---------------------------------------------------------------*/
1086/* used by auto_srt /man_srt producer */
1087
1088typedef struct {
1089 unsigned int d_file_size;
1090 unsigned int intgr_start_time;
1091 unsigned int intgr_end_time;
1092 unsigned int intgr_int;
1093 unsigned int coverage;
1094 float resolution;
1095 char calc_mode;
1096 char prod_type;
1097 }T_MDB_inp_header;
1098
1099
1100 /*---------------------------------*/
1101 /* dbp_index file record */
1102 /*---------------------------------*/
1103
1104typedef struct
1105 {
1106 int offset;
1107 int beam_size;
1108
1109 }T_MDB_dbp_idx_info;
1110typedef
1111 T_MDB_dbp_idx_info *T_MDB_idx_array[4];
1112
1113 /* array di puntatori ad array record idx_info */
1114 /* dim = num grandezze */
1115 /*---------------------------------*
1116 * for each couple (sep, dbp_acq_num)
1117 * rhe array gives the last post
1118 * elaboration counter value; used
1119 * to create sep data file name.
1120 *---------------------------------*/
1121
1122
1123
1124/**** defines components file name for int prod man_srt and art ***/
1125
1126typedef T_MDB_d_file_name T_MDB_comp_selection[COMP_MAX_NUM];
1127
1128
1129/* used by get_name (output) and delete_data_file as input************/
1130/* list of data files associated to one idx_rec */
1131
1132
1133
1134
1135
1136
1137/* used to store areas selection from cds , to calculate art integr prod*/
1138typedef struct
1139{
1140 T_MDB_link_compr link;
1141
1142}T_MDB_cds_e_rec ;
1143
1144
1145
1146
1147
1148typedef unsigned char T_MDB_data_rec [ DATA_REC_SIZE];
1149
1150
1151
1152
1153 /*---------------------------------*
1154 * FIND tipes defs *
1155 *---------------------------------*/
1156
1157
1158typedef struct
1159{
1160
1161 unsigned char prod_name[5];
1162 unsigned char num_char_to_comp;
1163} T_MDB_prod_id;
1164
1165
1166 /*---------------------------------*
1167 * SEL_SRI type defs (for auto_srt)*
1168 *---------------------------------*/
1169
1170
1171/* sri selection criteria in sel_sri.c */
1172typedef struct
1173{
1174 char sri_acq_type;
1175 short integration_int;
1176 short start_az;
1177 short end_az;
1178
1179} T_MDB_sri_selection;
1180
1181
1182typedef struct /* tells how to write next sel_rec in update_sri_file proc*/
1183{
1184 int p_in;
1185} T_MDB_sri_set_file_header;
1186
1187
1188
1189
1190/* info returned from search in db by sel_sri.c */
1191typedef struct
1192{
1193 short tot_sri_db_num;
1194 short ok_sri_num;
1195 short ok_sri_sat_num;
1196
1197} T_MDB_sri_search_info;
1198
1199
1200
1201typedef struct
1202{
1203 T_MDB_d_file_name sri_name;
1204 unsigned short coverage;
1205 T_MDB_num_date time;
1206 float temp_coeff; /* for srt calc*/
1207} T_MDB_sri_sel_data;
1208
1209
1210
1211/*** used by a-set_list routinre to reteunn a_set name list in meteo_db */
1212typedef struct
1213{
1214 T_MDB_d_file_name name[A_SET_MAX_NUM];
1215 int name_num;
1216} T_MDB_a_set_list ;
1217
1218
1219/* makes up a meteo station file in SEN branch of meteo_db */
1220typedef struct
1221{
1222 T_MDB_num_date acq_time;
1223 short amr;
1224 short rain_value[RAIN_VAL_NUM];
1225} T_MDB_siap_sen_rec;
1226
1227/* defines data code to select data in siap rec buffer */
1228typedef unsigned char T_MDB_sen_data_selection [RAIN_VAL_NUM];
1229
1230
1231
1232
1233
1234/* used in sen data part of meteo_db */
1235typedef struct
1236{
1237 int p_in;
1238 int p_out;
1239 int p_end;
1240 int p_start;
1241 unsigned int e_rec_size;
1242 unsigned int e_rec_num;
1243 unsigned int tot_d_space;
1244 unsigned int av_d_space;
1245 unsigned int acq_count;
1246}T_MDB_ms_file_header;
1247
1248/* parte informazioni del record del file indice
1249/typedef struct
1250/{
1251/ T_MDB_e_link link;
1252/ union {
1253/ T_MDB_sep_e_rec sep;
1254/ T_MDB_rtp_e_rec rtp;
1255/ T_MDB_dbp_e_rec dbp;
1256/ T_MDB_art_e_rec art;
1257/ T_MDB_srt_e_rec srt;
1258/ T_MDB_rat_e_rec rat;
1259/ }prod_type;
1260/
1261/} T_MDB_idx_info;
1262*/
1263
1264typedef struct
1265{
1266 int data_fd[MULTI_FILE_MAX_NUM];
1267 int idx_fd[MULTI_FILE_MAX_NUM];
1268 int num_fd;
1269
1270 int mode;
1271 T_MDB_data_header *head;
1272 T_MDB_e_set_name e_type;
1273 unsigned int comp_read_off[MULTI_COMP_MAX_NUM];
1274 unsigned int comp_off[MULTI_COMP_MAX_NUM];
1275
1276}T_MDB_channel;
1277
1278typedef struct
1279{
1280 int num_fd;
1281 int data_fd[MULTI_FILE_MAX_NUM];
1282 int idx_fd[MULTI_FILE_MAX_NUM];
1283
1284}T_MDB_multi_fd;
1285
1286/****************************************************************/
1287/* FIND */
1288/****************************************************************/
1289
1290#define MAX_QUERY 10L
1291
1292#define SUCCESS 1L
1293#define FAIL 0L
1294
1295#define NO_ORD 0L
1296#define ACQ_OLDEST 1L
1297#define ACQ_NEWEST 2L
1298#define CRE_OLDEST 4L
1299#define CRE_NEWEST 8L
1300
1301
1302#define NO_TEST 0L
1303#define TEST_EQ 1L
1304#define TEST_NEQ 2L
1305#define TEST_GT 3L
1306#define TEST_GE 4L
1307#define TEST_LT 5L
1308#define TEST_LE 6L
1309#define TEST_LT_GT 7L
1310#define TEST_LT_GE 8L
1311#define TEST_LE_GT 9L
1312#define TEST_LE_GE 10L
1313#define TEST_GT_LT 11L
1314#define TEST_GT_LE 12L
1315#define TEST_GE_LT 13L
1316#define TEST_GE_LE 14L
1317
1318
1319#define PROD_NIL '\0'
1320#define QUADR_NIL '\0'
1321#define FILE_NIL '\0'
1322#define QUOTA_NIL -1
1323#define AZ_NIL -1
1324#define INT_NIL -1
1325#define DATE_NIL 0
1326
1327typedef
1328 struct
1329 {
1330 char prod[12+1]; /*nome ascii del prodotto */
1331 /* vuoto non significativo */
1332
1333 char quadr[8+1]; /* quadrante */
1334 /* vuoto non significativo */
1335
1336 char file[14+1]; /* sens, file ART, etc)*/
1337 /* vuoto non significativo */
1338
1339 float quota; /* -4giga non significativo */
1340
1341 float azimuth; /* -4giga non significativo */
1342
1343 float int_azimuth[2]; /* -4giga non significativo */
1344
1345 int int_intgr; /* -4giga non significativo */
1346
1347 int extr_type; /* -4giga non significativo */
1348
1349 int cre_date; /* 0 non significativo */
1350
1351 int x_copertura ;
1352
1353 int z_copertura ;
1354
1355 int map_x_resolution ;
1356
1357 int map_z_resolution ;
1358
1359 int type_map ;
1360
1361 int gray_level ;
1362
1363 char latitude[4];
1364 char intitude[4];
1365
1366 int acq_date; /* 0 non significativo */
1367
1368 }T_MDB_find_rec;
1369
1370typedef
1371 struct
1372 {
1373 int prod_match ; /* EQ - NEQ */
1374 char prod[12+1] ; /*nome ascii del prodotto */
1375 /*se blank no query*/
1376
1377 int quadr_match ; /* EQ - NEQ */
1378 char quadr[8+1] ; /* quadrante "ALL","HL",HR,LL,LR */
1379 /*se blank no query*/
1380
1381 int file_match ; /* EQ - NEQ */
1382 char file[14+1] ; /* wildchar (sens, file ART, etc)*/
1383 /*se blank no query*/
1384
1385 int quota_match ; /* = > < inta est */
1386
1387 float quota[2] ; /* intervallo quote */
1388
1389 int azimuth_match ; /* = > < inta est */
1390
1391 float azimuth[2] ; /* intervallo azimut */
1392
1393 int int_azimuth_match ; /* = > < inta est */
1394
1395 float int_azimuth[2] ; /* intervallo azimut */
1396
1397 int extr_type_match ; /* EQ -NEQ */
1398 int extr_type ;
1399
1400 int integ_match ; /* = > < inta est */
1401 int int_intgr[2] ;
1402
1403 int creat_match ; /* = > < inta est */
1404 int cre_date[2] ; /* intervallo data creazione */
1405
1406 int acq_match ; /* = > < inta est */
1407 int acq_date[2] ; /* intervallo data acquisizione */
1408
1409 int x_copertura_match ;
1410 int x_copertura[2] ;
1411
1412 int z_copertura_match ;
1413 int z_copertura[2] ;
1414
1415 int map_x_resolution_match;
1416 int map_x_resolution;
1417
1418 int map_z_resolution_match ;
1419 int map_z_resolution ;
1420
1421 int type_map_match ;
1422 int type_map ;
1423
1424 int gray_level_match ;
1425 int gray_level ;
1426
1427 int coord_match ;
1428 char latitude[4];
1429 char intitude[4];
1430
1431 int ord_match ;
1432 int ord_flag ;
1433 int ord_time ;
1434
1435
1436 }T_MDB_find_match_rec;
1437
1438#endif