1 /*
2  * RCntxtInterface.hpp
3  *
4  * Copyright (C) 2021 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant
7  * to the terms of a commercial license agreement with RStudio, then
8  * this program is licensed to you under the terms of version 3 of the
9  * GNU Affero General Public License. This program is distributed WITHOUT
10  * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
12  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
13  *
14  */
15 
16 #ifndef R_CONTEXT_INTERFACE_HPP
17 #define R_CONTEXT_INTERFACE_HPP
18 
19 #include "RSexp.hpp"
20 
21 namespace rstudio {
22 namespace r {
23 namespace context {
24 
25 // forward declare
26 class RCntxt;
27 
28 // RCntxtInterface represents the subset of members of the RCNTXT struct which
29 // are accessed elsewhere; it may be safely extended with other members.
30 class RCntxtInterface
31 {
32 public:
33    // accessors for RCNTXT entries
34    virtual SEXP callfun() const       = 0;
35    virtual int callflag() const       = 0;
36    virtual int evaldepth() const      = 0;
37    virtual SEXP call() const          = 0;
38    virtual SEXP srcref() const        = 0;
39    virtual SEXP cloenv() const        = 0;
40 
41    // computed properties
42    virtual bool isNull() const        = 0;
43    virtual RCntxt nextcontext() const = 0;
44 
~RCntxtInterface()45    virtual ~RCntxtInterface() {}
46 };
47 
48 } // namespace context
49 } // namespace r
50 } // namespace rstudio
51 
52 #endif
53