• Ell's avatar
    operation, graph: add {GeglOperationClass,GeglNode}::cache-policy · 7f24430c
    Ell authored
    Caching of operation output is currently controlled by the
    GeglOperationClass::no_cache field on a per-operation-class basis,
    and by the GeglNode::dont-cache property on a per-node basis.
    However, since these fields are boolean, they prevent us from
    automating the decision of whether an op should be cached, or,
    altenatively, they don't provide sufficient control over this
    Instead, add a ternary GeglCachePolicy enum, which can be one of
    AUTO, NEVER, or ALWAYS, and add a GeglOperationClass::cache_policy
    field, and a GeglNode::cache-policy property, which use this type.
    When the cache-policy property of a node in NEVER or ALWAYS, its
    result isn't/is cached, respectively; when it's AUTO, the deicision
    depends on the operation:  When the cache_policy field of the
    operation class is NEVER or ALWAYS, the result isn't/is cached,
    respectively; when it's AUTO, the result is cached only if the
    operation implements get_cached_region().  Both of these field are
    set to AUTO by default -- the idea is that we generally don't want
    to implicitly cache results, unless they correspond to a different
    region than the ROI.
    The existing dont-cache/no_cache fields are deprecated, but are
    still used for now: when GeglNode::cache-policy is AUTO and
    GeglNode::dont-cache is TRUE, the node isn't cached; when
    GeglOperationClass::cache_policy is AUTO and
    GeglOperationClass::no_cache is TRUE, the operation isn't cached.
    Like GeglNode::dont-cache, GeglNode::cache-policy is inherited by
    the node's children.