|
🛰️航天仿真算法库 SpaceAST 0.0.1
|
#include <IntervalList.hpp>
Public 类型 | |
| using | iterator = std::vector<Interval>::iterator |
| using | const_iterator = std::vector<Interval>::const_iterator |
Public 成员函数 | |
| IntervalList ()=default | |
| ~IntervalList ()=default | |
| IntervalList (const IntervalList &)=default | |
| IntervalList & | operator= (const IntervalList &)=default |
| IntervalList (IntervalList &&) noexcept=default | |
| IntervalList & | operator= (IntervalList &&) noexcept=default |
| IntervalList (std::initializer_list< Interval > il) | |
| IntervalList (const std::vector< Interval > &intervals) | |
| IntervalList (std::vector< Interval > &&intervals) | |
| size_t | size () const noexcept |
| bool | empty () const noexcept |
| void | reserve (size_t n) |
| void | clear () |
| Interval & | operator[] (size_t i) |
| const Interval & | operator[] (size_t i) const |
| Interval & | at (size_t i) |
| const Interval & | at (size_t i) const |
| iterator | begin () |
| iterator | end () |
| const_iterator | begin () const |
| const_iterator | end () const |
| void | push_back (const Interval &interval) |
| void | push_back (double start, double stop) |
| void | pop_back () |
| std::vector< Interval > & | intervals () noexcept |
| const std::vector< Interval > & | intervals () const noexcept |
| double | totalDuration () const |
| bool | contains (double t) const |
| AST_CORE_API IntervalList | merged () const |
| AST_CORE_API void | mergeInPlace () |
| AST_CORE_API IntervalList | intersect (const IntervalList &other) const |
| AST_CORE_API IntervalList | unite (const IntervalList &other) const |
| AST_CORE_API IntervalList | subtract (const IntervalList &other) const |
| AST_CORE_API TimeList | discrete (const TimePoint &epoch, double step) const |
静态 Public 成员函数 | |
| static AST_CORE_API IntervalList | FromIntervals (const std::vector< Interval > &intervals) |
相对时段列表
相对时段列表以 std::vector<Interval> 的形式存储一组相对时间区间。
存储模型:
不假设列表有序或非重叠。使用方式与 std::vector<Interval> 一致, 同时提供集合运算方法(合并、交集、并集、差集)。
典型用途:
|
inline |
从初始化列表构造
| il | 初始化列表 |
|
inline |
访问第 i 个区间(边界检查)
| i | 索引 |
|
inline |
访问第 i 个区间(边界检查)
| i | 索引 |
|
inline |
检查时间点 t 是否落在任一区间内
| t | 时间点(相对秒数) |
|
static |
| IntervalList ast::IntervalList::intersect | ( | const IntervalList & | other | ) | const |
交集:同时属于当前列表和 other 的时段
| other | 另一个时段列表 |
| IntervalList ast::IntervalList::merged | ( | ) | const |
| void ast::IntervalList::mergeInPlace | ( | ) |
|
inline |
访问第 i 个区间(无边界检查)
| i | 索引 |
|
inline |
访问第 i 个区间(无边界检查)
| i | 索引 |
|
inline |
移除最后一个区间
|
inline |
追加一个区间
| interval | 区间 |
|
inline |
追加一个区间
| start | 开始时间(秒) |
| stop | 结束时间(秒) |
| IntervalList ast::IntervalList::subtract | ( | const IntervalList & | other | ) | const |
差集:属于当前列表但不属于 other 的时段
| other | 另一个时段列表 |
|
inline |
总时长(所有区间 duration 之和,不考虑重叠;反向区间贡献为 0)
| IntervalList ast::IntervalList::unite | ( | const IntervalList & | other | ) | const |
并集:属于当前列表或 other 的时段
| other | 另一个时段列表 |