|
🛰️航天仿真算法库 SpaceAST 0.0.1
|
#include <SpiceApi.hpp>
Public 类型 | |
| enum | { ifurnsh = 0 , ispkgeo , ispklef , ispkuef , iktotal , ibodc2n , ierract , ifailed , ireset , numfunctions } |
| using | funcarray = std::array<void*, numfunctions> |
Public 成员函数 | |
| SpiceApi ()=default | |
| SpiceApi (bool shouldLoadDynamicLib) | |
| errc_t | load (StringView libpath) |
| errc_t | tryload (const std::vector< std::string > &libpaths) |
| errc_t | unload () |
| bool | isLoaded () const |
| errc_t | furnsh (const char *libpath) |
| errc_t | spkgeo (int targ, double et, const char *ref, int obs, double state[6], double *lt) |
| errc_t | spklef (const char *libpath, int *handle) |
| errc_t | spkuef (int handle) |
| errc_t | ktotal (const char *kind, int *count) |
| int | ktotal (const char *kind) |
| void | bodc2n (int code, int namlen, char *name, bool *found) |
| errc_t | bodc2n (int code, std::string &name) |
| bool | failed () |
| void | reset () |
| void | erract (const char *operation, int lenout, char *action) |
静态 Public 成员函数 | |
| static SpiceApi * | Instance () |
Protected 成员函数 | |
| errc_t | checkerror () |
| A_DISABLE_COPY (SpiceApi) | |
Protected 属性 | |
| void * | library_ {nullptr} |
| std::vector< uint32_t > | spk_handles_ |
| funcarray | functions_ {} |
| std::mutex | mutex_ |
Spice API
处理CSPICE库的动态加载、卸载、函数调用等
| ast::SpiceApi::SpiceApi | ( | bool | shouldLoadDynamicLib | ) |
| shouldLoadDynamicLib | 是否自动加载动态库 |
| void ast::SpiceApi::erract | ( | const char * | operation, |
| int | lenout, | ||
| char * | action ) |
错误处理函数
| action | 错误处理操作 |
| bool ast::SpiceApi::failed | ( | ) |
检查是否发生错误
| errc_t ast::SpiceApi::furnsh | ( | const char * | libpath | ) |
加载spice内核文件
| libpath | 内核文件路径 |
|
static |
获取单例实例
|
inline |
检查是否加载了库
| errc_t ast::SpiceApi::ktotal | ( | const char * | kind, |
| int * | count ) |
获取已加载的内核数量
| kind | 内核类型 |
| count | 内核数量 |
| errc_t ast::SpiceApi::load | ( | StringView | libpath | ) |
| libpath | 库路径 |
| errc_t ast::SpiceApi::spkgeo | ( | int | targ, |
| double | et, | ||
| const char * | ref, | ||
| int | obs, | ||
| double | state[6], | ||
| double * | lt ) |
计算spice位置
| targ | 目标体ID |
| et | 时间,相对于J2000.0 TDB的秒数,并以TDB为时间递进尺度 |
| ref | 参考系 |
| obs | 观察者ID |
| state | 状态向量 |
| lt | 光行时 |
| errc_t ast::SpiceApi::spklef | ( | const char * | libpath, |
| int * | handle ) |
加载SPK内核文件
在CSPICE的接口基础上增加了引用计数机制
| libpath | 内核文件路径 |
| handle | 内核句柄 |
| errc_t ast::SpiceApi::spkuef | ( | int | handle | ) |
鞋子SPK内核文件
在CSPICE的接口基础上增加了引用计数机制
| handle | 内核句柄 |
| errc_t ast::SpiceApi::tryload | ( | const std::vector< std::string > & | libpaths | ) |
尝试加载库
尝试加载库,指定多个可能的库路径,直到成功加载为止。
| libpaths | 库路径列表 |
| errc_t ast::SpiceApi::unload | ( | ) |
卸载库