Rcpp Version 1.0.14
Loading...
Searching...
No Matches
Module_Add_Property.h
Go to the documentation of this file.
1// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
2//
3// Module_Add_Property.h: Rcpp R/C++ interface class library -- Rcpp modules
4//
5// Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois
6//
7// This file is part of Rcpp.
8//
9// Rcpp is free software: you can redistribute it and/or modify it
10// under the terms of the GNU General Public License as published by
11// the Free Software Foundation, either version 2 of the License, or
12// (at your option) any later version.
13//
14// Rcpp is distributed in the hope that it will be useful, but
15// WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17// GNU General Public License for more details.
18//
19// You should have received a copy of the GNU General Public License
20// along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
21
22#ifndef Rcpp_Module_Add_Property_h
23#define Rcpp_Module_Add_Property_h
24
25 template <typename PROP>
26 self& property( const char* name_, PROP (Class::*GetMethod)(void), const char* docstring = 0){
27 AddProperty( name_, new CppProperty_GetMethod<Class,PROP>(GetMethod, docstring) ) ;
28 return *this ;
29 }
30
31 template <typename PROP>
32 self& property( const char* name_, PROP (Class::*GetMethod)(void) const, const char* docstring = 0){
33 AddProperty( name_, new CppProperty_GetConstMethod<Class,PROP>(GetMethod, docstring) ) ;
34 return *this ;
35 }
36
37 template <typename PROP>
38 self& property( const char* name_, PROP (*GetMethod)(Class*), const char* docstring ){
39 AddProperty( name_, new CppProperty_GetPointerMethod<Class,PROP>(GetMethod,docstring) ) ;
40 return *this ;
41 }
42
43
44 template <typename PROP>
45 self& property( const char* name_, PROP (Class::*GetMethod)(void), void (Class::*SetMethod)(PROP), const char* docstring = 0){
46 AddProperty(
47 name_,
48 new CppProperty_GetMethod_SetMethod<Class,PROP>(GetMethod, SetMethod, docstring)
49 ) ;
50 return *this ;
51 }
52 template <typename PROP>
53 self& property( const char* name_, PROP (Class::*GetMethod)(void) const, void (Class::*SetMethod)(PROP), const char* docstring = 0){
54 AddProperty(
55 name_,
56 new CppProperty_GetConstMethod_SetMethod<Class,PROP>(GetMethod, SetMethod, docstring)
57 ) ;
58 return *this ;
59 }
60
61
62 template <typename PROP>
63 self& property( const char* name_, PROP (Class::*GetMethod)(void), void (*SetMethod)(Class*,PROP), const char* docstring = 0 ){
64 AddProperty(
65 name_,
66 new CppProperty_GetMethod_SetPointer<Class,PROP>(GetMethod, SetMethod, docstring )
67 ) ;
68 return *this ;
69 }
70 template <typename PROP>
71 self& property( const char* name_, PROP (Class::*GetMethod)(void) const , void (*SetMethod)(Class*,PROP), const char* docstring = 0 ){
72 AddProperty(
73 name_,
74 new CppProperty_GetConstMethod_SetPointer<Class,PROP>(GetMethod, SetMethod, docstring)
75 ) ;
76 return *this ;
77 }
78
79
80 template <typename PROP>
81 self& property( const char* name_, PROP (*GetMethod)(Class*), void (Class::*SetMethod)(PROP), const char* docstring = 0 ){
82 AddProperty(
83 name_,
84 new CppProperty_GetPointer_SetMethod<Class,PROP>(GetMethod, SetMethod, docstring)
85 ) ;
86 }
87
88 template <typename PROP>
89 self& property( const char* name_, PROP (*GetMethod)(Class*), void (*SetMethod)(Class*,PROP), const char* docstring = 0 ){
90 AddProperty(
91 name_,
92 new CppProperty_GetPointer_SetPointer<Class,PROP>(GetMethod, SetMethod, docstring)
93 ) ;
94 return *this ;
95 }
96
97
98#endif
self & property(const char *name_, PROP(Class::*GetMethod)(void), const char *docstring=0)