NeighbourhoodOp(Dst, Src, Ngb)
{
foreach d, s in Dst, Src {
Ngb.init(s.x, s.y, Src(s));
foreach n in Ngb.begin() .. Ngb.end()
Ngb.next(n.x, n.y, Src(s + n));
Dst(d) = ngb.result();
}
}
The requirements on the NgbT template parameter expressed as class definition are:
template<class DstValT, class SrcValT>
class NgbT
{
public:
typedef HxTagCnum IteratorCategory;
typedef HxTag1Phase PhaseCategory;
typedef HxCnum CnumType;
NgbT(HxTagList& tags);
~NgbT();
HxSizes size();
CnumType begin();
CnumType end();
void init(int ix, int iy, SrcValT value);
void next(int nx, int ny, SrcValT value);
DstValT result() const;
static HxString className();
};
The Requirements on CnumType expressed as a class definition are:
class CnumType
{
public:
CnumType();
CnumType(const CnumType& rhs);
CnumType& operator=(const CnumType& rhs);
int x();
int y();
int z();
void inc();
bool operator!=(const CnumType& rhs);
};
Example(s):
1.2.12 written by Dimitri van Heesch,
© 1997-2001