@@ -241,18 +241,26 @@
Loading
241 241
  // calling environment
242 242
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
243 243
  
244 -
  // duplicate listener method
245 -
  SEXP duplicate_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_DUPLICATE));
246 -
  
247 -
  // na_rm argument
248 -
  SEXP deep_arg = PROTECT(Rf_ScalarLogical(deep));
249 -
  
250 -
  // returns SEXP (integer or double)
251 -
  SEXP custom_duplicate = PROTECT(call_dual_r_interface(duplicate_listener, user_data, deep_arg, calling_env));
244 +
  // length listener method
245 +
  SEXP full_vector_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_FULL_VECTOR));
252 246
  
253 -
  UNPROTECT(5);
247 +
  SEXP stored_full_vec = LAZYVEC_FULL_VEC(x);
254 248
  
255 -
  return custom_duplicate;
249 +
  // return dataptr of stored vector
250 +
  if (!Rf_isNull(stored_full_vec)) {
251 +
    UNPROTECT(3);
252 +
    return stored_full_vec;
253 +
  }
254 +
255 +
  // retrieve full vector
256 +
  SEXP full_vector = PROTECT(call_r_interface(full_vector_listener, user_data, calling_env));
257 +
258 +
  // add vector to user data
259 +
  LAZYVEC_SET_FULL_VEC(x, full_vector);
260 +
261 +
  UNPROTECT(4);
262 +
263 +
  return full_vector;
256 264
}
257 265
258 266

@@ -30,3 +30,9 @@
Loading
30 30
void lazyvec_deexpand(SEXP lazy_vec) {
31 31
  LAZYVEC_SET_FULL_VEC(lazy_vec, R_NilValue);
32 32
}
33 +
34 +
35 +
// [[Rcpp::export]]
36 +
SEXP lazyvec_is_expanded(SEXP lazy_vec) {
37 +
  return Rf_ScalarLogical(LAZYVEC_FULL_VEC(lazy_vec) != R_NilValue);
38 +
}

@@ -172,18 +172,26 @@
Loading
172 172
  // calling environment
173 173
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
174 174
  
175 -
  // duplicate listener method
176 -
  SEXP duplicate_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_DUPLICATE));
177 -
  
178 -
  // na_rm argument
179 -
  SEXP deep_arg = PROTECT(Rf_ScalarLogical(deep));
180 -
  
181 -
  // returns SEXP (integer or double)
182 -
  SEXP custom_duplicate = PROTECT(call_dual_r_interface(duplicate_listener, user_data, deep_arg, calling_env));
175 +
  // length listener method
176 +
  SEXP full_vector_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_FULL_VECTOR));
183 177
  
184 -
  UNPROTECT(5);
178 +
  SEXP stored_full_vec = LAZYVEC_FULL_VEC(x);
185 179
  
186 -
  return custom_duplicate;
180 +
  // return dataptr of stored vector
181 +
  if (!Rf_isNull(stored_full_vec)) {
182 +
    UNPROTECT(3);
183 +
    return stored_full_vec;
184 +
  }
185 +
186 +
  // retrieve full vector
187 +
  SEXP full_vector = PROTECT(call_r_interface(full_vector_listener, user_data, calling_env));
188 +
189 +
  // add vector to user data
190 +
  LAZYVEC_SET_FULL_VEC(x, full_vector);
191 +
192 +
  UNPROTECT(4);
193 +
194 +
  return full_vector;
187 195
}
188 196
189 197

@@ -287,18 +287,26 @@
Loading
287 287
  // calling environment
288 288
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
289 289
  
290 -
  // duplicate listener method
291 -
  SEXP duplicate_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_DUPLICATE));
292 -
  
293 -
  // na_rm argument
294 -
  SEXP deep_arg = PROTECT(Rf_ScalarLogical(deep));
295 -
  
296 -
  // returns SEXP (integer or double)
297 -
  SEXP custom_duplicate = PROTECT(call_dual_r_interface(duplicate_listener, user_data, deep_arg, calling_env));
290 +
  // length listener method
291 +
  SEXP full_vector_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_FULL_VECTOR));
298 292
  
299 -
  UNPROTECT(5);
293 +
  SEXP stored_full_vec = LAZYVEC_FULL_VEC(x);
300 294
  
301 -
  return custom_duplicate;
295 +
  // return dataptr of stored vector
296 +
  if (!Rf_isNull(stored_full_vec)) {
297 +
    UNPROTECT(3);
298 +
    return stored_full_vec;
299 +
  }
300 +
301 +
  // retrieve full vector
302 +
  SEXP full_vector = PROTECT(call_r_interface(full_vector_listener, user_data, calling_env));
303 +
304 +
  // add vector to user data
305 +
  LAZYVEC_SET_FULL_VEC(x, full_vector);
306 +
307 +
  UNPROTECT(4);
308 +
309 +
  return full_vector;
302 310
}
303 311
304 312

@@ -287,18 +287,26 @@
Loading
287 287
  // calling environment
288 288
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
289 289
  
290 -
  // duplicate listener method
291 -
  SEXP duplicate_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_DUPLICATE));
292 -
  
293 -
  // na_rm argument
294 -
  SEXP deep_arg = PROTECT(Rf_ScalarLogical(deep));
295 -
  
296 -
  // returns SEXP (integer or double)
297 -
  SEXP custom_duplicate = PROTECT(call_dual_r_interface(duplicate_listener, user_data, deep_arg, calling_env));
290 +
  // length listener method
291 +
  SEXP full_vector_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_FULL_VECTOR));
298 292
  
299 -
  UNPROTECT(5);
293 +
  SEXP stored_full_vec = LAZYVEC_FULL_VEC(x);
300 294
  
301 -
  return custom_duplicate;
295 +
  // return dataptr of stored vector
296 +
  if (!Rf_isNull(stored_full_vec)) {
297 +
    UNPROTECT(3);
298 +
    return stored_full_vec;
299 +
  }
300 +
301 +
  // retrieve full vector
302 +
  SEXP full_vector = PROTECT(call_r_interface(full_vector_listener, user_data, calling_env));
303 +
304 +
  // add vector to user data
305 +
  LAZYVEC_SET_FULL_VEC(x, full_vector);
306 +
307 +
  UNPROTECT(4);
308 +
309 +
  return full_vector;
302 310
}
303 311
304 312

@@ -187,18 +187,26 @@
Loading
187 187
  // calling environment
188 188
  SEXP calling_env = PROTECT(LAZYVEC_PACKAGE_ENV(x));
189 189
  
190 -
  // duplicate listener method
191 -
  SEXP duplicate_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_DUPLICATE));
192 -
  
193 -
  // na_rm argument
194 -
  SEXP deep_arg = PROTECT(Rf_ScalarLogical(deep));
195 -
  
196 -
  // returns SEXP (integer or double)
197 -
  SEXP custom_duplicate = PROTECT(call_dual_r_interface(duplicate_listener, user_data, deep_arg, calling_env));
190 +
  // length listener method
191 +
  SEXP full_vector_listener = PROTECT(VECTOR_ELT(LAZYVEC_DIAGNOSTICS(x), LAZYVEC_METHOD_FULL_VECTOR));
198 192
  
199 -
  UNPROTECT(5);
193 +
  SEXP stored_full_vec = LAZYVEC_FULL_VEC(x);
200 194
  
201 -
  return custom_duplicate;
195 +
  // return dataptr of stored vector
196 +
  if (!Rf_isNull(stored_full_vec)) {
197 +
    UNPROTECT(3);
198 +
    return stored_full_vec;
199 +
  }
200 +
201 +
  // retrieve full vector
202 +
  SEXP full_vector = PROTECT(call_r_interface(full_vector_listener, user_data, calling_env));
203 +
204 +
  // add vector to user data
205 +
  LAZYVEC_SET_FULL_VEC(x, full_vector);
206 +
207 +
  UNPROTECT(4);
208 +
209 +
  return full_vector;
202 210
}
203 211
204 212
Files Coverage
R 58.31%
src 27.30%
Project Totals (23 files) 32.06%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading