UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
segy_api.h
1 /* segy_api.h */
2 /* $Id: segy_api.h,v 1.2 2006/10/19 14:57:32 vlad Exp $ */
3 #ifndef __segy_api_h
4 #define __segy_api_h
5 
6 
7 #include <mix/ErrCodes.h>
8 #include <mix/trans.h>
9 #include <mix/segy_file.h>
10 
11 
13 struct segy_io_s;
14 typedef ErrCode (*segy_trans_th_proc)(struct segy_io_s* io,
15  SEGY_TraceHeader* buf);
16 
17 
18 /***********************************************************************
19  * Input/output of SEG-Y file is controlled by this structure:
20  ***********************************************************************/
21 typedef struct segy_io_s
22 {
23  char *fpath;
24  int fildes;
25  char omode;
26  char media;
27  TextEncoding text_hdr_enc;
28  ByteOrder bin_data_fmt;
29  int sample_fmt;
31  void *trace_buf;
32  unsigned trace_size;
34  /***************************************
35  * Input operation support (omode='r') *
36  ***************************************/
37  unsigned text_hdr_size;
38  unsigned bin_hdr_size;
39  unsigned trace_hdr_size;
40  unsigned file_size;
41  segy_trans_th_proc in_thdr;
42  segy_trans_th_proc out_thdr;
43 
44 } segy_io_t;
45 
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif /* __cplusplus */
50 
51 
53  ErrCode segy_init_io (segy_io_t* io);
54 
56  ErrCode segy_init_trace_buffer (segy_io_t* io,
57  const SEGY_BinaryHeader* hdr);
58 
60  ErrCode segy_close (segy_io_t* io);
61 
63  unsigned segy_sample_size (int sample_fmt);
64 
65 
66  /********************************
67  * Input operations (omode='r') *
68  ********************************/
69 
72  ErrCode segy_open_file_read (segy_io_t* io,
73  const char* szFilePath);
74 
77  ErrCode segy_read_reel_text_hdr (segy_io_t* io, char** psTextHdr);
78 
80  ErrCode segy_read_reel_bin_hdr (segy_io_t* io,
81  SEGY_BinaryHeader* hdr);
82 
84  ErrCode segy_read_trace (segy_io_t* io,
85  SEGY_TraceHeader* hdr, void* body);
86 
88  ErrCode segy_in_hdr (segy_io_t* io, SEGY_TraceHeader* hdr);
89 
91  ErrCode segy_in_hdr_vsp (segy_io_t* io, SEGY_TraceHeader* hdr);
92 
94  ErrCode segy_in_body (segy_io_t* io, void* buf);
95 
96 
97  /*********************************
98  * Output operations (omode='w') *
99  *********************************/
100 
102  ErrCode segy_open_file_write (segy_io_t* io,
103  const char* szFilePath);
104 
106  ErrCode segy_write_reel_text_hdr (segy_io_t* io,
107  const char* sTextHdr);
108 
110  ErrCode segy_write_reel_bin_hdr (segy_io_t* io,
111  const SEGY_BinaryHeader* hdr);
112 
114  ErrCode segy_append_trace (segy_io_t* io,
115  const SEGY_TraceHeader* hdr,
116  Real4* body, int nsamples);
117 
119  ErrCode segy_out_hdr (segy_io_t* io, SEGY_TraceHeader* hdr);
120 
122  ErrCode segy_out_hdr_vsp (segy_io_t* io, SEGY_TraceHeader* hdr);
123 
125  ErrCode segy_out_body (segy_io_t* io, Real4* buf,
126  const Real4* body, int nsamples);
127 
128 
129  /******************************
130  * ASCII supposed operations *
131  ******************************/
132 
134  ErrCode segy_eh_template (char* sTextHdr);
135 
137  ErrCode segy_eh_put_integer (char* sTextHdr,
138  int offset,
139  int value);
140 
142  ErrCode segy_eh_put_text (char* sTextHdr,
143  int offset,
144  const char* value);
145 
147  ErrCode segy_eh_put_log (const char* sTextHdr);
148 
150  ErrCode segy_bh_put_log (const SEGY_BinaryHeader* hdr,
151  Logic bImportant);
152 
155  ErrCode segy_th_put_log (const SEGY_TraceHeader* hdr,
156  Logic bImportant, Logic bVSP, Logic bNumbers);
157 
160  int segy_th_value_by_number (const void* hdr,
161  int th_number,
162  AtomType* atype);
163 
166  char* segy_th_word_name (int th_number);
167 
168 
169 #ifdef __cplusplus
170 };
171 #endif /* __cplusplus */
172 
173 #endif /* segy_api.h */
unsigned trace_hdr_size
Definition: segy_api.h:39
unsigned trace_size
Definition: segy_api.h:32
Definition: segy_api.h:21
TextEncoding text_hdr_enc
Definition: segy_api.h:27
ByteOrder bin_data_fmt
Definition: segy_api.h:28
void * trace_buf
Definition: segy_api.h:31
unsigned file_size
Definition: segy_api.h:40
unsigned bin_hdr_size
Definition: segy_api.h:38
char * fpath
Definition: segy_api.h:23
int sample_size
Definition: segy_api.h:30
unsigned text_hdr_size
Definition: segy_api.h:37
char omode
Definition: segy_api.h:25
char media
Definition: segy_api.h:26
int fildes
Definition: segy_api.h:24
Definition: segy_file.h:452
int sample_fmt
Definition: segy_api.h:29
segy_trans_th_proc in_thdr
Definition: segy_api.h:41
Definition: segy_file.h:363