Skip to content

Commit 73f7de3

Browse files
committed
update testRcppClass as well to cleanly build without NOTES or WARNINGS
1 parent be8002c commit 73f7de3

File tree

6 files changed

+47
-17
lines changed

6 files changed

+47
-17
lines changed

inst/unitTests/testRcppClass/DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ Type: Package
33
Title: Some examples using Rcpp classes and loadModule()
44
Version: 0.1
55
Date: 2012-04-06
6-
Author: JMC
7-
Maintainer: <[email protected]>
6+
Author: John Chambers
7+
Maintainer: John Chambers <[email protected]>
88
Description: Some examples from the Rcpp Modules documentation, with
99
load-time creation of classes that extend C++ classes and with
1010
explicit loading of some objects.
1111
License: GPL(>=2)
1212
LazyLoad: yes
13-
Depends: R (>= 2.15.0), Rcpp, methods
13+
Depends: R (>= 2.15.0)
1414
Imports: Rcpp (>= 0.8.5), methods
1515
LinkingTo: Rcpp
1616
Packaged: 2012-04-14 18:42:28 UTC; jmc

inst/unitTests/testRcppClass/NAMESPACE

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
useDynLib(testRcppClass)
2-
## until 2.15.1 the namespace load fails to find patterns at load time
3-
## exportPattern("^[[:alpha:]]+")
4-
import(Rcpp)
2+
import(Rcpp,methods)
53

64
export(genWorld, stdNumeric, rcpp_hello_world,
75
bar, foo, baz, baz1)

inst/unitTests/testRcppClass/R/load.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
setRcppClass("World", module = "yada", fields = list(more = "character"),
2-
methods = list(test = function(what) message("Testing: ", what, "; ", more)),
3-
saveAs = "genWorld"
4-
)
2+
methods = list(test = function(what) message("Testing: ", what, "; ", more)),
3+
saveAs = "genWorld"
4+
)
55

66
setRcppClass("stdNumeric", "vec", "stdVector")
77

@@ -46,6 +46,6 @@ evalqOnLoad({
4646

4747
## For R 2.15.1 and later this also works. Note that calling loadModule() triggers
4848
## a load action, so this does not have to be placed in .onLoad() or evalqOnLoad().
49-
#loadModule("NumEx", TRUE)
50-
#loadModule("yada", TRUE)
51-
#loadModule("stdVector", TRUE)
49+
loadModule("NumEx", TRUE)
50+
loadModule("yada", TRUE)
51+
loadModule("stdVector", TRUE)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

22
rcpp_hello_world <- function(){
3-
.Call( "rcpp_hello_world", PACKAGE = "testLoadModule" )
3+
.Call("rcpp_hello_world", PACKAGE = "testRcppClass")
44
}
55

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
\name{Rcpp Modules Examples}
2+
\alias{Num}
3+
\alias{World}
4+
\alias{bar}
5+
\alias{bla}
6+
\alias{baz}
7+
\alias{bla1}
8+
\alias{baz1}
9+
\alias{bla2}
10+
\alias{foo}
11+
\alias{vec}
12+
\alias{hello}
13+
\alias{genWorld}
14+
\alias{stdNumeric}
15+
\alias{Rcpp_Num-class}
16+
\alias{Rcpp_World-class}
17+
\alias{Rcpp_vec-class}
18+
\alias{stdNumeric-class}
19+
\alias{World-class}
20+
\alias{C++Object-class}
21+
\title{
22+
Functions and Objects created by Rcpp Modules Example
23+
}
24+
\description{
25+
These function and objects are accessible from R via the Rcpp Modules mechanism
26+
which creates them based on the declaration in the C++ file.
27+
}
28+
\seealso{
29+
The Rcpp Modules vignette.
30+
}

inst/unitTests/testRcppClass/src/stdVector.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2+
13
#include "rcpp_hello_world.h"
24

35
// convenience typedef
@@ -9,16 +11,16 @@ void vec_assign( vec* obj, Rcpp::NumericVector data ){
911
}
1012

1113
void vec_insert( vec* obj, int position, Rcpp::NumericVector data){
12-
vec::iterator it = obj->begin() + position ;
13-
obj->insert( it, data.begin(), data.end() ) ;
14+
vec::iterator it = obj->begin() + position ;
15+
obj->insert( it, data.begin(), data.end() ) ;
1416
}
1517

1618
Rcpp::NumericVector vec_asR( vec* obj ){
17-
return Rcpp::wrap( *obj ) ;
19+
return Rcpp::wrap( *obj ) ;
1820
}
1921

2022
void vec_set( vec* obj, int i, double value ){
21-
obj->at( i ) = value ;
23+
obj->at( i ) = value ;
2224
}
2325

2426
void vec_resize( vec* obj, int n){ obj->resize( n ) ; }

0 commit comments

Comments
 (0)