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