indexDemoClose            package:rindex            R Documentation

_D_e_m_o _f_u_n_c_t_i_o_n_s _f_o_r _c_r_e_a_t_i_n_g _a_n_d _r_e_m_o_v_i_n_g _e_x_t_e_r_n_a_l _p_o_i_n_t_e_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     Function 'indexDemoOpen' creates an external pointer pointing to
     an integer vector of length 'n', 'indexDemoClose' frees the memory
     linked to the pointer.

_U_s_a_g_e:

     indexDemoOpen(n = 10)
     indexDemoClose(extPtr)

_A_r_g_u_m_e_n_t_s:

  extPtr: the external pointer returned by 'indexDemoOpen' 

       n: the length of the vector stored in C RAM 

_D_e_t_a_i_l_s:

     If the returned pointer is removed finalization happens at the
     next 'gc()', if 'indexDemoClose' is used on the pointer then
     finalization happens immediately, if the pointer is then removed,
     the finalizer is called _again_ at the next 'gc()' (but doesn't
     finalize again).

_V_a_l_u_e:

     Function 'indexDemoOpen' returns an external pointer,
     'indexDemoClose' returns the integer vector previously linked by
     the pointer.

_A_u_t_h_o_r(_s):

     Jens Oehlschlgel

_R_e_f_e_r_e_n_c_e_s:

     R Development Core Team (2007). Writing R Extensions.

_S_e_e _A_l_s_o:

     'indexInit', 'indexDone', 'indexAddTree', 'indexDelTree'

_E_x_a_m_p_l_e_s:

     ptr <- indexDemoOpen()
     rm(ptr)
     gc()

     ptr <- indexDemoOpen()
     indexDemoClose(ptr)
     rm(ptr)
     gc()

