13#error This is a C++ include file and cannot be used from plain C
28#define ngcdttPUBLISH_MAXBUF 8
75 if (frame_.memPtr != NULL)
77 free(frame_.memPtr); frame_.memPtr = NULL;
128 if (frame_.memPtr == NULL)
130 frame_.memPtr = (
char *)malloc(size);
131 if (frame_.memPtr == NULL)
137 else if (size_ != size)
139 char *p = (
char *)realloc(frame_.memPtr, size);
156 memcpy(frame_.memPtr, f->
memPtr, size_);
201 if (frame_.memPtr == NULL)
203 frame_.memPtr = (
char *)malloc(size);
204 if (frame_.memPtr == NULL)
211 else if (size_ != size)
213 char *p = (
char *)realloc(frame_.memPtr, size);
237 frame_.hdr.nx = cube.
naxis1;
238 frame_.hdr.ny = cube.
naxis2;
244 frame_.hdr.bzero = (int)cube.
bzero;
275 int Stored() {
return ((frame_.memPtr != NULL));}
286 if ((f->
hdr.
nx != frame_.hdr.nx) || (f->
hdr.
ny != frame_.hdr.ny))
296 float *p1 = (
float *)(
void *)f->
memPtr;
299 float *p2 = (
float *)(
void *)frame_.memPtr;
307 int *p2 = (
int *)frame_.memPtr;
310 *p1++ -= (float)*p2++;
315 short *p2 = (
short *)frame_.memPtr;
316 float bz = (float)frame_.hdr.bzero;
319 *p1++ -= ((float)*p2++ + bz);
324 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
325 float bz = (float)frame_.hdr.bzero;
328 *p1++ -= ((float)*p2++ + bz);
338 int *p1 = (
int *)f->
memPtr;
341 int *p2 = (
int *)frame_.memPtr;
349 short *p2 = (
short *)frame_.memPtr;
352 *p1++ -= ((int)*p2++ + frame_.hdr.bzero);
357 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
360 *p1++ -= ((int)*p2++ + frame_.hdr.bzero);
370 double *p1 = (
double *)(
void *)f->
memPtr;
373 double *p2 = (
double *)(
void *)frame_.memPtr;
381 float *p2 = (
float *)(
void *)frame_.memPtr;
384 *p1++ -= (double)*p2++;
389 int *p2 = (
int *)frame_.memPtr;
392 *p1++ -= (double)*p2++;
397 short *p2 = (
short *)frame_.memPtr;
398 double bz = (double)frame_.hdr.bzero;
401 *p1++ -= ((double)*p2++ + bz);
406 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
407 double bz = (double)frame_.hdr.bzero;
410 *p1++ -= ((double)*p2++ + bz);
422 unsigned short *p11 = (
unsigned short *)f->
memPtr;
423 unsigned short *p12 = p11 + n;
424 int *p1 = (
int *)f->
memPtr;
425 short *p2 = (
short *)frame_.memPtr;
427 memcpy(p12, p11, n *
sizeof(
unsigned short));
430 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
436 unsigned short *p11 = (
unsigned short *)f->
memPtr;
437 unsigned short *p12 = p11 + n;
438 int *p1 = (
int *)f->
memPtr;
439 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
441 memcpy(p12, p11, n *
sizeof(
unsigned short));
444 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
457 short *p11 = (
short *)f->
memPtr;
458 short *p12 = p11 + n;
459 int *p1 = (
int *)f->
memPtr;
460 short *p2 = (
short *)frame_.memPtr;
462 memcpy(p12, p11, n *
sizeof(
short));
465 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
471 short *p11 = (
short *)f->
memPtr;
472 short *p12 = p11 + n;
473 int *p1 = (
int *)f->
memPtr;
474 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
476 memcpy(p12, p11, n *
sizeof(
short));
479 *p1++ = (int)*p12++ - ((
int)*p2++ + frame_.hdr.bzero);
535 float *p1 = (
float *)(
void *)f->
memPtr;
538 float *p2 = (
float *)(
void *)frame_.memPtr;
546 int *p2 = (
int *)frame_.memPtr;
549 *p1++ += (float)*p2++;
554 short *p2 = (
short *)frame_.memPtr;
555 float bz = (float)frame_.hdr.bzero;
558 *p1++ += (float)*p2++ + bz;
563 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
564 float bz = (float)frame_.hdr.bzero;
567 *p1++ += (float)*p2++ + bz;
583 short *p1 = (
short *)f->
memPtr;
584 short *p2 = (
short *)frame_.memPtr;
585 int *p11 = (
int *)f->
memPtr;
588 *p1++ = (short)(*p11++ + *p2++ + frame_.hdr.bzero);
593 unsigned short *p1 = (
unsigned short *)f->
memPtr;
594 short *p2 = (
short *)frame_.memPtr;
595 int *p11 = (
int *)f->
memPtr;
598 *p1++ = (
unsigned short)(*p11++ + *p2++ + frame_.hdr.bzero);
611 short *p1 = (
short *)f->
memPtr;
612 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
613 int *p11 = (
int *)f->
memPtr;
616 *p1++ = (short)(*p11++ + *p2++ + frame_.hdr.bzero);
621 unsigned short *p1 = (
unsigned short *)f->
memPtr;
622 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
623 int *p11 = (
int *)f->
memPtr;
626 *p1++ = (
unsigned short)(*p11++ + *p2++ + frame_.hdr.bzero);
642 int *p1 = (
int *)f->
memPtr;
645 int *p2 = (
int *)frame_.memPtr;
653 short *p2 = (
short *)frame_.memPtr;
656 *p1++ += (int)*p2++ + frame_.hdr.bzero;
661 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
664 *p1++ += (int)*p2++ + frame_.hdr.bzero;
675 double *p1 = (
double *)(
void *)f->
memPtr;
678 double *p2 = (
double *)(
void *)frame_.memPtr;
686 float *p2 = (
float *)(
void *)frame_.memPtr;
689 *p1++ += (double)*p2++;
694 int *p2 = (
int *)frame_.memPtr;
697 *p1++ += (double)*p2++;
702 short *p2 = (
short *)frame_.memPtr;
703 double bz = (double)frame_.hdr.bzero;
706 *p1++ += (double)*p2++ + bz;
711 unsigned short *p2 = (
unsigned short *)frame_.memPtr;
712 double bz = (double)frame_.hdr.bzero;
715 *p1++ += (double)*p2++ + bz;
801 virtual int Configure(
const char *name,
int nx,
int ny);
813 virtual int Locked(
int idx);
816 virtual int Lock(
int idx);
822 virtual int Unlock(
int idx);
825 virtual int Wait(
int idx);
834 void Type(
const char *name);
int Store(const char *fileName)
Store FITS-frame.
Definition ngcdttPUBLISH.hpp:162
int Store(ngcdtt_frame_t *f)
Store given frame.
Definition ngcdttPUBLISH.hpp:84
int Stored()
Stored.
Definition ngcdttPUBLISH.hpp:275
int Sub(ngcdtt_frame_t *f)
Subtract from frame.
Definition ngcdttPUBLISH.hpp:278
ngcdttFP()
Constructor.
Definition ngcdttPUBLISH.hpp:64
int enabled
Subtraction enabled;.
Definition ngcdttPUBLISH.hpp:61
virtual ~ngcdttFP()
Destructor.
Definition ngcdttPUBLISH.hpp:69
void Clear()
Clear.
Definition ngcdttPUBLISH.hpp:74
int TryLock()
Try to lock current frame bbuffer.
Definition ngcdttPUBLISH.cpp:106
virtual ~ngcdttPUBLISH()
Destructor.
Definition ngcdttPUBLISH.cpp:35
int initialized
Initialized (flag)
Definition ngcdttPUBLISH.hpp:740
int Size(ngcpp_hdr_t hdr)
Compute frame size in bytes.
Definition ngcdttPUBLISH.cpp:85
const char * Type()
Return display type.
Definition ngcdttPUBLISH.cpp:62
virtual int Locked(int idx)
Check whether the image stored in frame[idx] is locked.
Definition ngcdttPUBLISH.cpp:170
int NumBuf()
Return number of available display buffers.
Definition ngcdttPUBLISH.cpp:90
int Lock()
Lock current frame buffer.
Definition ngcdttPUBLISH.cpp:108
virtual int IdxOut()
Return actual display buffer index.
Definition ngcdttPUBLISH.cpp:162
char uri[256]
URI, if applicable.
Definition ngcdttPUBLISH.hpp:743
void Invalidate()
Invalidate current frame buffer.
Definition ngcdttPUBLISH.cpp:112
char * ErrMsg()
Return actual error message.
Definition ngcdttPUBLISH.cpp:66
int Unlock()
Unlock current frame buffer.
Definition ngcdttPUBLISH.cpp:110
virtual int Wait(int idx)
Wait until the image stored in frame[idx] is unlocked.
Definition ngcdttPUBLISH.cpp:211
int frameId
Unique frame-id for display.
Definition ngcdttPUBLISH.hpp:755
virtual void Shutdown()
Shutdown publisher.
Definition ngcdttPUBLISH.cpp:152
ngcdtt_frame_t * frame
Frames array.
Definition ngcdttPUBLISH.hpp:758
virtual int IdxIn()
Return the buffer index to be used for next transfer.
Definition ngcdttPUBLISH.cpp:154
int BytesPerPix(int dataType)
Return number of bytes per pixel for specific data type.
Definition ngcdttPUBLISH.cpp:68
ngcdttPUBLISH()
Constructor.
Definition ngcdttPUBLISH.cpp:23
int Publish()
Publish current frame buffer.
Definition ngcdttPUBLISH.cpp:104
ngcdtt_frame_t * Frame()
Get current frame slot.
Definition ngcdttPUBLISH.cpp:99
virtual int Configure(const char *name, int nx, int ny)
Initialize/configure publisher.
Definition ngcdttPUBLISH.cpp:114
int ngcbCubeOpen(const char *fileName, ngcb_cube_t *cube, char *erms)
Definition ngcbFitsTools.c:1795
#define ngcbSUCCESS
Definition ngcb.h:138
void ngcbCubeClose(ngcb_cube_t cube)
Definition ngcbFitsTools.c:2140
int ngcbCubeRead(ngcb_cube_t cube, void *buffer, int slice, char *erms)
Definition ngcbFitsTools.c:2044
#define ngcbFAILURE
Definition ngcb.h:140
#define ngcppDTYPE_UINT16
Definition ngcppInt.h:221
#define ngcppDTYPE_INT64
Definition ngcppInt.h:219
#define ngcppDTYPE_BYTE
Definition ngcppInt.h:214
#define ngcppDTYPE_REAL64
Definition ngcppInt.h:216
#define ngcppDTYPE_INT16
Definition ngcppInt.h:217
#define ngcppDTYPE_INT32
Definition ngcppInt.h:218
#define ngcppDTYPE_REAL32
Definition ngcppInt.h:215
#define ngcppFRAME_ANY
Definition ngcppInt.h:231
void ngcppHdrInit(ngcpp_hdr_t *hdr)
Definition ngcppDataRecv.c:371
int naxis2
Definition ngcb.h:1042
double bzero
Definition ngcb.h:1045
int naxis1
Definition ngcb.h:1041
int bitPix
Definition ngcb.h:1040
Definition ngcdttPUBLISH.hpp:33
ngcdtt_frame_t()
Constructor.
Definition ngcdttPUBLISH.hpp:47
int locked
Flag indicating that the frame is locked.
Definition ngcdttPUBLISH.hpp:41
char * memPtr
Pointer to memory.
Definition ngcdttPUBLISH.hpp:35
int sub
Flag indicating that a bias frame has been subtracted.
Definition ngcdttPUBLISH.hpp:44
ngcpp_hdr_t hdr
Frame header (copy of last frame)
Definition ngcdttPUBLISH.hpp:38
Definition ngcppInt.h:518
int nx
Definition ngcppInt.h:523
int ny
Definition ngcppInt.h:524
int dtype
Definition ngcppInt.h:519