d8c3e8dbcdecf9172dc34f57aa4c9dcacdabb905
Stefan Schuermans add config file generator

Stefan Schuermans authored 7 years ago

1) /*
Stefan Schuermans rename "FlexiPix" to "Ether...

Stefan Schuermans authored 7 years ago

2)  * EtherPix config file generator
Stefan Schuermans add config file generator

Stefan Schuermans authored 7 years ago

3)  *
Stefan Schuermans update copyright year

Stefan Schuermans authored 7 years ago

4)  * Copyright 2010-2017 Stefan Schuermans <stefan schuermans info>
Stefan Schuermans add config file generator

Stefan Schuermans authored 7 years ago

5)  *
6)  * This program is free software: you can redistribute it and/or modify
7)  * it under the terms of the GNU General Public License as published by
8)  * the Free Software Foundation, version 3 of the License.
9)  *
10)  *
11)  * This program is distributed in the hope that it will be useful,
12)  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13)  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14)  * GNU General Public License for more details.
15)  *
16)  * You should have received a copy of the GNU Lesser General Public License
17)  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18)  */
19) 
20) #include <iostream>
21) #include <vector>
22) 
23) #include "chain.h"
24) #include "pixel.h"
25) #include "point.h"
26) 
27) Chain::Chain(unsigned int pixelCnt):
28)   mPixelCnt(pixelCnt)
29) {
30) }
31) 
Stefan Schuermans make class members private

Stefan Schuermans authored 7 years ago

32) void Chain::addPixel(Pixel const &pixel)
33) {
34)   mPixels.push_back(pixel);
35) }
36) 
Stefan Schuermans add config file generator

Stefan Schuermans authored 7 years ago

37) int Chain::pixCoord(const Point &pix0, const Point &pixSz,
38)                     unsigned int width, unsigned int height,
39)                     unsigned int distriNo, unsigned int chainNo)
40) {
41)   bool err = false;
42)   if (mPixels.size() > mPixelCnt) {
43)     std::cerr << "too many pixels (" << mPixels.size() << "/"
Stefan Schuermans output hex numbers with 0x...

Stefan Schuermans authored 7 years ago

44)               << mPixelCnt << ") for distributor 0x"
Stefan Schuermans add config file generator

Stefan Schuermans authored 7 years ago

45)               << std::hex << distriNo << " chain "
46)               << std::dec << chainNo << std::endl;
47)     err = true;
48)   }
49)   std::vector<Pixel>::iterator itP;
50)   for (itP = mPixels.begin(); itP != mPixels.end(); ++itP)
51)     if (itP->pixCoord(pix0, pixSz, width, height) != 0)
52)       err = true;
53)   return err ? -1 : 0;
54) }
55) 
56) void Chain::writePixels(std::ostream & strm) const
57) {
58)   std::vector<Pixel>::const_iterator itP;
59)   for (itP = mPixels.begin(); itP != mPixels.end(); ++itP)
60)     itP->writePixel(strm);
61) }
62)