Viskores  1.0
RuntimeDeviceOption.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_cont_internal_RuntimeDeviceOption_h
19 #define viskores_cont_internal_RuntimeDeviceOption_h
20 
22 
25 
26 namespace viskores
27 {
28 namespace cont
29 {
30 namespace internal
31 {
32 
33 enum class RuntimeDeviceOptionSource
34 {
35  COMMAND_LINE,
36  ENVIRONMENT,
37  IN_CODE,
38  NOT_SET
39 };
40 
41 class VISKORES_CONT_EXPORT RuntimeDeviceOption
42 {
43 public:
48  VISKORES_CONT RuntimeDeviceOption(const viskores::Id& index, const std::string& envName);
49 
50  VISKORES_CONT virtual ~RuntimeDeviceOption() noexcept;
51 
56  VISKORES_CONT void Initialize(const option::Option* options);
57 
59  VISKORES_CONT void SetOptionFromEnvironment();
60 
62  VISKORES_CONT void SetOptionFromOptionsArray(const option::Option* options);
63 
65  VISKORES_CONT void SetOption(const viskores::Id& value);
66 
67  VISKORES_CONT viskores::Id GetValue() const;
68  VISKORES_CONT RuntimeDeviceOptionSource GetSource() const;
69  VISKORES_CONT bool IsSet() const;
70 
71 private:
72  const viskores::Id Index;
73  const std::string EnvName;
74  RuntimeDeviceOptionSource Source;
75  viskores::Id Value;
76 };
77 
78 } // namespace viskores::cont::internal
79 } // namespace viskores::cont
80 } // namespace viskores
81 
82 #endif // viskores_cont_internal_RuntimeDeviceOption_h
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
Index
int Index
Definition: ChooseCudaDevice.h:95
OptionParserArguments.h
OptionParser.h
viskores::cont::Initialize
InitializeResult Initialize(int &argc, char *argv[], InitializeOptions opts=InitializeOptions::None)
Initialize the Viskores library, parsing arguments when provided:
viskores_cont_export.h