CXXR (C++ R)
Expression.h
Go to the documentation of this file.
1 /*CXXR $Id: Expression.h 1351 2013-03-08 15:12:28Z 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 
17 /*
18  * R : A Computer Language for Statistical Data Analysis
19  * Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
20  * Copyright (C) 1999-2006 The R Development Core Team.
21  *
22  * This program is free software; you can redistribute it and/or modify
23  * it under the terms of the GNU General Public License as published by
24  * the Free Software Foundation; either version 2.1 of the License, or
25  * (at your option) any later version.
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  *
32  * You should have received a copy of the GNU General Public License
33  * along with this program; if not, a copy is available at
34  * http://www.r-project.org/Licenses/
35  */
36 
41 #ifndef EXPRESSION_H
42 #define EXPRESSION_H
43 
44 #include "CXXR/PairList.h"
45 
46 #ifdef __cplusplus
47 
48 #include <boost/serialization/access.hpp>
49 #include <boost/serialization/nvp.hpp>
50 
51 namespace CXXR {
61  class Expression : public ConsCell {
62  public:
72  explicit Expression(RObject* cr = 0, PairList* tl = 0,
73  const RObject* tg = 0)
74  : ConsCell(LANGSXP, cr, tl, tg)
75  {}
76 
81  Expression(const Expression& pattern)
82  : ConsCell(pattern)
83  {}
84 
89  static const char* staticTypeName()
90  {
91  return "language";
92  }
93 
94  // Virtual functions of RObject:
95  Expression* clone() const;
97  const char* typeName() const;
98  private:
99  friend class boost::serialization::access;
100  // Declared private to ensure that Expression objects are
101  // allocated only using 'new':
102  ~Expression() {}
103 
104  // Not implemented yet. Declared to prevent
105  // compiler-generated versions:
106  Expression& operator=(const Expression&);
107 
108  template<class Archive>
109  void serialize(Archive & ar, const unsigned int version) {
110  ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(ConsCell);
111  }
112  };
113 } // namespace CXXR
114 
115 BOOST_CLASS_EXPORT_KEY(CXXR::Expression)
116 
117 
119  extern CXXR::GCRoot<> R_CurrentExpr;
120 
121 extern "C" {
122 #endif
123 
129 
141  SEXP Rf_lcons(SEXP cr, SEXP tl);
142 
149 #ifdef __cplusplus
150 }
151 #endif
152 
153 #endif /* EXPRESSION_H */