Skip to content

Commit b089a6f

Browse files
committed
add hasTags,
see #232
1 parent ba71014 commit b089a6f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Common.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export lsTypes, lsfTypes
99
export lsWho, lsfWho
1010
export *
1111
export findClosestTimestamp, findVariableNearTimestamp
12+
export hasTags
1213

1314
*(a::Symbol, b::AbstractString)::Symbol = Symbol(string(a,b))
1415

@@ -403,3 +404,17 @@ function findVariableNearTimestamp(dfg::AbstractDFG,
403404

404405
return RET
405406
end
407+
408+
409+
"""
410+
$SIGNATURES
411+
412+
Determine if a variable or factor has all the tags listed in `stags`.
413+
"""
414+
function hasTags(dfg::InMemoryDFGTypes,
415+
sym::Symbol,
416+
stags::Vector{Symbol})::Bool
417+
#
418+
alltags = union( (ls(dfg, sym) .|> x->tags(getFactor(dfg,x)))...)
419+
length(filter(x->x in alltags, stags)) == length(stags)
420+
end

0 commit comments

Comments
 (0)