[a32b204] | 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 | // |
---|
[3c13c03] | 7 | // Alternative.h -- |
---|
[a32b204] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Sat May 16 23:45:43 2015 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[6b0b624] | 12 | // Last Modified On : Sat Jul 22 09:36:36 2017 |
---|
| 13 | // Update Count : 3 |
---|
[3c13c03] | 14 | // |
---|
[a32b204] | 15 | |
---|
[6b0b624] | 16 | #pragma once |
---|
[51b7345] | 17 | |
---|
[ea6332d] | 18 | #include <iosfwd> // for ostream |
---|
[bd4f2e9] | 19 | #include <vector> // for vector |
---|
[ea6332d] | 20 | |
---|
| 21 | #include "Cost.h" // for Cost |
---|
| 22 | #include "TypeEnvironment.h" // for TypeEnvironment |
---|
| 23 | |
---|
| 24 | class Expression; |
---|
[51b7345] | 25 | |
---|
| 26 | namespace ResolvExpr { |
---|
[a32b204] | 27 | struct Alternative { |
---|
| 28 | Alternative(); |
---|
| 29 | Alternative( Expression *expr, const TypeEnvironment &env, const Cost &cost ); |
---|
| 30 | Alternative( Expression *expr, const TypeEnvironment &env, const Cost &cost, const Cost &cvtCost ); |
---|
| 31 | Alternative( const Alternative &other ); |
---|
| 32 | Alternative &operator=( const Alternative &other ); |
---|
[aefcc3b] | 33 | Alternative( Alternative && other ); |
---|
| 34 | Alternative &operator=( Alternative && other ); |
---|
[a32b204] | 35 | ~Alternative(); |
---|
[3c13c03] | 36 | |
---|
[50377a4] | 37 | void print( std::ostream &os, Indenter indent = {} ) const; |
---|
[3c13c03] | 38 | |
---|
[62194cb] | 39 | /// Returns the stored expression, but released from management of this Alternative |
---|
| 40 | Expression* release_expr() { |
---|
| 41 | Expression* tmp = expr; |
---|
| 42 | expr = nullptr; |
---|
| 43 | return tmp; |
---|
| 44 | } |
---|
| 45 | |
---|
[a32b204] | 46 | Cost cost; |
---|
| 47 | Cost cvtCost; |
---|
| 48 | Expression *expr; |
---|
| 49 | TypeEnvironment env; |
---|
| 50 | }; |
---|
[bd4f2e9] | 51 | |
---|
| 52 | typedef std::vector< Alternative > AltList; |
---|
| 53 | |
---|
| 54 | /// Moves all elements from src to the end of dst |
---|
| 55 | void splice( AltList& dst, AltList& src ); |
---|
| 56 | |
---|
| 57 | /// Moves all elements from src to the beginning of dst |
---|
| 58 | void spliceBegin( AltList& dst, AltList& src ); |
---|
[51b7345] | 59 | } // namespace ResolvExpr |
---|
| 60 | |
---|
[a32b204] | 61 | // Local Variables: // |
---|
| 62 | // tab-width: 4 // |
---|
| 63 | // mode: c++ // |
---|
| 64 | // compile-command: "make install" // |
---|
| 65 | // End: // |
---|