OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
InSituFlags.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "Shared/EnumBitmaskOps.h"
20 
21 namespace heavyai {
22 
23 enum class InSituFlags {
24  kInSitu = 1u << 0,
25  kNonInSitu = 1u << 1,
27 };
28 
29 } // namespace heavyai
30 
32 
33 namespace heavyai {
34 
35 // Needs to be defined after the ENABLE_BITMASK_OPS call above
37  public:
39  : insitu_flags_{insitu_flags} {}
40 
41  InSituFlags getInSituFlags() const { return insitu_flags_; }
42 
43  bool isForcedNonInSitu() const {
44  return (insitu_flags_ & InSituFlags::kForcedNonInSitu) ==
46  }
47 
48  bool isInSitu() const { return insitu_flags_ == InSituFlags::kInSitu; }
49 
50  bool isNonInSitu() const {
51  return any_bits_set(insitu_flags_ & InSituFlags::kNonInSitu);
52  }
53 
54  bool couldRunInSitu() const {
55  return any_bits_set(insitu_flags_ & InSituFlags::kInSitu);
56  }
57 
58  protected:
60 };
61 
62 } // namespace heavyai
InSituFlags getInSituFlags() const
Definition: InSituFlags.h:41
std::enable_if_t< EnableBitmaskOps< T >::enable, bool > constexpr any_bits_set(T t)
ENABLE_BITMASK_OPS(heavyai::InSituFlags)
InSituFlagsOwnerInterface(const InSituFlags insitu_flags)
Definition: InSituFlags.h:38