source: src/ResolvExpr/ResolvMode.h @ f89a111

new-env
Last change on this file since f89a111 was 1d7b0a8, checked in by Aaron Moss <a3moss@…>, 6 years ago

Move AlternativeFinder? find flags to ResolvMode? struct

  • Property mode set to 100644
File size: 1.8 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// ResolvMode.h --
8//
9// Author           : Aaron B. Moss
10// Created On       : Mon Jun 11 13:28:00 2018
11// Last Modified By : Aaron B. Moss
12// Last Modified On : Mon Jun 11 13:28:00 2018
13// Update Count     : 1
14//
15
16#pragma once
17
18namespace ResolvExpr {
19        /// Flag set for resolution
20        struct ResolvMode {
21                const bool adjust;                       ///< Adjust array and function types to pointer types? [false]
22                const bool prune;            ///< Prune alternatives to min-cost per return type? [true]
23                const bool failFast;         ///< Fail on no resulting alternatives? [true]
24                const bool checkAssertions;  ///< Should assertions be checked? [false]
25
26        private:
27                constexpr ResolvMode(bool a, bool p, bool ff, bool ca)
28                        : adjust(a), prune(p), failFast(ff), checkAssertions(ca) {}
29
30        public:
31                /// Default settings
32                constexpr ResolvMode()
33                        : adjust(false), prune(true), failFast(true), checkAssertions(false) {}
34               
35                /// With adjust flag set; turns array and function types into equivalent pointers
36                static constexpr ResolvMode withAdjustment() { return { true, true, true, false }; }
37
38                /// With adjust flag set but prune unset; pruning ensures there is at least one alternative
39                /// per result type
40                static constexpr ResolvMode withoutPrune() { return { true, false, true, false }; }
41
42                /// With adjust and prune flags set but failFast unset; failFast ensures there is at least
43                /// one resulting alternative
44                static constexpr ResolvMode withoutFailFast() { return { true, true, false, false }; }
45        };
46} // namespace ResolvExpr
47
48// Local Variables: //
49// tab-width: 4 //
50// mode: c++ //
51// compile-command: "make install" //
52// End: //
Note: See TracBrowser for help on using the repository browser.