Rcpp Version 1.0.9
interface.h
Go to the documentation of this file.
1 // Copyright (C) 2013 Romain Francois
2 //
3 // This file is part of Rcpp.
4 //
5 // Rcpp is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // Rcpp is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
17 
18 #ifndef Rcpp_macros_interface_h
19 #define Rcpp_macros_interface_h
20 
21 #define RCPP_GENERATE_CTOR_ASSIGN(__CLASS__) \
22 typedef StoragePolicy<__CLASS__> Storage ; \
23 typedef AttributeProxyPolicy<__CLASS__> AttributePolicy ; \
24 RCPP_CTOR_ASSIGN(__CLASS__)
25 
26 #define RCPP_CTOR_ASSIGN(__CLASS__) \
27 __CLASS__( const __CLASS__& other ){ \
28  Storage::copy__(other) ; \
29 } \
30 __CLASS__& operator=(const __CLASS__& rhs) { \
31  return Storage::copy__(rhs) ; \
32 } \
33 template <typename Proxy> \
34 __CLASS__( const GenericProxy<Proxy>& proxy ){ \
35  Storage::set__( proxy.get() ) ; \
36 }
37 
38 #define RCPP_CTOR_ASSIGN_WITH_BASE(__CLASS__) \
39  __CLASS__( const __CLASS__& other ) : Base(other) { \
40 } \
41 __CLASS__& operator=(const __CLASS__& rhs) { \
42  return Storage::copy__(rhs) ; \
43 } \
44 template <typename Proxy> \
45 __CLASS__( const GenericProxy<Proxy>& proxy ){ \
46  Storage::set__( proxy.get() ) ; \
47 }
48 
49 #define RCPP_API_CLASS(__CLASS__) \
50 template < template <class> class StoragePolicy > class __CLASS__ : \
51  public StoragePolicy<__CLASS__<StoragePolicy> >, \
52  public SlotProxyPolicy<__CLASS__<StoragePolicy> >, \
53  public AttributeProxyPolicy<__CLASS__<StoragePolicy> >, \
54  public RObjectMethods< __CLASS__<StoragePolicy> >
55 
56 #endif