Skip to content
Snippets Groups Projects
Commit dfa346eb authored by Miroslav Kratochvil's avatar Miroslav Kratochvil :bicyclist:
Browse files

add unwrapping model modifications for Serialized model

parent 25d5eb53
No related branches found
No related tags found
No related merge requests found
"""
_serialized_change_unwrap(fn::Symbol)
Creates a simple wrapper structure that calls a function transparently on the
internal precached model. Internal type is returned (because this would break
the consistency of serialization).
"""
macro _serialized_change_unwrap(fn::Symbol)
docstring = """
$fn(model::Serialized, ...)
Calls [$fn](@ref) of the internal serialized model type.
Returns the modified un-serialized model.
"""
:(@doc $docstring $fn(model::Serialized, args...; kwargs...) =
$fn(unwrap_serialized(model), args...; kwargs...))
end
# this just generates the necessary wrappers
@_serialized_change_unwrap change_bound
@_serialized_change_unwrap change_bounds
@_serialized_change_unwrap add_reaction
@_serialized_change_unwrap remove_reaction
@_serialized_change_unwrap remove_reactions
@_serialized_change_unwrap remove_metabolite
@_serialized_change_unwrap remove_metabolites
"""
unwrap_serialized(model::Serialized)
Returns the model stored in the serialized structure.
"""
function unwrap_serialized(model::Serialized)
precache!(model)
model.m
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment