12#error This is a C++ include file and cannot be used from plain C
27#define ngcdttPUBLISH_MAXBUF 8
74 if (frame_.memPtr != NULL)
76 free(frame_.memPtr); frame_.memPtr = NULL;
127 if (frame_.memPtr == NULL)
129 frame_.memPtr = (
char *)malloc(size);
130 if (frame_.memPtr == NULL)
136 else if (size_ != size)
138 char *p = (
char *)realloc(frame_.memPtr, size);
155 memcpy(frame_.memPtr, f->
memPtr, size_);
200 if (frame_.memPtr == NULL)
202 frame_.memPtr = (
char *)malloc(size);
203 if (frame_.memPtr == NULL)
210 else if (size_ != size)
212 char *p = (
char *)realloc(frame_.memPtr, size);
236 frame_.hdr.nx = cube.
naxis1;
237 frame_.hdr.ny = cube.
naxis2;
243 frame_.hdr.bzero = (int)cube.
bzero;
274 int Stored() {
return ((frame_.memPtr != NULL));}
285 if ((f->
hdr.
nx != frame_.hdr.nx) || (f->
hdr.
ny != frame_.hdr.ny))
295 float *p1 = (
float *)(
void *)f->
memPtr;
298 float *p2 = (
float *)(
void *)frame_.memPtr;
306 int *p2 = (
int *)frame_.memPtr;
309 *p1++ -= (float)*p2++;
314 short *p2 = (
short *)frame_.memPtr;
315 float bz = (float)frame_.hdr.bzero;
318 *p1++ -= ((float)*p2++ + bz);
323 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
324 float bz = (float)frame_.hdr.bzero;
327 *p1++ -= ((float)*p2++ + bz);
337 int *p1 = (
int *)f->
memPtr;
340 int *p2 = (
int *)frame_.memPtr;
348 short *p2 = (
short *)frame_.memPtr;
351 *p1++ -= ((int)*p2++ + frame_.hdr.bzero);
356 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
359 *p1++ -= ((int)*p2++ + frame_.hdr.bzero);
369 double *p1 = (
double *)(
void *)f->
memPtr;
372 double *p2 = (
double *)(
void *)frame_.memPtr;
380 float *p2 = (
float *)(
void *)frame_.memPtr;
383 *p1++ -= (double)*p2++;
388 int *p2 = (
int *)frame_.memPtr;
391 *p1++ -= (double)*p2++;
396 short *p2 = (
short *)frame_.memPtr;
397 double bz = (double)frame_.hdr.bzero;
400 *p1++ -= ((double)*p2++ + bz);
405 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
406 double bz = (double)frame_.hdr.bzero;
409 *p1++ -= ((double)*p2++ + bz);
421 unsigned short *p11 = (
unsigned short *)f->
memPtr;
422 unsigned short *p12 = p11 + n;
423 int *p1 = (
int *)f->
memPtr;
424 short *p2 = (
short *)frame_.memPtr;
426 memcpy(p12, p11, n *
sizeof(
unsigned short));
429 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
435 unsigned short *p11 = (
unsigned short *)f->
memPtr;
436 unsigned short *p12 = p11 + n;
437 int *p1 = (
int *)f->
memPtr;
438 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
440 memcpy(p12, p11, n *
sizeof(
unsigned short));
443 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
456 short *p11 = (
short *)f->
memPtr;
457 short *p12 = p11 + n;
458 int *p1 = (
int *)f->
memPtr;
459 short *p2 = (
short *)frame_.memPtr;
461 memcpy(p12, p11, n *
sizeof(
short));
464 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
470 short *p11 = (
short *)f->
memPtr;
471 short *p12 = p11 + n;
472 int *p1 = (
int *)f->
memPtr;
473 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
475 memcpy(p12, p11, n *
sizeof(
short));
478 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
534 float *p1 = (
float *)(
void *)f->
memPtr;
537 float *p2 = (
float *)(
void *)frame_.memPtr;
545 int *p2 = (
int *)frame_.memPtr;
548 *p1++ += (float)*p2++;
553 short *p2 = (
short *)frame_.memPtr;
554 float bz = (float)frame_.hdr.bzero;
557 *p1++ += (float)*p2++ + bz;
562 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
563 float bz = (float)frame_.hdr.bzero;
566 *p1++ += (float)*p2++ + bz;
582 short *p1 = (
short *)f->
memPtr;
583 short *p2 = (
short *)frame_.memPtr;
584 int *p11 = (
int *)f->
memPtr;
587 *p1++ = (short)(*p11++ + *p2++ + frame_.hdr.bzero);
592 unsigned short *p1 = (
unsigned short *)f->
memPtr;
593 short *p2 = (
short *)frame_.memPtr;
594 int *p11 = (
int *)f->
memPtr;
597 *p1++ = (
unsigned short)(*p11++ + *p2++ + frame_.hdr.bzero);
610 short *p1 = (
short *)f->
memPtr;
611 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
612 int *p11 = (
int *)f->
memPtr;
615 *p1++ = (short)(*p11++ + *p2++ + frame_.hdr.bzero);
620 unsigned short *p1 = (
unsigned short *)f->
memPtr;
621 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
622 int *p11 = (
int *)f->
memPtr;
625 *p1++ = (
unsigned short)(*p11++ + *p2++ + frame_.hdr.bzero);
641 int *p1 = (
int *)f->
memPtr;
644 int *p2 = (
int *)frame_.memPtr;
652 short *p2 = (
short *)frame_.memPtr;
655 *p1++ += (int)*p2++ + frame_.hdr.bzero;
660 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
663 *p1++ += (int)*p2++ + frame_.hdr.bzero;
674 double *p1 = (
double *)(
void *)f->
memPtr;
677 double *p2 = (
double *)(
void *)frame_.memPtr;
685 float *p2 = (
float *)(
void *)frame_.memPtr;
688 *p1++ += (double)*p2++;
693 int *p2 = (
int *)frame_.memPtr;
696 *p1++ += (double)*p2++;
701 short *p2 = (
short *)frame_.memPtr;
702 double bz = (double)frame_.hdr.bzero;
705 *p1++ += (double)*p2++ + bz;
710 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
711 double bz = (double)frame_.hdr.bzero;
714 *p1++ += (double)*p2++ + bz;
800 virtual int Configure(
const char *name,
int nx,
int ny);
812 virtual int Locked(
int idx);
815 virtual int Lock(
int idx);
821 virtual int Unlock(
int idx);
824 virtual int Wait(
int idx);
833 void Type(
const char *name);
int Store(const char *fileName)
Store FITS-frame.
Definition ngcdttPUBLISH.hpp:161
int Store(ngcdtt_frame_t *f)
Store given frame.
Definition ngcdttPUBLISH.hpp:83
int Stored()
Stored.
Definition ngcdttPUBLISH.hpp:274
int Sub(ngcdtt_frame_t *f)
Subtract from frame.
Definition ngcdttPUBLISH.hpp:277
ngcdttFP()
Constructor.
Definition ngcdttPUBLISH.hpp:63
int enabled
Subtraction enabled;.
Definition ngcdttPUBLISH.hpp:60
virtual ~ngcdttFP()
Destructor.
Definition ngcdttPUBLISH.hpp:68
void Clear()
Clear.
Definition ngcdttPUBLISH.hpp:73
int TryLock()
Try to lock current frame bbuffer.
Definition ngcdttPUBLISH.cpp:105
virtual ~ngcdttPUBLISH()
Destructor.
Definition ngcdttPUBLISH.cpp:34
int initialized
Initialized (flag)
Definition ngcdttPUBLISH.hpp:739
int Size(ngcpp_hdr_t hdr)
Compute frame size in bytes.
Definition ngcdttPUBLISH.cpp:84
const char * Type()
Return display type.
Definition ngcdttPUBLISH.cpp:61
virtual int Locked(int idx)
Check whether the image stored in frame[idx] is locked.
Definition ngcdttPUBLISH.cpp:169
int NumBuf()
Return number of available display buffers.
Definition ngcdttPUBLISH.cpp:89
int Lock()
Lock current frame buffer.
Definition ngcdttPUBLISH.cpp:107
virtual int IdxOut()
Return actual display buffer index.
Definition ngcdttPUBLISH.cpp:161
char uri[256]
URI, if applicable.
Definition ngcdttPUBLISH.hpp:742
void Invalidate()
Invalidate current frame buffer.
Definition ngcdttPUBLISH.cpp:111
char * ErrMsg()
Return actual error message.
Definition ngcdttPUBLISH.cpp:65
int Unlock()
Unlock current frame buffer.
Definition ngcdttPUBLISH.cpp:109
virtual int Wait(int idx)
Wait until the image stored in frame[idx] is unlocked.
Definition ngcdttPUBLISH.cpp:210
int frameId
Unique frame-id for display.
Definition ngcdttPUBLISH.hpp:754
virtual void Shutdown()
Shutdown publisher.
Definition ngcdttPUBLISH.cpp:151
ngcdtt_frame_t * frame
Frames array.
Definition ngcdttPUBLISH.hpp:757
virtual int IdxIn()
Return the buffer index to be used for next transfer.
Definition ngcdttPUBLISH.cpp:153
int BytesPerPix(int dataType)
Return number of bytes per pixel for specific data type.
Definition ngcdttPUBLISH.cpp:67
ngcdttPUBLISH()
Constructor.
Definition ngcdttPUBLISH.cpp:22
int Publish()
Publish current frame buffer.
Definition ngcdttPUBLISH.cpp:103
ngcdtt_frame_t * Frame()
Get current frame slot.
Definition ngcdttPUBLISH.cpp:98
virtual int Configure(const char *name, int nx, int ny)
Initialize/configure publisher.
Definition ngcdttPUBLISH.cpp:113
int ngcbCubeOpen(const char *fileName, ngcb_cube_t *cube, char *erms)
Definition ngcbFitsTools.c:1794
#define ngcbSUCCESS
Definition ngcb.h:137
void ngcbCubeClose(ngcb_cube_t cube)
Definition ngcbFitsTools.c:2139
int ngcbCubeRead(ngcb_cube_t cube, void *buffer, int slice, char *erms)
Definition ngcbFitsTools.c:2043
#define ngcbFAILURE
Definition ngcb.h:139
#define ngcppDTYPE_UINT16
Definition ngcppInt.h:220
#define ngcppDTYPE_INT64
Definition ngcppInt.h:218
#define ngcppDTYPE_BYTE
Definition ngcppInt.h:213
#define ngcppDTYPE_REAL64
Definition ngcppInt.h:215
#define ngcppDTYPE_INT16
Definition ngcppInt.h:216
#define ngcppDTYPE_INT32
Definition ngcppInt.h:217
#define ngcppDTYPE_REAL32
Definition ngcppInt.h:214
#define ngcppFRAME_ANY
Definition ngcppInt.h:230
void ngcppHdrInit(ngcpp_hdr_t *hdr)
Definition ngcppDataRecv.c:370
int naxis2
Definition ngcb.h:1041
double bzero
Definition ngcb.h:1044
int naxis1
Definition ngcb.h:1040
int bitPix
Definition ngcb.h:1039
Definition ngcdttPUBLISH.hpp:32
ngcdtt_frame_t()
Constructor.
Definition ngcdttPUBLISH.hpp:46
int locked
Flag indicating that the frame is locked.
Definition ngcdttPUBLISH.hpp:40
char * memPtr
Pointer to memory.
Definition ngcdttPUBLISH.hpp:34
int sub
Flag indicating that a bias frame has been subtracted.
Definition ngcdttPUBLISH.hpp:43
ngcpp_hdr_t hdr
Frame header (copy of last frame)
Definition ngcdttPUBLISH.hpp:37
Definition ngcppInt.h:516
int nx
Definition ngcppInt.h:521
int ny
Definition ngcppInt.h:522
int dtype
Definition ngcppInt.h:517