|
This pages documents the interfaces of the histogramming package for the Credit-Card PC.
In a first part the interfaces (C and C++) are described. The second part describes lists example programs for the interfaces
The C Interface to the histogramming package is described here
The C++ Classes are documented here.
#include "CCPCHist.h" #include <stdlib.h> #ifdef WIN32 #include <Windows.h> #define sleep Sleep #else #include <unistd.h> #endif int main(void /*int argc, char **argv*/) { void *h[3]; float x,y; hccpc_init("CC-PC_HSys"); h[0] = hccpc_book1("Hist1","1-dim Histogram 1",100,0.0,100.0); h[1] = hccpc_book1("Hist2","1-dim Histogram 2",100,0.0,200.0); h[2] = hccpc_book1("Hist3","1-dim Histogram 3",100,0.0,300.0); h[3] = hccpc_book2("Hist4","2-dim Histogram",100,0.0,100.0, 10, 0.0, 100.0); while (1) { x=(float)rand()/RAND_MAX; y=(float)rand()/RAND_MAX; hfill1 (h[0],100*x, 1.0); hfill1 (h[1],200*x,1.0); hfill1 (h[2],300*x, 1.0); hfill2 (h[3],100*x, 100*y, 1.0); #ifdef WIN32 { int slp = 10; sleep(slp); } #else { int slp = 10000; usleep(slp); } #endif } }
#include "CCPCHist.h" #ifdef WIN32 #include "windows.h" #define sleep Sleep #else #include "unistd.h" #endif #include <stdio.h> #include <stdlib.h> int main(int , char** ) { Histo *h[4]; PHisto *p; float x,y,d; hccpc_init("CC-PC_HSys"); h[0] = new Histo("Hist1","1-dim Histogram 1",100,0.0,100.0); h[1] = new Histo("Hist2","1-dim Histogram 2",100,0.0,200.0); h[2] = new Histo("Hist3","1-dim Histogram 3",100,0.0,300.0); h[3] = new Histo("Hist7","2-dim Histogram", 100,0.0,10.0,10,0.0,100.0); p = new PHisto("Phist1","Profile 1",100,0.0,10.0); while (1) { x=(float)rand()/RAND_MAX; y=(float)rand()/RAND_MAX; d=(float)rand()/RAND_MAX; h[0]->fill (100*x, 1.0); h[1]->fill (200*x); h[2]->fill (300*x); h[3]->fill(10*x, 100*y); p->fill(10*x,(float)(4*(x-0.5)*(x-0.5)+2*(d-0.5))); #ifdef WIN32 int slp = 5; sleep(slp); #else int slp = 5000; usleep(slp); #endif } }
This page last edited by Beat Jost on December 22, 2006 .