Rev 32 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | |||
30 | Werner | 2 | #ifndef STAMP_H |
3 | #define STAMP_H |
||
4 | |||
5 | /** Stamp is the basic class for the FON field of a individual tree. |
||
6 | |||
7 | */ |
||
8 | class Stamp |
||
9 | { |
||
10 | public: |
||
11 | Stamp(); |
||
12 | ~Stamp(); |
||
13 | Stamp(const int sizex, const int sizey) { setup(sizex, sizey); } |
||
14 | /// get a full access pointer to internal data |
||
15 | float *data() { return m_data; } |
||
16 | /// get pointer to the element after the last element (iterator style) |
||
17 | const float *end() const { return &m_data[m_sizex*m_sizey]; } |
||
18 | /// get pointer to data item with indices x and y |
||
19 | float *data(const int x, const int y) { return m_data + index(x,y); } |
||
20 | /// get index (e.g. for data()[index]) for indices x and y |
||
21 | int index(const int x, const int y) const { return y*m_sizex + x; } |
||
22 | private: |
||
23 | void setup(const int sx, const int sy); |
||
24 | float *m_data; |
||
25 | int m_sizex; |
||
26 | int m_sizey; |
||
27 | }; |
||
28 | |||
29 | #endif // STAMP_H |