VALUE ktotal(int argc, VALUE *argv, VALUE self) { SpiceInt kernel_count; if(argc == 0) ktotal_c("ALL", &kernel_count); //Else convert Symbol to ID, ID to string if category argument supplied else ktotal_c(rb_id2name(SYM2ID(argv[0])), &kernel_count); spice_error(SHORT); return INT2FIX(kernel_count); }
static VALUE ktotal(int argc, VALUE *argv, VALUE self) { SpiceInt kernel_count; if(argc == 0) ktotal_c("ALL", &kernel_count); //Else convert Symbol to ID, ID to string if category argument supplied else ktotal_c(RB_SYM2STR(argv[0]), &kernel_count); spice_error(SPICE_ERROR_SHORT); return INT2FIX(kernel_count); }
void SpicePosition::kernels(std::vector<std::string> &list) { SpiceChar file [128]; SpiceChar filtyp[32]; SpiceChar source[128]; SpiceInt handle; SpiceBoolean found; SpiceInt count; ktotal_c ("spk", &count); for (SpiceInt i = 0; i < count; i++) { kdata_c(i, "spk", sizeof(file), sizeof(filtyp), sizeof(source), file, filtyp, source, &handle, &found); list.push_back(file); } }
/** * @brief Determine which NAIF kernels are currently loaded in the pool * * This method queries the NAIF KEEPER system/pool for all loaded kernels and * adds them to the list in this object. It only knows about kernels that are * loaded by the NAIF furnsh_c routine. If no kernels are loaded there will * be no kernels discovered by this routine. * * Upon entry into this method, the current list is discarded without * unloading them. Hence, any kernels in this list are discard, whether they * are loaded and managed by this class or not. If they are loaded according * to the internal state as determined by previous activity in this class, and * no additional NAIF activity has occured that unloads them, they should be * found again by this method. * * Note that ALL kernels discovered by this routine are marked as unmanaged, * meaning you cannot unload the kernels without exerting management upon * them via the Manage() method. See the Manage() documentation for more * details and potential issues with this feature. * * This method should not be used to update the load nature of an established * kernel list. See the UpdateLoadStatus() method for this feature. * * Here is a short coding example showing use of this method. It assumes * there are some kernels already loaded (although it is entirely possible * that no kernels are loaded). It will take over management of these kernels * as well: * * @code * Kernels myKernels; * myKernels.Discover(); * myKernels.Manage(); * @endcode * * @return int Number of kernels discovered */ int Kernels::Discover() { _kernels.clear(); SpiceInt count; ktotal_c("ALL", &count); int nfound(0); for (int i = 0 ; i < count ; i++) { SpiceChar file[128]; SpiceChar ktype[32]; SpiceChar source[128]; SpiceInt handle; SpiceBoolean found; kdata_c(i, "ALL", sizeof(file), sizeof(ktype), sizeof(source), file, ktype,source, &handle, &found); if (found == SPICETRUE) { _kernels.push_back(examine(file, false)); nfound++; } } return (nfound); }