6 #ifndef MYRAMATH_JOBGRAPH_LAMBDAJOBGRAPH_H 7 #define MYRAMATH_JOBGRAPH_LAMBDAJOBGRAPH_H 14 #include <myramath/MYRAMATH_EXPORT.h> 39 : lambda(in_lambda), n(
"LambdaJob") { }
43 : lambda(in_lambda), n(in_n) { }
60 virtual std::string
name()
const 65 { output.push_back(
JobID(0) ); }
69 { output.push_back(
JobID(0) ); }
73 {
return new Job(
this); }
76 virtual std::vector<::myra::Job*>
create()
77 {
return std::vector<::myra::Job*>(1,
new Job(
this)); }
80 virtual uint64_t
size()
const 100 virtual JobID id()
const 104 virtual void parents(
JobIDs& output)
const 108 virtual void children(
JobIDs& output)
const 112 virtual uint64_t execute()
113 { host->lambda();
return 1; }
116 virtual std::string
name()
const 128 template<
class Lambda>
132 template<
class Lambda>
virtual ~LambdaJobGraph()
Frees internal resources.
Definition: LambdaJobGraph.h:50
Abstraction to represent one node of a JobGraph.
Definition: Job.h:25
Abstraction to represent one node of a JobGraph.
Encapsulates a Lambda function into a JobGraph of a single Job.
Definition: LambdaJobGraph.h:26
virtual uint64_t n_work() const
Total "work" over all Job's of this JobGraph.
Definition: LambdaJobGraph.h:56
virtual std::string name() const
Returns a printable name for this JobGraph, for debugging.
Definition: LambdaJobGraph.h:60
virtual void begins(JobIDs &output) const
Enumerates the JobIDs of Job's that have no parents (where execution begins)
Definition: LambdaJobGraph.h:64
Type erasure class that wraps JobGraphBase, gives it value semantics.
Definition: JobGraph.h:64
virtual void ends(JobIDs &output) const
Enumerates the JobIDs of Job's that have no children (where execution ends)
Definition: LambdaJobGraph.h:68
Base/contract class for all other JobGraph's.
Definition: JobGraph.h:30
Abstraction for representing a directed acyclic graph of Job's.
virtual JobGraphBase * clone() const
Virtual copy constructor.
Definition: LambdaJobGraph.h:46
virtual std::vector<::myra::Job * > create()
Constructs all Job's in an implementation-defined manner.
Definition: LambdaJobGraph.h:76
LambdaJobGraph(const Lambda &in_lambda, const std::string &in_n)
Constructs from a Lambda and a name.
Definition: LambdaJobGraph.h:42
virtual Job * create(JobID j)
Constructs the Job corresponding to the given JobID.
Definition: LambdaJobGraph.h:72
Key type used to identify the Job's of a JobGraph.
Key type used to identify the Job's of a JobGraph.
Definition: JobID.h:60
JobGraph make_LambdaJobGraph(const Lambda &lambda)
Given a Lambda, returns a JobGraph that calls lambda() when execute()'d.
Definition: LambdaJobGraph.h:129
std::vector< JobID > JobIDs
Useful typedef.
Definition: JobID.h:118
LambdaJobGraph(const Lambda &in_lambda)
Constructs from a Lambda.
Definition: LambdaJobGraph.h:38
virtual uint64_t size() const
Returns 1.
Definition: LambdaJobGraph.h:80