OpenStructure
Loading...
Searching...
No Matches
index.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// This file is part of the OpenStructure project <www.openstructure.org>
3//
4// Copyright (C) 2008-2020 by the OpenStructure authors
5// Copyright (C) 2003-2010 by the IPLT authors
6//
7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License as published by the Free
9// Software Foundation; either version 3.0 of the License, or (at your option)
10// any later version.
11// This library is distributed in the hope that it will be useful, but WITHOUT
12// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14// details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this library; if not, write to the Free Software Foundation, Inc.,
18// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19//------------------------------------------------------------------------------
20
21/*
22 value holder index
23
24 Author: Ansgar Philippsen
25*/
26
27#ifndef IMG_INDEX_H
28#define IMG_INDEX_H
29
30#include <iosfwd>
31
32#include <ost/base.hh>
33#include <ost/img/size.hh>
34
35namespace ost { namespace img { namespace image_state {
36
37// encapsulated unsigned integer triplet
38/*
39 provides a compact mean to adress values in a ValueHolder
40*/
42 Index(unsigned int uu,unsigned int vv, unsigned int ww):
43 u(uu),v(vv),w(ww)
44 {}
45
46 bool equal(const Index& i) const;
47
48 unsigned int u,v,w;
49};
50
51DLLEXPORT_OST_IMG_BASE bool operator==(const Index& i1, const Index& i2);
52DLLEXPORT_OST_IMG_BASE bool operator!=(const Index& i1, const Index& i2);
53
54DLLEXPORT_OST_IMG_BASE std::ostream& operator<<(std::ostream& out, const Index& i);
55
57public:
58 IndexIterator(int w, int h, int d);
60
61 bool AtStart() const;
62 bool AtEnd() const;
63
66
67 // prefix
69 // postfix
71 // prefix
73 // postfix
75
76 operator Index() const;
77private:
78 unsigned int w_,h_,d_;
79 Index indx_;
80 bool at_end_;
81
82 void increment();
83 void decrement();
84};
85
86}}} // namespaces
87
88#endif
class encapsulating 1D to 3D size
Definition size.hh:39
IndexIterator(int w, int h, int d)
#define DLLEXPORT_OST_IMG_BASE
DLLEXPORT_OST_IMG_BASE std::ostream & operator<<(std::ostream &out, const Index &i)
DLLEXPORT_OST_IMG_BASE bool operator!=(const Index &i1, const Index &i2)
DLLEXPORT_OST_IMG_BASE bool operator==(const Index &i1, const Index &i2)
Definition base.dox:1
Index(unsigned int uu, unsigned int vv, unsigned int ww)
Definition index.hh:42
bool equal(const Index &i) const