Skip to content

Commit 2a7d6d2

Browse files
committed
Using new RcppTskit names
1 parent 33361d8 commit 2a7d6d2

File tree

7 files changed

+56
-51
lines changed

7 files changed

+56
-51
lines changed

NAMESPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
export(tc_xptr_summary2)
4-
export(ts_xptr_num_individuals2)
3+
export(rtsk_table_collection_summary2)
4+
export(rtsk_treeseq_get_num_individuals2)
55
import(RcppTskit)
66
importFrom(methods,is)
77
useDynLib(RcppTskitTestLinking, .registration = TRUE)

R/RcppExports.R

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,26 @@
88
#' ts_file <- system.file("examples", "test.trees", package = "RcppTskit")
99
#' ts <- RcppTskit::ts_load(ts_file)
1010
#' ts$num_individuals()
11-
#' ts_xptr_num_individuals2(ts$pointer)
11+
#' RcppTskit:::rtsk_treeseq_get_num_individuals(ts$xptr)
12+
#' rtsk_treeseq_get_num_individuals2(ts$xptr)
1213
#' @export
13-
ts_xptr_num_individuals2 <- function(ts) {
14-
.Call(`_RcppTskitTestLinking_ts_xptr_num_individuals2`, ts)
14+
rtsk_treeseq_get_num_individuals2 <- function(ts) {
15+
.Call(`_RcppTskitTestLinking_rtsk_treeseq_get_num_individuals2`, ts)
1516
}
1617

1718
#' @title Summarise `tskit` table collection
1819
#' @param tc an external pointer to a \code{tsk_table_collection_t} object.
1920
#' @return A list.
2021
#' @examples
2122
#' ts_file <- system.file("examples", "test.trees", package = "RcppTskit")
22-
#' tc <- RcppTskit:::tc_xptr_load(ts_file)
23-
#' RcppTskit:::tc_xptr_summary(tc)
24-
#' tc_xptr_summary2(tc) # a bit simpler at this stage ...
23+
#' tc <- RcppTskit:::tc_load(ts_file)
24+
#' RcppTskit:::rtsk_table_collection_summary(tc)
25+
#' rtsk_table_collection_summary(tc)
2526
#' tc <- RcppTskit::TableCollection$new(ts_file)
26-
#' RcppTskit:::tc_xptr_summary(tc$pointer)
27-
#' tc_xptr_summary2(tc$pointer) # a bit simpler at this stage ...
27+
#' RcppTskit:::rtsk_table_collection_summary(tc$xptr)
28+
#' rtsk_table_collection_summary2(tc$xptr)
2829
#' @export
29-
tc_xptr_summary2 <- function(tc) {
30-
.Call(`_RcppTskitTestLinking_tc_xptr_summary2`, tc)
30+
rtsk_table_collection_summary2 <- function(tc) {
31+
.Call(`_RcppTskitTestLinking_rtsk_table_collection_summary2`, tc)
3132
}
3233

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,16 @@ $tables
8585
# This demo package implemented the same function
8686
# that is available in RcppTskit, but since we here
8787
# focus just on C++ code, we have to work with the
88-
# pointer object (externalptr) `ts$pointer` and
88+
# pointer object (externalptr) `ts$xptr` and
8989
# not with the tree sequence object (TreeSequence) `ts`
90-
> ts_xptr_num_individuals2(ts$pointer)
90+
> RcppTskit:::rtsk_treeseq_get_num_individuals(ts$xptr)
91+
[1] 8
92+
> rtsk_treeseq_get_num_individuals2(ts$xptr)
9193
[1] 8
9294
```
9395

96+
See also
97+
9498
## Wrap up
9599

96100
Hopefully this demo package shows you sufficiently well on how
Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RcppExports.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@ Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
1010
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
1111
#endif
1212

13-
// ts_xptr_num_individuals2
14-
int ts_xptr_num_individuals2(const SEXP ts);
15-
RcppExport SEXP _RcppTskitTestLinking_ts_xptr_num_individuals2(SEXP tsSEXP) {
13+
// rtsk_treeseq_get_num_individuals2
14+
int rtsk_treeseq_get_num_individuals2(const SEXP ts);
15+
RcppExport SEXP _RcppTskitTestLinking_rtsk_treeseq_get_num_individuals2(SEXP tsSEXP) {
1616
BEGIN_RCPP
1717
Rcpp::RObject rcpp_result_gen;
1818
Rcpp::RNGScope rcpp_rngScope_gen;
1919
Rcpp::traits::input_parameter< const SEXP >::type ts(tsSEXP);
20-
rcpp_result_gen = Rcpp::wrap(ts_xptr_num_individuals2(ts));
20+
rcpp_result_gen = Rcpp::wrap(rtsk_treeseq_get_num_individuals2(ts));
2121
return rcpp_result_gen;
2222
END_RCPP
2323
}
24-
// tc_xptr_summary2
25-
Rcpp::List tc_xptr_summary2(const SEXP tc);
26-
RcppExport SEXP _RcppTskitTestLinking_tc_xptr_summary2(SEXP tcSEXP) {
24+
// rtsk_table_collection_summary2
25+
Rcpp::List rtsk_table_collection_summary2(const SEXP tc);
26+
RcppExport SEXP _RcppTskitTestLinking_rtsk_table_collection_summary2(SEXP tcSEXP) {
2727
BEGIN_RCPP
2828
Rcpp::RObject rcpp_result_gen;
2929
Rcpp::RNGScope rcpp_rngScope_gen;
3030
Rcpp::traits::input_parameter< const SEXP >::type tc(tcSEXP);
31-
rcpp_result_gen = Rcpp::wrap(tc_xptr_summary2(tc));
31+
rcpp_result_gen = Rcpp::wrap(rtsk_table_collection_summary2(tc));
3232
return rcpp_result_gen;
3333
END_RCPP
3434
}
3535

3636
static const R_CallMethodDef CallEntries[] = {
37-
{"_RcppTskitTestLinking_ts_xptr_num_individuals2", (DL_FUNC) &_RcppTskitTestLinking_ts_xptr_num_individuals2, 1},
38-
{"_RcppTskitTestLinking_tc_xptr_summary2", (DL_FUNC) &_RcppTskitTestLinking_tc_xptr_summary2, 1},
37+
{"_RcppTskitTestLinking_rtsk_treeseq_get_num_individuals2", (DL_FUNC) &_RcppTskitTestLinking_rtsk_treeseq_get_num_individuals2, 1},
38+
{"_RcppTskitTestLinking_rtsk_table_collection_summary2", (DL_FUNC) &_RcppTskitTestLinking_rtsk_table_collection_summary2, 1},
3939
{NULL, NULL, 0}
4040
};
4141

src/test.cpp

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
//' ts_file <- system.file("examples", "test.trees", package = "RcppTskit")
1010
//' ts <- RcppTskit::ts_load(ts_file)
1111
//' ts$num_individuals()
12-
//' ts_xptr_num_individuals2(ts$pointer)
12+
//' RcppTskit:::rtsk_treeseq_get_num_individuals(ts$xptr)
13+
//' rtsk_treeseq_get_num_individuals2(ts$xptr)
1314
//' @export
1415
// [[Rcpp::export]]
15-
int ts_xptr_num_individuals2(const SEXP ts) {
16-
RcppTskit_treeseq_xptr ts_xptr(ts);
16+
int rtsk_treeseq_get_num_individuals2(const SEXP ts) {
17+
rtsk_treeseq_t ts_xptr(ts);
1718
return static_cast<int>(tsk_treeseq_get_num_individuals(ts_xptr));
1819
}
1920

@@ -22,16 +23,13 @@ int ts_xptr_num_individuals2(const SEXP ts) {
2223
//' @return A list.
2324
//' @examples
2425
//' ts_file <- system.file("examples", "test.trees", package = "RcppTskit")
25-
//' tc <- RcppTskit:::tc_xptr_load(ts_file)
26-
//' RcppTskit:::tc_xptr_summary(tc)
27-
//' tc_xptr_summary2(tc) # a bit simpler at this stage ...
28-
//' tc <- RcppTskit::TableCollection$new(ts_file)
29-
//' RcppTskit:::tc_xptr_summary(tc$pointer)
30-
//' tc_xptr_summary2(tc$pointer) # a bit simpler at this stage ...
26+
//' tc <- RcppTskit:::tc_load(ts_file)
27+
//' RcppTskit:::rtsk_table_collection_summary(tc$xptr)
28+
//' rtsk_table_collection_summary2(tc$xptr)
3129
//' @export
3230
// [[Rcpp::export]]
33-
Rcpp::List tc_xptr_summary2(const SEXP tc) {
34-
RcppTskit_table_collection_xptr tc_xptr(tc);
31+
Rcpp::List rtsk_table_collection_summary2(const SEXP tc) {
32+
rtsk_table_collection_t tc_xptr(tc);
3533
const tsk_table_collection_t *tables = tc_xptr;
3634
return Rcpp::List::create(
3735
Rcpp::_["num_provenances"] = tables->provenances.num_rows,
@@ -43,8 +41,9 @@ Rcpp::List tc_xptr_summary2(const SEXP tc) {
4341
Rcpp::_["num_sites"] = tables->sites.num_rows,
4442
Rcpp::_["num_mutations"] = tables->mutations.num_rows,
4543
Rcpp::_["sequence_length"] = tables->sequence_length,
46-
Rcpp::_["has_reference_sequence"] = tc_xptr_has_reference_sequence(tc),
47-
Rcpp::_["time_units"] = tc_xptr_time_units(tc),
48-
Rcpp::_["file_uuid"] = tc_xptr_file_uuid(tc),
49-
Rcpp::_["has_index"] = tc_xptr_has_index(tc));
44+
Rcpp::_["has_reference_sequence"] =
45+
rtsk_table_collection_has_reference_sequence(tc),
46+
Rcpp::_["time_units"] = rtsk_table_collection_get_time_units(tc),
47+
Rcpp::_["file_uuid"] = rtsk_table_collection_get_file_uuid(tc),
48+
Rcpp::_["has_index"] = rtsk_table_collection_has_index(tc));
5049
}

0 commit comments

Comments
 (0)