Skip to content

Commit dd94206

Browse files
committed
begin wrapping iterator
1 parent bb6ba05 commit dd94206

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/SuiteSparseGraphBLAS.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ include("misc.jl")
9090
include("asjulia.jl")
9191
# include("spmgb/sparsemat.jl")
9292
include("mmread.jl")
93+
include("iterator.jl")
9394

9495
export SparseArrayCompat
9596
export LibGraphBLAS

src/iterator.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
struct GBIterator{O}
2+
p::Ref{LibGraphBLAS.GxB_Iterator}
3+
end
4+
gbpointer(I::GBIterator) = I.p[]
5+
6+
function GBIterator(bycol=true) # this should be removed eventually. We always want an attached one.
7+
i = Ref{LibGraphBLAS.GxB_Iterator}()
8+
@wraperror LibGraphBLAS.GxB_Iterator_new(i)
9+
return GBIterator{}(finalizer(iter) do ref
10+
@wraperror LibGraphBLAS.GxB_Iterator_free(ref)
11+
end)
12+
end
13+
14+
function attach(I::GBIterator, A::AbstractGBArray; desc = nothing, itercolumns)
15+
desc = _handledescriptor(desc)
16+
@wraperror LibGraphBLAS.GxB_Iterator_attach(gbpointer(I), gbpointer(A), desc)
17+
end
18+

0 commit comments

Comments
 (0)