coffee
Coronagraph Optimization For Fast Exoplanet Exploration
ImageStruct.h
Go to the documentation of this file.
1 
21 #ifndef _IMAGESTRUCT_H
22 #define _IMAGESTRUCT_H
23 
24 #include <stdint.h>
25 #include <stdio.h>
26 #include <unistd.h>
27 #include <stdlib.h>
28 #include <sys/types.h>
29 #include <unistd.h>
30 #include <semaphore.h>
31 
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 
39 // comment this line if data should not be packed
40 // packing data should be use with extreme care, so it is recommended to disable this feature
41 //#define DATA_PACKED
42 
43 #define SHAREDMEMDIR "/tmp"
45 #define SEMAPHORE_MAXVAL 10
55 // Data types are defined as machine-independent types for portability
56 
57 #define _DATATYPE_UINT8 1
58 #define SIZEOF_DATATYPE_UINT8 1
59 
60 #define _DATATYPE_INT8 2
61 #define SIZEOF_DATATYPE_INT8 1
62 
63 #define _DATATYPE_UINT16 3
64 #define SIZEOF_DATATYPE_UINT16 2
65 
66 #define _DATATYPE_INT16 4
67 #define SIZEOF_DATATYPE_INT16 2
68 
69 #define _DATATYPE_UINT32 5
70 #define SIZEOF_DATATYPE_UINT32 4
71 
72 #define _DATATYPE_INT32 6
73 #define SIZEOF_DATATYPE_INT32 4
74 
75 #define _DATATYPE_UINT64 7
76 #define SIZEOF_DATATYPE_UINT64 8
77 
78 #define _DATATYPE_INT64 8
79 #define SIZEOF_DATATYPE_INT64 8
80 
81 #define _DATATYPE_FLOAT 9
82 #define SIZEOF_DATATYPE_FLOAT 4
83 
84 #define _DATATYPE_DOUBLE 10
85 #define SIZEOF_DATATYPE_DOUBLE 8
86 
87 #define _DATATYPE_COMPLEX_FLOAT 11
88 #define SIZEOF_DATATYPE_COMPLEX_FLOAT 8
89 
90 #define _DATATYPE_COMPLEX_DOUBLE 12
91 #define SIZEOF_DATATYPE_COMPLEX_DOUBLE 16
92 
93 #define _DATATYPE_EVENT_UI8_UI8_UI16_UI8 20
94 #define SIZEOF_DATATYPE_EVENT_UI8_UI8_UI16_UI8 5
95 
96 
97 
98 
99 #define Dtype 9
100 #define CDtype 11
111 typedef struct
112 {
113  char name[16];
114  char type;
116  union {
117  int64_t numl;
118  double numf;
119  char valstr[16];
120  } value;
121 
122  char comment[80];
123 #ifdef DATA_PACKED
124 } __attribute__ ((__packed__)) IMAGE_KEYWORD;
125 #else
127 #endif
128 
129 
130 
131 
136 typedef struct
137 {
138  int64_t firstlong;
139  int64_t secondlong;
140 } TIMESPECFIXED;
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 typedef struct
161 {
162  float re;
163  float im;
164 } complex_float;
165 
166 
167 typedef struct
168 {
169  double re;
170  double im;
172 
173 
174 
175 
207 typedef struct
208 {
209  uint8_t xpix;
210 
211  uint8_t ypix;
212 
217  uint16_t dtus;
218 
219  uint8_t lambda_index;
220 #ifdef DATA_PACKED
221 } __attribute__ ((__packed__)) EVENT_UI8_UI8_UI16_UI8;
222 #else
224 #endif
225 
226 
227 
228 
229 
230 
231 
232 
241 typedef struct
242 {
244  char name[80];
245 
246  // mem offset = 80 when packed
247 
252  uint8_t naxis;
253 
254  // mem offset = 81 when packed
255 
260  uint32_t size[3];
261 
262  // mem offset = 93 when packed
263 
268  uint64_t nelement;
269 
270  // mem offset = 101 when packed
271 
289  uint8_t atype;
290 
291  // mem offset = 102 when packed
292 
293  double creation_time;
294  double last_access;
296  // mem offset = 118 when packed
297 
314  union
315  {
316  struct timespec ts;
317  TIMESPECFIXED tsfixed;
318  } atime;
319 
320  // mem offset = 134 when packed
321 
322 
323  uint8_t shared;
324  uint8_t status;
326  // mem offset = 136 when packed
327 
328  uint8_t logflag;
329  uint16_t sem;
332  // mem offset = 139 when packed
333 
334  uint64_t : 0; // align array to 8-byte boundary for speed -> pushed mem offset to 144 when packed
335 
336  uint64_t cnt0;
337  uint64_t cnt1;
338  uint64_t cnt2;
340  uint8_t write;
342  uint16_t NBkw;
344  // total size is 171 byte = 1368 bit when packed
345 
346 #ifdef DATA_PACKED
347 } __attribute__ ((__packed__)) IMAGE_METADATA;
348 #else
350 #endif
351 
352 
353 
354 
355 
356 
365 typedef struct
366 {
367  char name[80];
368  // mem offset = 80
369 
370 
379  uint8_t used;
380  // mem offset = 81
381 
382  int32_t shmfd;
383  // mem offset = 85
384 
385  uint64_t memsize;
386  // mem offset = 93
387 
388  sem_t *semlog;
389  // mem offset = 101
390 
391  IMAGE_METADATA *md;
392  // mem offset = 109
393 
394 
395  uint64_t : 0; // align array to 8-byte boundary for speed
396  // mem offset pushed to 112
397 
410  union
411  {
412  uint8_t *UI8; // char
413  int8_t *SI8;
414 
415  uint16_t *UI16; // unsigned short
416  int16_t *SI16;
417 
418  uint32_t *UI32;
419  int32_t *SI32; // int
420 
421  uint64_t *UI64;
422  int64_t *SI64; // long
423 
424  float *F;
425  double *D;
426 
427  complex_float *CF;
428  complex_double *CD;
429 
430  EVENT_UI8_UI8_UI16_UI8 *event1121;
431  } array;
432  // mem offset 120
433 
434  sem_t **semptr;
435  // mem offset 128
436 
437  IMAGE_KEYWORD *kw;
438  // mem offset 136
439 
440  // total size is 136 byte = 1088 bit
441 #ifdef DATA_PACKED
442 } __attribute__ ((__packed__)) IMAGE;
443 #else
445 #endif
446 
447 
448 
449 #ifdef __cplusplus
450 } //extern "C"
451 #endif
452 
453 
454 #endif
void __attribute__((constructor)) libinit_00CORE()
Definition: 00CORE.c:87
IMAGE_METADATA
Definition: ImageStruct.h:337
structure holding two 8-byte integers
Definition: ImageStruct.h:136
Definition: ImageStruct.h:167
IMAGE_KEYWORD
Definition: ImageStruct.h:126
EVENT_UI8_UI8_UI16_UI8
Definition: ImageStruct.h:223
IMAGE
Definition: ImageStruct.h:432
Definition: ImageStruct.h:160