CXXR (C++ R)
S11nScope.hpp
Go to the documentation of this file.
1 /*CXXR $Id: S11nScope.hpp 1392 2013-07-02 10:19:57Z arr $
2  *CXXR
3  *CXXR This file is part of CXXR, a project to refactor the R interpreter
4  *CXXR into C++. It may consist in whole or in part of program code and
5  *CXXR documentation taken from the R project itself, incorporated into
6  *CXXR CXXR (and possibly MODIFIED) under the terms of the GNU General Public
7  *CXXR Licence.
8  *CXXR
9  *CXXR CXXR is Copyright (C) 2008-13 Andrew R. Runnalls, subject to such other
10  *CXXR copyrights and copyright restrictions as may be stated below.
11  *CXXR
12  *CXXR CXXR is not part of the R project, and bugs and other issues should
13  *CXXR not be reported via r-bugs or other R project channels; instead refer
14  *CXXR to the CXXR website.
15  *CXXR */
16 
22 #ifndef S11NSCOPE_HPP
23 #define S11NSCOPE_HPP 1
24 
25 #include <map>
26 #include <boost/utility.hpp>
27 
28 namespace CXXR {
29  class GCNode;
30 
48  class S11nScope : public boost::noncopyable {
49  public:
52  S11nScope();
53 
54  ~S11nScope();
55 
65  static void defineRelocation(GCNode* from, GCNode* to);
66 
75  static GCNode* relocate(GCNode* from);
76  private:
77  static S11nScope* s_innermost;
78 
79  S11nScope* m_next;
80 
81  std::map<GCNode*, GCNode*> m_relocations;
82 
83  // Report out-of-sequence destructor call and abort program.
84  // (We can't use an exception here because it's called from a
85  // destructor.)
86  static void seqError();
87  };
88 } // namespace CXXR
89 
90 #endif // S11NSCOPE_HPP