MyraMath
Options.h
1 // ========================================================================= //
2 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
3 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
4 // ========================================================================= //
5 
6 #ifndef MYRAMATH_JOBGRAPH_OPTIONS_H
7 #define MYRAMATH_JOBGRAPH_OPTIONS_H
8 
9 
10 #include <myramath/MYRAMATH_EXPORT.h>
13 
14 namespace myra {
15 
16 // Forward declarations.
17 class ProgressMeter;
18 
19 namespace jobgraph {
20 
21 class MYRAMATH_EXPORT Options
22  {
23  public:
24 
26  static int default_threading_layer();
27  const static int THREADING_LAYER_OMP = 1;
28  const static int THREADING_LAYER_SERIAL = 0;
29  static int sanitize(int in_threading_layer);
30 
33 
35  int nthreads;
36 
39 
41  Options();
42 
44  static Options create()
45  { return Options(); }
46 
48  Options& set_threading_layer(int in_threading_layer)
49  { threading_layer = sanitize(in_threading_layer); return *this; }
50 
51  Options& set_nthreads(int in_nthreads)
52  { nthreads = in_nthreads; return *this; }
53 
54  Options& set_progress(const ProgressMeter& in_progress)
55  { progress = in_progress; return *this; }
56 
57  };
58 
59 } // namespace jobgraph
60 } // namespace myra
61 
62 #endif
int threading_layer
Which threading_layer to use?
Definition: Options.h:32
int nthreads
How many threads to use?
Definition: Options.h:35
Definition: Options.h:21
Options & set_threading_layer(int in_threading_layer)
Named constructor idiom, setters.
Definition: Options.h:48
Definition: syntax.dox:1
Interface for measuring progress via callbacks. Wraps an underlying polymorphic ProgressMeterBase.
Definition: ProgressMeter.h:55
Returns maximum number of threads, by probing the environment for MYRAMATH_NUM_THREADS.
ProgressMeter progress
Enable progress meter?
Definition: Options.h:38
static Options create()
Named constructor idiom, creates default options.
Definition: Options.h:44
Interface type for progress measurement and control within JobGraph&#39;s.