Skip to content

Commit bba7bb0

Browse files
committed
more ls for types
1 parent b26b493 commit bba7bb0

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/Common.jl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,38 @@ function lsTypes(dfg::G)::Dict{Symbol, Vector{String}} where G <: AbstractDFG
232232
end
233233

234234

235+
function ls(dfg::G, ::Type{T}; solveKey::Symbol=:default) where {G <: AbstractDFG, T <: InferenceVariable}
236+
xx = getVariables(dfg)
237+
mask = getVariableType.(xx, solveKey=solveKey) .|> typeof .== T
238+
vxx = view(xx, mask)
239+
map(x->x.label, vxx)
240+
end
241+
242+
243+
function ls(dfg::G, ::Type{T}) where {G <: AbstractDFG, T <: FunctorInferenceType}
244+
xx = getFactors(dfg)
245+
names = getfield.(typeof.(getFactorType.(xx)), :name) .|> Symbol
246+
vxx = view(xx, names .== Symbol(T))
247+
map(x->x.label, vxx)
248+
end
249+
250+
function lsf(dfg::G, ::Type{T}) where {G <: AbstractDFG, T <: FunctorInferenceType}
251+
ls(dfg, T)
252+
end
253+
254+
235255
"""
236256
$(SIGNATURES)
237257
Gives back all factor labels that fit the bill:
238258
lsWho(dfg, :Pose3)
259+
260+
Dev Notes
261+
- Cloud versions will benefit from less data transfer
262+
- `ls(dfg::C, ::T) where {C <: CloudDFG, T <: ..}`
263+
264+
Related
265+
266+
ls, lsf, lsfPriors
239267
"""
240268
function lsWho(dfg::AbstractDFG, type::Symbol; solveKey::Symbol=:default)::Vector{Symbol}
241269
vars = getVariables(dfg)
@@ -252,6 +280,14 @@ end
252280
$(SIGNATURES)
253281
Gives back all factor labels that fit the bill:
254282
lsfWho(dfg, :Point2Point2)
283+
284+
Dev Notes
285+
- Cloud versions will benefit from less data transfer
286+
- `ls(dfg::C, ::T) where {C <: CloudDFG, T <: ..}`
287+
288+
Related
289+
290+
ls, lsf, lsfPriors
255291
"""
256292
function lsfWho(dfg::AbstractDFG, type::Symbol)::Vector{Symbol}
257293
facs = getFactors(dfg)

0 commit comments

Comments
 (0)