🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
TraitValue.hpp
浏览该文件的文档.
1
20
21#pragma once
22
23#include "AstGlobal.h"
24#include "TraitObject.hpp"
25
26AST_NAMESPACE_BEGIN
27
29{
30public:
31 virtual ~IValuePrv(){}
32 virtual errc_t getValue(const TimePoint& tp, double& value) const = 0;
33 virtual Type* type() const = 0;
34
35};
36
37template<typename T>
38class ImplFor<IValuePrv, T> : public TraitObject<IValuePrv>
39{
40public:
42 ImplFor(T* obj)
43 :Base{ obj }
44 {}
45 ImplFor(const T& obj)
46 :Base{ (void*) & obj}
47 {}
48 Type* type() const override
49 {
50 return T::staticType();
51 }
52 errc_t getPosIn(Frame* frame, const TimePoint& tp, Vector3d& pos) const override
53 {
54 return get()->getPosIn(frame, tp, pos);
55 }
56 errc_t getPosVelIn(Frame* frame, const TimePoint& tp, Vector3d& pos, Vector3d& vel) const override
57 {
58 return get()->getPosVelIn(frame, tp, pos, vel);
59 }
60 T* get() const
61 {
62 return (T*)data_;
63 }
64};
65
66
67
68AST_NAMESPACE_END
69
类元信息
定义 Class.hpp:40
坐标系类
定义 Frame.hpp:60
定义 TraitValue.hpp:29
定义 TraitObject.hpp:39
绝对时间点
定义 TimePoint.hpp:106
定义 TraitObject.hpp:30