| [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
|
|---|
| [51b73452] | 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;
|
|---|
| [51b73452] | 25 |
|
|---|
| [f229fc2] | 26 | class GC;
|
|---|
| 27 |
|
|---|
| [51b73452] | 28 | namespace ResolvExpr {
|
|---|
| [a32b204] | 29 | struct Alternative {
|
|---|
| 30 | Alternative();
|
|---|
| 31 | Alternative( Expression *expr, const TypeEnvironment &env, const Cost &cost );
|
|---|
| 32 | Alternative( Expression *expr, const TypeEnvironment &env, const Cost &cost, const Cost &cvtCost );
|
|---|
| [68f9c43] | 33 | Alternative( const Alternative &other ) = default;
|
|---|
| 34 | Alternative &operator=( const Alternative &other ) = default;
|
|---|
| [3c13c03] | 35 |
|
|---|
| [50377a4] | 36 | void print( std::ostream &os, Indenter indent = {} ) const;
|
|---|
| [3c13c03] | 37 |
|
|---|
| [a32b204] | 38 | Cost cost;
|
|---|
| 39 | Cost cvtCost;
|
|---|
| [68f9c43] | 40 | Expression * expr;
|
|---|
| [a32b204] | 41 | TypeEnvironment env;
|
|---|
| 42 | };
|
|---|
| [bd4f2e9] | 43 |
|
|---|
| 44 | typedef std::vector< Alternative > AltList;
|
|---|
| 45 |
|
|---|
| 46 | /// Moves all elements from src to the end of dst
|
|---|
| 47 | void splice( AltList& dst, AltList& src );
|
|---|
| 48 |
|
|---|
| 49 | /// Moves all elements from src to the beginning of dst
|
|---|
| 50 | void spliceBegin( AltList& dst, AltList& src );
|
|---|
| [4a161be] | 51 |
|
|---|
| 52 | static inline std::ostream & operator<<(std::ostream & os, const ResolvExpr::Alternative & alt) {
|
|---|
| 53 | alt.print( os );
|
|---|
| 54 | return os;
|
|---|
| 55 | }
|
|---|
| [f229fc2] | 56 |
|
|---|
| 57 | const GC& operator<< ( const GC&, const Alternative& );
|
|---|
| [51b73452] | 58 | } // namespace ResolvExpr
|
|---|
| 59 |
|
|---|
| [a32b204] | 60 | // Local Variables: //
|
|---|
| 61 | // tab-width: 4 //
|
|---|
| 62 | // mode: c++ //
|
|---|
| 63 | // compile-command: "make install" //
|
|---|
| 64 | // End: //
|
|---|