NeighbourhoodOp(Dst, Src, Ext, Ngb) { foreach d, s, e in Dst, Src, Ext { Ngb.init(s.x, s.y, Src(s), Ext(e)); foreach n in Ngb.begin() .. Ngb.end() Ngb.next(n.x, n.y, Src(s + n), Ext(e + n)); Dst(d) = ngb.result(); } }
The requirements on the NgbT template parameter expressed as class definition are:
template<class DstValT, class SrcValT, class ExtValT> 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 v1, ExtValT v2); void next(int nx, int ny, SrcValT v1, ExtValT v2); 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):