forked from frmeier/psi46test
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Neuste Version von Beat: psi46test_20130715
- Loading branch information
Frank Meier (Mac)
committed
Jul 17, 2013
1 parent
6c2901c
commit ab5e4e9
Showing
9 changed files
with
47,782 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = ∈ | ||
} | ||
|
||
// source -> datapipe -> datapipe -> sink | ||
template <class TI, class TO> | ||
CSource<TO>& operator >> (CSource<TI> &in, CDataPipe<TI,TO> &out) | ||
{ | ||
out.src = ∈ | ||
return out; | ||
} | ||
|
||
|
||
#endif |
Oops, something went wrong.