Skip to content

Commit

Permalink
Neuste Version von Beat: psi46test_20130715
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Meier (Mac) committed Jul 17, 2013
1 parent 6c2901c commit ab5e4e9
Show file tree
Hide file tree
Showing 9 changed files with 47,782 additions and 0 deletions.
46,179 changes: 46,179 additions & 0 deletions CImg.h

Large diffs are not rendered by default.

1,067 changes: 1,067 additions & 0 deletions FTD2XX.h

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions analyzer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// analyzer.cpp

#include "analyzer.h"

// --- event lister ---------------------------------------------------------

class CStore : public CAnalyzer
{
CRocEvent* Read();
};


CRocEvent* CStore::Read()
{
CRocEvent *data = Get();
printf("%8u: %03X %4u:\n", data->eventNr, (unsigned int)(data->header), (unsigned int)(data->pixel.size()));
return data;
}


// --- column statistics ----------------------------------------------------

class CColActivity : public CAnalyzer
{
unsigned long colhits[52];
CRocEvent* Read();
public:
CColActivity() { Clear(); }
void Clear();
};


void CColActivity::Clear()
{
for (int i=0; i<52; i++) colhits[i] = 0;
}


CRocEvent* CColActivity::Read()
{
CRocEvent *data = Get();
list<CPixel>::iterator i;
for (i = data->pixel.begin(); i != data->pixel.end(); i++)
if (i->x >= 0 && i->x < 52) colhits[i->x]++;
return data;
}


void Analyzer(CTestboard &tb)
{
CBinaryDTBSource src(tb);
CDataRecordScanner rec;
CRocDecoder dec;
CStore lister;
CSink<CRocEvent*> pump;

src >> rec >> dec >> lister >> pump;

pump.GetAll();
}
7 changes: 7 additions & 0 deletions analyzer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// analyzer.h

#pragma once

#include "pixel_dtb.h"
#include "datastream.h"

134 changes: 134 additions & 0 deletions color.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
// color.cpp


#include "color.h"


const CColor COLOR_TABLE[SIZE_OF_COLORTABLE] =
{
{ 0.0, 0.0, 0.0 }, // 0 black
{ 0.5, 0.5, 0.5 }, // 1 dark gray
{ .75, .75, .75 }, // 2 light gray
{ 1.0, 1.0, 1.0 }, // 3 white

{ .75, 0.0, 0.0 }, // 4 dark red
{ 1.0, 0.0, 0.0 }, // 5 red
{ 1.0, 0.4, 0.5 }, // 6 light red

{ 0.0, 0.5, 0.0 }, // 7 dark green
{ 0.0, .75, 0.0 }, // 8 green
{ 0.0, 1.0, 0.0 }, // 9 green
{ .75, 1.0, 0.0 }, // 10 yellow green
{ 0.7, 1.0, 0.7 }, // 11 light green

{ 0.0, 0.5, 0.5 }, // 12 dark blue green

{ 0.0, 0.0, 1.0 }, // 13 dark blue
{ .25, 0.5, 1.0 }, // 14 blue
{ 0.0, .75, 1.0 }, // 15 blue
{ 0.5, .75, 1.0 }, // 16 blue
{ 0.0, 1.0, 1.0 }, // 17 light blue
{ 0.5, 1.0, 1.0 }, // 18 light blue

{ 0.5, .25, 0.0 }, // 19 dark brown
{ .75, 0.5, 0.0 }, // 20 brown
{ 1.0, 0.5, .25 }, // 21 orange
{ 1.0, .75, 0.5 }, // 22 light orange
{ 1.0, 1.0, 0.0 }, // 23 yellow
{ 1.0, 1.0, .75 }, // 24 light yellow

{ 0.5, 0.0, 0.5 }, // 25 dark red blue
{ 1.0, 0.0, 1.0 }, // 26 red blue
{ 1.0, .75, 1.0 } // 27 light red blue
};



const int COLOR_BIN[] =
{
8,
5,
23,
21,
24,
25,
26,
27,
12,
13,
14,
16,
18
};

const int COLOR_FAIL[] =
{
5,
23,
21,
24,
25,
26,
13,
14,
17,
0,
1,
2,
3,
7,
19,
20,
22,

12,
27,
4,

6,
11,
10,
8
};

const int COLOR_CLASS[] =
{
8,
10,
17,
23,
5
};

const int COLOR_PIC_GOOD[] =
{
7,
18,
8,
17,
9,
16,
10,
15,
11,
14,
12,
13
};

const int COLOR_PIC_CL2 = 20;

const int COLOR_PIC_BAD[] =
{
5,
23,
21,
4,
24,
6,
22,
1,
2,
3
};

27 changes: 27 additions & 0 deletions color.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// color.h

#ifndef COLOR_H
#define COLOR_H


struct CColor { float r, g, b; };


#define SIZE_OF_COLORTABLE 28

extern const CColor COLOR_TABLE[SIZE_OF_COLORTABLE];

extern const int COLOR_BIN[];

extern const int COLOR_FAIL[];

extern const int COLOR_CLASS[];

extern const int COLOR_PIC_GOOD[];

extern const int COLOR_PIC_CL2;

extern const int COLOR_PIC_BAD[];


#endif
76 changes: 76 additions & 0 deletions datapipe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// connect.h

#ifndef CONNECT_H
#define CONNECT_H


// === data source ==========================================================

// The inheritor must define ReadLast and Read
template <class T>
class CSource
{
virtual T ReadLast() = 0;
virtual T Read() = 0;

template <class S> friend class CSink;
};

// Null source for not connected sinks
template <class T>
class CNullSource : public CSource<T>
{
protected:
CNullSource() {}
CNullSource(const CNullSource&) {}
~CNullSource() {}
T ReadLast() { throw "no connection"; }
T Read() { return ReadLast(); }
template <class S> friend class CSink;
};


// === data sink ============================================================

template <class T>
class CSink
{
public:
CSource<T> *src;
static CNullSource<T> null;
public:
CSink() : src(&null) {}

T GetLast() { return src->ReadLast(); }
T Get() { return src->Read(); }
void GetAll() { while (true) Get(); }
};

template <class T> CNullSource<T> CSink<T>::null;


// === data in -> out (pipe) ================================================

template <class TI, class TO=TI>
class CDataPipe : public CSink<TI>, public CSource<TO> {};


// === operators to connect pipes ===========================================

// source -> sink; source -> datapipe
template <class TI, class TO>
void operator >> (CSource<TI> &in, CSink<TO> &out)
{
out.src = &in;
}

// source -> datapipe -> datapipe -> sink
template <class TI, class TO>
CSource<TO>& operator >> (CSource<TI> &in, CDataPipe<TI,TO> &out)
{
out.src = &in;
return out;
}


#endif
Loading

0 comments on commit ab5e4e9

Please sign in to comment.