|
| 1 | +/* |
| 2 | + * R : A Computer Language for Statistical Data Analysis |
| 3 | + * Copyright (C) 2001-2025 The R Core Team. |
| 4 | + * |
| 5 | + * This header file is free software; you can redistribute it and/or modify |
| 6 | + * it under the terms of the GNU Lesser General Public License as published by |
| 7 | + * the Free Software Foundation; either version 2.1 of the License, or |
| 8 | + * (at your option) any later version. |
| 9 | + * |
| 10 | + * This file is part of R. R is distributed under the terms of the |
| 11 | + * GNU General Public License, either Version 2, June 1991 or Version 3, |
| 12 | + * June 2007. See doc/COPYRIGHTS for details of the copyright status of R. |
| 13 | + * |
| 14 | + * This program is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU Lesser General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU Lesser General Public License |
| 20 | + * along with this program; if not, a copy is available at |
| 21 | + * https://www.R-project.org/Licenses/ |
| 22 | + */ |
| 23 | + |
| 24 | +/* |
| 25 | + Not part of the API, subject to change at any time. |
| 26 | +*/ |
| 27 | + |
| 28 | +#ifndef R_OBJECTTABLE_H |
| 29 | +#define R_OBJECTTABLE_H |
| 30 | + |
| 31 | +#include <Rinternals.h> |
| 32 | + |
| 33 | +#ifdef __cplusplus |
| 34 | +extern "C" { |
| 35 | +#endif |
| 36 | + |
| 37 | +/* |
| 38 | + The following definitions are for callbacks to R functions and |
| 39 | + methods related to user-level tables. This was implemented in a |
| 40 | + separate package formerly available from Omegahat and these |
| 41 | + declarations allow the package to interface to the internal R code. |
| 42 | + |
| 43 | + See https://developer.r-project.org/RObjectTables.pdf. |
| 44 | +*/ |
| 45 | + |
| 46 | +typedef struct _R_ObjectTable R_ObjectTable; |
| 47 | + |
| 48 | +/* Do we actually need the exists() since it is never called but R |
| 49 | + uses get to see if the symbol is bound to anything? */ |
| 50 | +typedef Rboolean (*Rdb_exists)(const char * const name, Rboolean *canCache, R_ObjectTable *); |
| 51 | +typedef SEXP (*Rdb_get)(const char * const name, Rboolean *canCache, R_ObjectTable *); |
| 52 | +typedef int (*Rdb_remove)(const char * const name, R_ObjectTable *); |
| 53 | +typedef SEXP (*Rdb_assign)(const char * const name, SEXP value, R_ObjectTable *); |
| 54 | +typedef SEXP (*Rdb_objects)(R_ObjectTable *); |
| 55 | +typedef Rboolean (*Rdb_canCache)(const char * const name, R_ObjectTable *); |
| 56 | + |
| 57 | +typedef void (*Rdb_onDetach)(R_ObjectTable *); |
| 58 | +typedef void (*Rdb_onAttach)(R_ObjectTable *); |
| 59 | + |
| 60 | +struct _R_ObjectTable{ |
| 61 | + int type; |
| 62 | + char **cachedNames; |
| 63 | + Rboolean active; |
| 64 | + |
| 65 | + Rdb_exists exists; |
| 66 | + Rdb_get get; |
| 67 | + Rdb_remove remove; |
| 68 | + Rdb_assign assign; |
| 69 | + Rdb_objects objects; |
| 70 | + Rdb_canCache canCache; |
| 71 | + |
| 72 | + Rdb_onDetach onDetach; |
| 73 | + Rdb_onAttach onAttach; |
| 74 | + |
| 75 | + void *privateData; |
| 76 | +}; |
| 77 | + |
| 78 | + |
| 79 | +#ifdef __cplusplus |
| 80 | +} |
| 81 | +#endif |
| 82 | + |
| 83 | +#endif /* R_OBJECTTABLE_H */ |
0 commit comments