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