Skip to content

Commit 8ecf0af

Browse files
authored
Merge pull request #83 from JuliaRobotics/maintenance/3Q19/hasfactor
add features from IIF
2 parents 04ae091 + b47099b commit 8ecf0af

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/NeedsAHome.jl

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
export hasFactor, hasVariable, isInitialized
2+
export hasFactor, hasVariable, isInitialized, getFactorFunction, isVariable, isFactor
33

44
"""
55
$SIGNATURES
@@ -38,3 +38,37 @@ end
3838
function isInitialized(dfg::G, label::Symbol; key::Symbol=:default)::Bool where G <: AbstractDFG
3939
return isInitialized(getVariable(dfg, label), key=key)
4040
end
41+
42+
43+
"""
44+
$SIGNATURES
45+
46+
Return whether `sym::Symbol` represents a variable vertex in the graph.
47+
"""
48+
isVariable(dfg::G, sym::Symbol) where G <: AbstractDFG = hasVariable(dfg, sym)
49+
50+
"""
51+
$SIGNATURES
52+
53+
Return whether `sym::Symbol` represents a factor vertex in the graph.
54+
"""
55+
isFactor(dfg::G, sym::Symbol) where G <: AbstractDFG = hasFactor(dfg, sym)
56+
57+
"""
58+
$SIGNATURES
59+
60+
Return reference to the user factor in `<:AbstractDFG` identified by `::Symbol`.
61+
"""
62+
getFactorFunction(fcd::GenericFunctionNodeData) = fcd.fnc.usrfnc!
63+
getFactorFunction(fc::DFGFactor) = getFactorFunction(getData(fc))
64+
function getFactorFunction(dfg::G, fsym::Symbol) where G <: AbstractDFG
65+
getFactorFunction(getFactor(dfg, fsym))
66+
end
67+
68+
69+
"""
70+
$SIGNATURES
71+
72+
Display and return to console the user factor identified by tag name.
73+
"""
74+
showFactor(fgl::G, fsym::Symbol) where G <: AbstractDFG = @show getFactor(fgl,fsym)

0 commit comments

Comments
 (0)