🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
State.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "AstUtil/Object.hpp"
25#include "AstCore/Frame.hpp"
26#include "AstCore/EventTime.hpp"
27
28AST_NAMESPACE_BEGIN
29
35class CartState;
36
38enum class EStateType
39{
42 eUnknown,
43};
44
45class State;
46using PState = State*;
47using HState = SharedPtr<State>;
48
52class AST_CORE_API State: public Object
53{
54public:
55 State() = default;
56 ~State() override = default;
57
61 static HState MakeShared(EStateType type);
62
67 static HState MakeShared(State& state, EStateType type);
68
69
73 static PState New(EStateType type);
74
75
80 static PState New(State& state, EStateType type);
81protected:
82 State(const State& state) = default; // 怎么处理深拷贝? 现在默认浅拷贝
83public:
86 virtual EStateType getStateType() const = 0;
87
91 virtual errc_t getState(CartState& state) const = 0;
92
96 virtual errc_t setState(const CartState& state) = 0;
97public:
99 Frame* getFrame() const{ return frame_.get(); }
100
102 void setFrame(Frame* frame);
103
107 errc_t changeFrame(Frame* frame);
108
111 void setStateEpoch(EventTime* stateEpoch);
112
115 void setStateEpoch(const TimePoint& stateEpoch);
116
120 errc_t getStateEpoch(TimePoint& stateEpoch) const;
121
124 TimePoint getStateEpoch() const;
125
129
131 Body* getBody() const;
132
135 double getBodyRadius() const;
136
139 double getGM() const { return gm_; }
140
143 void setGM(double gm){ gm_ = gm; }
144public:
149 errc_t getStateInBodyInertial(Body* body, CartState& state) const;
150
155 errc_t getStateIn(Frame* frame, CartState& state) const;
156
157public:
158
159
160#if 0
161// 这些与历元坐标系定义相关的接口增加了类设计的复杂度
162// 应该考虑如何将历元坐标系相关逻辑放在该类的顶层模块,不在这里处理相关逻辑
163public: // 与历元坐标系定义相关的接口:
164 void setCoordEpoch(EventTime* coordEpoch);
165
166 void setCoordEpoch(const TimePoint& coordEpoch);
167
168 errc_t getCoordEpoch(TimePoint& coordEpoch) const;
169
170 bool getUseCoordEpoch() const;
171
172 void setUseCoordEpoch(bool useCoordEpoch);
173
174 void setCoordAxes(Axes* axes);
175
176 errc_t changeCoordAxes(Axes* axes);
177
178 Axes* getCoordAxes() const;
179#endif
180
181protected:
183 double gm_{0};
185};
186
189AST_NAMESPACE_END
轴系类
定义 Axes.hpp:69
直角坐标
定义 OrbitElement.hpp:46
天体
定义 CelestialBody.hpp:52
事件时间
定义 EventTime.hpp:42
坐标系类
定义 Frame.hpp:59
对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能
定义 Object.hpp:81
航天器状态
定义 State.hpp:53
virtual errc_t getState(CartState &state) const =0
获取状态
virtual EStateType getStateType() const =0
获取状态类型
double getGM() const
获取引力常数
定义 State.hpp:139
virtual errc_t setState(const CartState &state)=0
设置状态
Frame * getFrame() const
获取参考坐标系
定义 State.hpp:99
SharedPtr< EventTime > & getStateEpochHandle()
获取状态历元时间句柄
定义 State.hpp:128
void setGM(double gm)
设置引力常数
定义 State.hpp:143
SharedPtr< EventTime > stateEpoch_
状态历元时间
定义 State.hpp:184
SharedPtr< Frame > frame_
参考坐标系
定义 State.hpp:182
绝对时间点
定义 TimePoint.hpp:106
EStateType
状态类型
定义 State.hpp:39
@ eCartesian
笛卡尔状态
@ eKeplerian
开普勒状态
@ eUnknown
未知插值方法
定义 STKEphemerisFileParser.cpp:43