source: to-imperative/trunk/runtime/rf_result.hh @ 147

Last change on this file since 147 was 147, checked in by orlov, 18 years ago

First working version after rewriting pxx

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1//
2// Copyright (C) 2000 Refal+ Development Group
3//
4// Refal+ is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation; either version 2 of the License, or
7// (at your option) any later version.
8//
9// Refal+ is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Refal+; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17//
18// $Source$
19// $Revision: 147 $
20// $Date: 2002-09-01 00:16:12 +0000 (Sun, 01 Sep 2002) $
21// Author: Andrey Slepuhin <pooh@msu.ru>
22
23#ifndef __rf_result_hh__
24#define __rf_result_hh__
25
26#include "rf_expr.hh"
27#include "rf_stack.hh"
28
29namespace rfrt
30{
31
32class Result
33{
34
35  friend class Stack ;
36
37private:
38
39  Expr* expr_ptr ;
40
41  Result (Result const&)
42  {
43    FATAL("Private constructor Result(Result const&) should never be called");
44  }
45
46  Result& operator = (Result const&)
47  {
48    FATAL("Private operator = Result(Result const&) should never be called");
49    return *this;
50  }
51
52public:
53
54  Result ()
55  {
56    expr_ptr = stack.top++;
57    expr_ptr->set_mem_chunk(null);
58  }
59
60  ~Result ()
61  {}
62
63  Result& operator = (Expr const& _expr)
64  {
65    new(expr_ptr) Expr(_expr);
66    return *this;
67  }
68
69};
70
71inline Stack& Stack::operator , (Result& _res)
72{
73  if (_res.expr_ptr != top) {
74    new(_res.expr_ptr) Expr(top);
75  }
76  top++;
77  return *this;
78}
79
80}
81
82#endif // __rf_result_hh__
Note: See TracBrowser for help on using the repository browser.