ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbPP.hpp
Go to the documentation of this file.
1
8#ifndef ngcbPP_H
9#define ngcbPP_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16#include <stdlib.h>
17#include <stdio.h>
18#include <string.h>
19#include <unistd.h>
20#include <errno.h>
21#include <dlfcn.h>
22#include <ngc/core/ngcb.h>
23#include <ngc/core/ngcbSched.h>
24
25/*
26 * Processing pipeline result codes
27 */
28#define ngcbPP_SUCCESS 0x0000 //< success
29#define ngcbPP_SKIP 0x0001 //< skip processing
30#define ngcbPP_FAILURE 0x0100 //< processing failed
31#define ngcbPP_ERR_FATAL 0x1100 //< fatal error (cannot continue)
32
36#define ngcbPPLOG(...) do {char s[320]; snprintf(s, 320, __VA_ARGS__); Log(s);} while (0)
37
41#define ngcbPP_MAX_LIB 32
42
48 int result;
49
51 int ftype;
52
54 int fcnt;
55
57 int bitPix;
58
60 double bscale;
61
63 double bzero;
64
66 int sx;
67
69 int sy;
70
72 int nx;
73
75 int ny;
76
78 double crpix1;
79
81 double crpix2;
82
86 ftype = 0; fcnt = 0;
87 bitPix = 16; bscale = 1.0; bzero = 0.0;
88 sx = 1; sy = 1; nx = 0; ny = 0;
89 crpix1 = 0.0; crpix2 = 0.0;
90 }
91
93 size_t NumPix() {return ((size_t)nx * (size_t)ny);}
94
96 size_t Size() {return (NumPix() * (size_t)(abs(bitPix) / 8));}
97};
98
102typedef void *(*ngcb_pp_thr)(void *arg);
103
108{
109public:
111 pthread_t thid;
112
115 initialized_ = 0;
116 erms_[0] = '\0';
117 // cppcheck-suppress useInitializationList
118 thid = ngcbThrId();
119 if (ngcbSemInit(&semStart_, 0, ngcbSEM_FAST, NULL) != 0)
120 {
121 strcpy(ErrMsg(), "semaphore creation failed");
122 return;
123 }
124 else if (ngcbSemInit(&semAck_, 0, ngcbSEM_FAST, NULL) != 0)
125 {
126 ngcbSemDestroy(&semStart_);
127 strcpy(ErrMsg(), "semaphore creation failed");
128 return;
129 }
130 initialized_ = 1;
131 }
132
134 virtual ~ngcb_pp_sync() {
135 if (initialized_)
136 {
137 ngcbSemDestroy(&semStart_);
138 ngcbSemDestroy(&semAck_);
139 }
140 }
141
143 int Initialized() {return (initialized_);}
144
146 char *ErrMsg() {return (erms_);}
147
149 void Start() {if (initialized_) ngcbSemPost(&semStart_);}
150
152 void Join() {if (initialized_) ngcbSemWait(&semAck_);}
153
155 void Wait() {if (initialized_) ngcbSemWait(&semStart_);}
156
158 void Ack() {if (initialized_) ngcbSemPost(&semAck_);}
159protected:
160private:
162 int initialized_;
163
165 char erms_[256];
166
168 ngcb_sema_t semStart_;
169
171 ngcb_sema_t semAck_;
172};
173
178{
179public:
182
185
188
191
194
196 pthread_t thid;
197
199 void *procBuf;
200
203
205 ngcbPP() {Init_(-1);}
206
208 explicit ngcbPP(int id) {Init_(id); }
209
211 virtual ~ngcbPP() {
212 ngcbPPLOG("deleting processor %d\n", Id());
213 if (next != NULL)
214 {
215 if (join_)
216 {
217 /*
218 * Wait for next thread
219 */
220 if (next->proc != NULL)
221 {
222 ngcbPPLOG("joining processor %d\n", next->Id());
223 ngcbThrJoin(next->thid); // thread is terminated
224 next->proc = NULL;
225 ngcbPPLOG("processor %d joined\n", next->Id());
226 }
227 else if (next->psync != NULL)
228 {
229 ngcbPPLOG("waiting for processor %d\n", next->Id());
230 next->psync->Join(); // thread is now in waiting state
231 ngcbPPLOG("cancelling processor %d\n", next->Id());
232 if (ngcbThrCancel(next->psync->thid) == 0)
233 {
234 ngcbPPLOG("joining processor %d\n", next->Id());
235 ngcbThrJoin(next->psync->thid); // thread is terminated
236 delete next->psync; next->psync = NULL;
237 ngcbPPLOG("processor %d joined\n", next->Id());
238 }
239 }
240 join_ = 0;
241 }
242 delete next; next = NULL;
243 }
244 ngcbPPLOG("processor %d deleted\n", Id());
245 }
246
248 int Initialized() {return (initialized);}
249
251 char *ErrMsg() {return (erms_);}
252
254 void Id(int id) {id_ = id;}
255
257 int Id() {return (id_);}
258
260 int NumBuf() {return (numBuf);}
261
263 int RdOnly() {return (rdOnly);}
264
266 void *Execute(void *buffer, ngcb_pp_descr *descr) {
267 void *in = buffer;
268 void *out;
269
270 /*
271 * Start our processor
272 */
273 ngcbPPLOG("processor: %d\n", Id());
274 out = Process(in, descr);
275 if (descr->result & ngcbPP_SKIP)
276 {
277 /*
278 * Frame is not ready for further processing
279 */
280 return (out);
281 }
282
283 if (next != NULL)
284 {
285 if (out != NULL)
286 {
287 /*
288 * We forward the result as input to the next instance
289 */
290 in = out;
291 }
292
293 if ((next->proc != NULL) || (next->psync != NULL))
294 {
295 if (join_)
296 {
297 join_ = 0;
298
299 /*
300 * Wait for result from next thread
301 */
302 ngcbPPLOG("waiting for processor %d\n", next->Id());
303 if (next->proc != NULL)
304 {
305 if (ngcbThrJoin(next->thid) != 0)
306 {
307 descr->result |= ngcbPP_ERR_FATAL;
308 sprintf(ErrMsg(), "processer %d thread synchronization failed",
309 Id());
310 return (NULL);
311 }
312 }
313 else
314 {
315 next->psync->Join();
316 }
317 ngcbPPLOG("processor %d ready\n", next->Id());
318
319 out = next->procBuf;
320 tmpDescr_ = next->procDescr;
321 next->procDescr = *descr;
322 *descr = tmpDescr_;
323
324 if (descr->result & ngcbPP_FAILURE)
325 {
326 strcpy(ErrMsg(), next->ErrMsg());
327 if (descr->result & ngcbPP_ERR_FATAL)
328 {
329 return (NULL);
330 }
331 }
332 }
333 else
334 {
335 /*
336 * We do not yet have a final result
337 */
338 out = NULL;
339 next->procDescr = *descr;
340 }
341
342 /*
343 * Start next processing thread
344 */
345 next->procBuf = in;
346 next->procDescr.result = 0x0;
347 if (next->proc != NULL)
348 {
349 ngcbPPLOG("creating thread for processor %d\n", next->Id());
350 if (ngcbThrCreate(next->proc, (void *)next, 0, &next->thid) != 0)
351 {
352 descr->result |= ngcbPP_ERR_FATAL;
353 sprintf(ErrMsg(), "processor %d thread creation failed", Id());
354 return (NULL);
355 }
356 }
357 else
358 {
359 ngcbPPLOG("starting thread for processor %d\n", next->Id());
360 next->psync->Start();
361 }
362 join_ = 1;
363 }
364 else
365 {
366 /*
367 * Execute next processor
368 */
369 out = next->Execute(in, descr);
370 if (descr->result & ngcbPP_FAILURE) strcpy(ErrMsg(), next->ErrMsg());
371 }
372 }
373 else
374 {
375 /*
376 * End of processing pipeline
377 */
378 ngcbPPLOG("pipeline ready\n");
379 }
380
381 return (out);
382 }
383
385 virtual void *Process(void *buffer, ngcb_pp_descr *descr) {
386 descr->result = ngcbPP_SUCCESS;
387 return (buffer);
388 }
389
390protected:
393
396
399
401 void Init_(int id) {
402 initialized = 0;
403 id_ = id;
404 verboseLevel = 0; logLevel = 0;
405 next = NULL;
406 psync = NULL;
407 proc = NULL;
408 procBuf = NULL;
409 thid = ngcbThrId();
410 join_ = 0;
411
412 erms_[0] = '\0';
413
414 numBuf = 0;
415 rdOnly = 1;
416 initialized = 1;
417 }
418
420 void Log(const char *msg) {
421 if (verboseLevel > 0) fprintf(stdout, "%s", msg);
422 }
423
425 void *Malloc(size_t size) {
426 unsigned char *m = (unsigned char *)malloc(size);
427 if (m != NULL)
428 {
429 unsigned int i;
430 int pageSize = (int)sysconf(_SC_PAGESIZE);
431 if (pageSize < 1) pageSize = 4096; /* TBD */
432
433 /*
434 * Touch each page to get it mapped into RAM
435 */
436 for (i=0;i<size;i+=pageSize) m[i] = (unsigned char)0;
437 }
438 return ((void *)m);
439 }
440
441private:
443 int id_;
444
446 char erms_[256];
447
449 int join_;
450
452 ngcb_pp_descr tmpDescr_;
453};
454
458static void *ngcbPP_Proc(void *arg)
459{
460 ngcbPP *p = static_cast<ngcbPP *>(arg);
461 sigset_t set;
462
463 /*
464 * We do not want to interfere with signals here
465 */
466 sigfillset(&set);
467 pthread_sigmask(SIG_BLOCK, &set, (sigset_t *)NULL);
468
469 /*
470 * Execute processor
471 */
472 p->procBuf = p->Execute(p->procBuf, &p->procDescr);
473
474 return (NULL);
475}
476
480static void *ngcpPP_ProcSync(void *arg)
481{
482 ngcbPP *p = static_cast<ngcbPP *>(arg);
483 sigset_t set;
484
485 /*
486 * We do not want to interfere with signals here
487 */
488 sigfillset(&set);
489 pthread_sigmask(SIG_BLOCK, &set, (sigset_t *)NULL);
490
491 while (1)
492 {
493 /*
494 * Wait for start signal
495 */
496 p->psync->Wait();
497
498 /*
499 * Execute processor
500 */
501 p->procBuf = p->Execute(p->procBuf, &p->procDescr);
502
503 /*
504 * Send acknowledge
505 */
506 p->psync->Ack();
507 }
508
509 return (NULL);
510}
511
516{
517public:
520 erms_[0] = '\0';
521 }
522
524 virtual ~ngcbPP_FACTORY() {}
525
527 char *ErrMsg() {return (erms_);}
528
530 ngcbPP *Create(int id) {
531 ngcbPP *p = Make(id);
532 if (p->Initialized())
533 {
534 /*
535 * Processor initialization successful
536 */
537 return (p);
538 }
539 else
540 {
541 /*
542 * Processor initialization failed
543 */
544 strcpy(ErrMsg(), p->ErrMsg());
545 delete p;
546 return (NULL);
547 }
548 }
549
550protected:
552 virtual ngcbPP *Make(int id) {return (new ngcbPP(id));}
553
554private:
556 char erms_[256];
557};
558
562#define NGC_REGISTER_PP_MOD(type, name) extern "C" { type name; \
563 int _ngcb_pp_ ## name = 1 ; }
564
569{
570public:
573
576
579 int i;
580 verboseLevel = 0; logLevel = 0; erms_[0] = '\0';
581 first_ = NULL;
582 pp_ = first_;
583 idx_ = 0;
584 ndl_ = 0;
585 for (i=0;i<ngcbPP_MAX_LIB;i++) dl_[i] = NULL;
586 }
587
589 virtual ~ngcbPIPELINE() {
590 if (first_ != NULL)
591 {
592 /*
593 * Delete whole pipeline
594 */
595 delete first_;
596 }
597
598 if (ndl_ > 0)
599 {
600 int i;
601
602 ngcbPPLOG("unloading libraries\n");
603 for (i=0;i<ndl_;i++)
604 {
605 if (dl_[i] != NULL)
606 {
607 if (dlclose(dl_[i]) != 0) ngcbPPLOG("failure - %s\n", dlerror());
608 dl_[i] = NULL;
609 }
610 }
611 }
612 }
613
615 char *ErrMsg() {return (erms_);}
616
618 void Add(ngcbPP *newProc) {
619 if (newProc == NULL)
620 {
621 return;
622 }
623
624 if (newProc->Id() < 0)
625 {
626 /*
627 * The ID is no yet assigned
628 */
629 newProc->Id(idx_++);
630 }
631
632 newProc->verboseLevel = verboseLevel;
633 newProc->logLevel = logLevel;
634 if (first_ == NULL)
635 {
636 /*
637 * This is our first processing step
638 */
639 first_ = newProc;
640 pp_ = first_;
641 }
642 else
643 {
644 /*
645 * Add processor to the end of the pipeline
646 */
647 pp_->next = newProc;
648 pp_ = pp_->next;;
649 }
650 }
651
653 int Lib(const char *name) {
654 char libName[128];
655 void *dl;
656
657 if (ndl_ >= ngcbPP_MAX_LIB)
658 {
659 strcpy(ErrMsg(), "maximum number of external libraries reached");
660 return (-1);
661 }
662
663 /*
664 * Load library
665 */
666 snprintf(libName, sizeof(libName), "lib%s.so", name);
667 ngcbPPLOG("loading library <%s>\n", libName);
668 dl = dlopen(libName, RTLD_NOW|RTLD_LOCAL);
669 if (dl == NULL)
670 {
671 strcpy(ErrMsg(), dlerror());
672 return (-1);
673 }
674 dl_[ndl_++] = dl;
675
676 return (0);
677 }
678
680 int Add(const char *module) {
681 char cookie[128];
682 void *dl = NULL;
683 ngcbPP_FACTORY *f = NULL;
684 ngcbPP *newProc = NULL;
685
686 if (module == NULL)
687 {
688 /*
689 * Add dummy processor instance just for test
690 */
691 newProc = new ngcbPP(idx_++);
692 if (newProc->Initialized())
693 {
694 Add(newProc);
695 return (0);
696 }
697 else
698 {
699 strcpy(ErrMsg(), newProc->ErrMsg());
700 delete newProc;
701 return(-1);
702 }
703 }
704
705 /*
706 * Identification string
707 */
708 snprintf(cookie, sizeof(cookie), "_ngcb_pp_%s", module);
709
710 if (ndl_ > 0)
711 {
712 int i;
713
714 /*
715 * First search loaded libraries
716 */
717 ngcbPPLOG("browsing libraries\n");
718 for (i=0;i<ndl_;i++)
719 {
720 if (dl_[i] != NULL)
721 {
722 /*
723 * Identification
724 */
725 if (dlsym(dl_[i], cookie) != NULL)
726 {
727 ngcbPPLOG("module <%s> identified\n", module);
728
729 /*
730 * Lookup processor factory symbol
731 */
732 dlerror();
733 f = static_cast<ngcbPP_FACTORY *>(dlsym(dl_[i], module));
734 if (f == NULL)
735 {
736 char *err = dlerror();
737 if (err != NULL)
738 {
739 ngcbPPLOG("%s\n", err);
740 }
741 else
742 {
743 ngcbPPLOG("invalid factory symbol <%s>\n", module);
744 }
745 }
746 else
747 {
748 ngcbPPLOG("module <%s> registered\n", module);
749 break;
750 }
751 }
752 }
753 }
754 }
755
756 if (f == NULL)
757 {
758 char libName[128];
759
760 /*
761 * Load module by name
762 */
763 ngcbPPLOG("loading module <%s>\n", module);
764 snprintf(libName, sizeof(libName), "lib%s.so", module);
765 dl = dlopen(libName, RTLD_NOW|RTLD_LOCAL);
766 if (dl == NULL)
767 {
768 strcpy(ErrMsg(), dlerror());
769 return (-1);
770 }
771
772 /*
773 * Identification
774 */
775 if (dlsym(dl, cookie) == NULL)
776 {
777 ngcbPPLOG("unloading module <%s>\n", module);
778 if (dlclose(dl) != 0)
779 {
780 ngcbPPLOG("failure - %s\n", dlerror());
781 }
782 sprintf(ErrMsg(), "module <%s> rejected - identification failed",
783 module);
784 return (-1);
785 }
786
787 /*
788 * Lookup processor factory symbol
789 */
790 dlerror();
791 f = static_cast<ngcbPP_FACTORY *>(dlsym(dl, module));
792 if (f == NULL)
793 {
794 char *err = dlerror();
795 if (err != NULL) strcpy(ErrMsg(), err);
796 else sprintf(ErrMsg(), "invalid factory symbol <%s>", module);
797
798 /*
799 * Unload the module again
800 */
801 ngcbPPLOG("unloading module <%s>\n", module);
802 if (dlclose(dl) != 0)
803 {
804 ngcbPPLOG("failure - %s\n", dlerror());
805 }
806 return (-1);
807 }
808 }
809
810 /*
811 * Create processor
812 */
813 ngcbPPLOG("creating processor for module <%s>\n", module);
814 newProc = f->Create(idx_++);
815 if (newProc == NULL)
816 {
817 if (dl != NULL)
818 {
819 /*
820 * Unload the module again
821 */
822 ngcbPPLOG("unloading module <%s>\n", module);
823 if (dlclose(dl) != 0)
824 {
825 ngcbPPLOG("failure - %s\n", dlerror());
826 }
827 return (-1);
828 }
829 }
830
831 /*
832 * Add processor
833 */
834 Add(newProc);
835
836 return (0);
837 }
838
840 void *Execute(void *buffer, ngcb_pp_descr *descr) {
841 void *out;
842
843 /*
844 * We start with success
845 */
846 descr->result = ngcbPP_SUCCESS;
847
848 /*
849 * Enter the processing pipeline
850 */
851 out = first_->Execute(buffer, descr);
852 if (descr->result & ngcbPP_FAILURE) strcpy(ErrMsg(), first_->ErrMsg());
853
854 return (out);
855 }
856
858 void Parallelize(int fastSync=0) {
859 ngcbPP *p;
860
861 /*
862 * Assign built-in threading
863 */
864 for (p = first_; p != NULL; p = p->next)
865 {
866 if (p->next != NULL) p->next->proc = ngcbPP_Proc;
867 }
868
869 if (!fastSync)
870 {
871 /*
872 * This was enough
873 */
874 return;
875 }
876
877 for (p = first_; p != NULL; p = p->next)
878 {
879 if (p->next != NULL)
880 {
881 if ((p->NumBuf() > 1) || (p->RdOnly() && p->next->RdOnly()))
882 {
883 ngcb_pp_sync *psync;
884
885 /*
886 * Create fast synchronization primitive
887 */
888 psync = new ngcb_pp_sync();
889 if (psync->Initialized())
890 {
891 /*
892 * Create static processing thread
893 */
894 ngcbPPLOG("creating processor %d\n", p->next->Id());
895 p->next->psync = psync;
896 if (ngcbThrCreate(ngcpPP_ProcSync, (void *)p->next, 0,
897 &psync->thid) == 0)
898 {
899 /*
900 * Disable built-in thread (slow-sync)
901 */
902 p->next->proc = NULL;
903 }
904 else
905 {
906 ngcbPPLOG("fast-sync not available - thread creation failed\n");
907 p->next->psync = NULL;
908 delete psync;
909 break;
910 }
911 }
912 else
913 {
914 ngcbPPLOG("fast-sync not available - %s\n", psync->ErrMsg());
915 p->next->psync = NULL;
916 delete psync;
917 }
918 }
919 }
920 }
921 }
922
924 void VerboseLevel(int level) {
925 ngcbPP *p;
926 verboseLevel = level;
927 for (p = first_; p != NULL; p = p->next) p->verboseLevel = level;
928 }
929
931 void LogLevel(int level) {
932 ngcbPP *p;
933 logLevel = level;
934 for (p = first_; p != NULL; p = p->next) p->logLevel = level;
935 }
936
937protected:
939 void Log(const char *msg) {
940 if (verboseLevel > 0) fprintf(stdout, "%s", msg);
941 }
942
943private:
945 ngcbPP *first_;
946
948 ngcbPP *pp_;
949
951 int idx_;
952
954 char erms_[256];
955
957 void *dl_[ngcbPP_MAX_LIB];
958
960 int ndl_;
961};
962
963#endif
964
ngcbPIPELINE()
Constructor.
Definition ngcbPP.hpp:578
int Lib(const char *name)
Load external library.
Definition ngcbPP.hpp:653
virtual ~ngcbPIPELINE()
Destructor.
Definition ngcbPP.hpp:589
void LogLevel(int level)
Set logging level.
Definition ngcbPP.hpp:931
char * ErrMsg()
Error message.
Definition ngcbPP.hpp:615
int logLevel
Logging level.
Definition ngcbPP.hpp:575
void Log(const char *msg)
Logging function.
Definition ngcbPP.hpp:939
void Parallelize(int fastSync=0)
Parallelize processing pipeline.
Definition ngcbPP.hpp:858
int verboseLevel
Verbose level.
Definition ngcbPP.hpp:572
void VerboseLevel(int level)
Set verbose level.
Definition ngcbPP.hpp:924
int Add(const char *module)
Load processor from module and add it to the end of the pipeline.
Definition ngcbPP.hpp:680
void Add(ngcbPP *newProc)
Add processor to the end of the pipeline.
Definition ngcbPP.hpp:618
void * Execute(void *buffer, ngcb_pp_descr *descr)
Execute processing pipeline.
Definition ngcbPP.hpp:840
Definition ngcbPP.hpp:516
ngcbPP_FACTORY()
Constructor.
Definition ngcbPP.hpp:519
char * ErrMsg()
Error message.
Definition ngcbPP.hpp:527
ngcbPP * Create(int id)
Creator.
Definition ngcbPP.hpp:530
virtual ~ngcbPP_FACTORY()
Destructor.
Definition ngcbPP.hpp:524
virtual ngcbPP * Make(int id)
Maker with id.
Definition ngcbPP.hpp:552
Definition ngcbPP.hpp:178
int rdOnly
Input buffer read-only flag.
Definition ngcbPP.hpp:398
ngcb_pp_descr procDescr
Processing thread buffer descriptor (forward)
Definition ngcbPP.hpp:202
virtual ~ngcbPP()
Destructor.
Definition ngcbPP.hpp:211
int NumBuf()
Return number of frame buffers.
Definition ngcbPP.hpp:260
void Init_(int id)
Initialization function.
Definition ngcbPP.hpp:401
int numBuf
Number of frame buffers.
Definition ngcbPP.hpp:395
int verboseLevel
Verbose level.
Definition ngcbPP.hpp:181
int logLevel
Logging level.
Definition ngcbPP.hpp:184
int RdOnly()
Return input buffer read-only flag.
Definition ngcbPP.hpp:263
void * Execute(void *buffer, ngcb_pp_descr *descr)
Execute Processor.
Definition ngcbPP.hpp:266
int Initialized()
Return initialization flag.
Definition ngcbPP.hpp:248
int Id()
Return processor ID.
Definition ngcbPP.hpp:257
void Id(int id)
Assign id.
Definition ngcbPP.hpp:254
ngcbPP(int id)
Constructor.
Definition ngcbPP.hpp:208
ngcbPP()
Constructor.
Definition ngcbPP.hpp:205
int initialized
Initialization flag.
Definition ngcbPP.hpp:392
char * ErrMsg()
Error message.
Definition ngcbPP.hpp:251
void * Malloc(size_t size)
Preferred buffer allocation.
Definition ngcbPP.hpp:425
ngcb_pp_thr proc
Built-in processing thread.
Definition ngcbPP.hpp:193
ngcbPP * next
Next processor.
Definition ngcbPP.hpp:187
pthread_t thid
Thread id.
Definition ngcbPP.hpp:196
void * procBuf
Processing thread buffer (forward)
Definition ngcbPP.hpp:199
void Log(const char *msg)
Logging function.
Definition ngcbPP.hpp:420
virtual void * Process(void *buffer, ngcb_pp_descr *descr)
Pixel-Processor.
Definition ngcbPP.hpp:385
ngcb_pp_sync * psync
Thread synchronization primitive.
Definition ngcbPP.hpp:190
Definition ngcbPP.hpp:108
int Initialized()
Return initialization flag.
Definition ngcbPP.hpp:143
char * ErrMsg()
Error message.
Definition ngcbPP.hpp:146
pthread_t thid
Thread id.
Definition ngcbPP.hpp:111
ngcb_pp_sync()
Constructor.
Definition ngcbPP.hpp:114
void Wait()
Wait.
Definition ngcbPP.hpp:155
virtual ~ngcb_pp_sync()
Destructor.
Definition ngcbPP.hpp:134
void Start()
Start.
Definition ngcbPP.hpp:149
void Ack()
Acknowledge.
Definition ngcbPP.hpp:158
void Join()
Join.
Definition ngcbPP.hpp:152
#define ngcbPP_ERR_FATAL
Definition ngcbPP.hpp:31
#define ngcbPP_MAX_LIB
Definition ngcbPP.hpp:41
#define ngcbPPLOG(...)
Definition ngcbPP.hpp:36
void *(* ngcb_pp_thr)(void *arg)
Definition ngcbPP.hpp:102
#define ngcbPP_FAILURE
Definition ngcbPP.hpp:30
#define ngcbPP_SUCCESS
Definition ngcbPP.hpp:28
#define ngcbPP_SKIP
Definition ngcbPP.hpp:29
ngcb_thread_t ngcbThrId(void)
Definition ngcbSchedThread.c:95
int ngcbSemPost(ngcb_sema_t *sp)
Definition ngcbSchedSem.c:123
int ngcbSemInit(ngcb_sema_t *sp, unsigned int count, int type, void *arg)
Definition ngcbSchedSem.c:19
int ngcbSemDestroy(ngcb_sema_t *sp)
Definition ngcbSchedSem.c:70
int ngcbSemWait(ngcb_sema_t *sp)
Definition ngcbSchedSem.c:161
#define ngcbSEM_FAST
Definition ngcbSched.h:68
int ngcbThrJoin(ngcb_thread_t thread)
Definition ngcbSchedThread.c:83
int ngcbThrCreate(void *(*startFunc)(void *), void *arg, size_t stack, ngcb_thread_t *thread)
Definition ngcbSchedThread.c:19
int ngcbThrCancel(ngcb_thread_t thread)
Definition ngcbSchedThread.c:59
Definition ngcbPP.hpp:46
size_t NumPix()
Return frame size (pixels)
Definition ngcbPP.hpp:93
int sx
Lower left corner (x-direction)
Definition ngcbPP.hpp:66
int ftype
Frame type.
Definition ngcbPP.hpp:51
ngcb_pp_descr()
Constructor.
Definition ngcbPP.hpp:84
int result
Result code.
Definition ngcbPP.hpp:48
int ny
Dimension in y-direction.
Definition ngcbPP.hpp:75
int nx
Dimension in x-direction.
Definition ngcbPP.hpp:72
int bitPix
Bits per pixel as defined in the FITS-standard.
Definition ngcbPP.hpp:57
double crpix1
Reference pixel in x-direction.
Definition ngcbPP.hpp:78
double bscale
Scaling factor to be applied.
Definition ngcbPP.hpp:60
double bzero
Offset value to be added.
Definition ngcbPP.hpp:63
int fcnt
Frame counter.
Definition ngcbPP.hpp:54
size_t Size()
Return frame size (bytes)
Definition ngcbPP.hpp:96
double crpix2
Reference pixel in y-direction.
Definition ngcbPP.hpp:81
int sy
Lower left corner (y-direction)
Definition ngcbPP.hpp:69
Definition ngcbSched.h:78