Turi Create
4.0
|
#include <core/storage/lazy_eval/lazy_eval_operation_dag.hpp>
Public Member Functions | |
future_type * | add_value (value_type *value) |
future_type * | add_operation (operation_type *operation, const std::vector< future_type *> &parents) |
std::shared_ptr< value_type > | make_eager (size_t vertex_id) |
void | mark_for_deletion (size_t vertex_id) |
void | uncache (size_t vertex_id) |
void | cleanup (bool avoid_instantiation=false) |
~lazy_eval_operation_dag () | |
destructor | |
The Lazy Evaluation Operation DAG is a directed acyclic graph connecting immutable objects of type T with operations, and also provide lazy evaluation primitives to provide object computation at any point in the tree.
Using the lazy_eval_operation_dag system simply requires the user to implement a collection of operations, each inheriting from lazy_eval_operation_base<T>. For instance, we can define the following multiply, increment, and set_val lazy operations on integers.
To create a sequence of lazy operations simply involves the use of the add_operation() function. Each call to add_operation is lazy, and returns a future object.
We can then evaluate values with the operator() to compute the DAG.
Definition at line 21 of file lazy_eval_operation_dag.hpp.
|
inline |
Creates a new entry in the dependency tree by creating a future which corresponds to calling the provided operation on the parents.
Deleting the returned future pointer will mark the corresponding entry in the DAG for deletion.
Definition at line 213 of file lazy_eval_operation_dag.hpp.
|
inline |
Adds a fixed value to the DAG. The returned future pointer will always be available efficiently, Deleting the returned future pointer will mark the corresponding entry in the DAG for deletion.
Definition at line 190 of file lazy_eval_operation_dag.hpp.
|
inline |
Attempts to delete all vertices that were marked for deletion (see mark_for_deletion()). Note that not all marked vertices may be deleted as some vertices (for instance, in the middle of a chain of operations) cannot be deleted safely. This may result in the making eager of certain vertices to ensure that referenced vertices can always be constructed.
avoid_instantiation | Cancel the deletion if it involves instantiating an as yet, uninstantiated vertex. |
Definition at line 303 of file lazy_eval_operation_dag.hpp.
|
inline |
Computes and caches a particular entry in the graph
Definition at line 236 of file lazy_eval_operation_dag.hpp.
|
inline |
Marks the vertex for deletion. Deletion will only occur on a call to cleanup()
Definition at line 271 of file lazy_eval_operation_dag.hpp.
|
inline |
If the vertex value is cached, this will force it to be uncached.
Definition at line 284 of file lazy_eval_operation_dag.hpp.