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

Last change on this file since 411 was 411, checked in by pooh, 18 years ago
  • Continued code cleanup and documentation.
  • 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: 411 $
20// $Date: 2003-01-21 17:32:45 +0000 (Tue, 21 Jan 2003) $
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
71#if 0
72inline Stack& Stack::operator , (Result& _res)
73{
74  if (_res.expr_ptr != top) {
75    new(_res.expr_ptr) Expr(top);
76  }
77  top++;
78  return *this;
79}
80#endif
81
82}
83
84#endif // __rf_result_hh__
Note: See TracBrowser for help on using the repository browser.