🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::TimeIntervalList类 参考

#include <TimeIntervalList.hpp>

class  const_iterator
 

Public 类型

using iterator = const_iterator
 
using value_type = TimeInterval
 
using size_type = size_t
 
using difference_type = std::ptrdiff_t
 

Public 成员函数

 TimeIntervalList ()=default
 
 ~TimeIntervalList ()=default
 
 TimeIntervalList (const TimeIntervalList &)=default
 
TimeIntervalListoperator= (const TimeIntervalList &)=default
 
 TimeIntervalList (TimeIntervalList &&) noexcept=default
 
TimeIntervalListoperator= (TimeIntervalList &&) noexcept=default
 
 TimeIntervalList (const TimePoint &epoch)
 
size_t size () const noexcept
 
bool empty () const noexcept
 
void reserve (size_t n)
 
void clear ()
 
AST_CORE_API TimeInterval operator[] (size_t i) const
 
AST_CORE_API TimeInterval at (size_t i) const
 
AST_CORE_API void push_back (const TimeInterval &ti)
 
AST_CORE_API void push_back (const TimePoint &start, const TimePoint &stop)
 
void pop_back ()
 
const TimePointepoch () const noexcept
 
void setEpoch (const TimePoint &epoch)
 
IntervalListintervals () noexcept
 
const IntervalListintervals () const noexcept
 
double totalDuration () const
 
AST_CORE_API bool contains (const TimePoint &t) const
 
AST_CORE_API TimeIntervalList merged () const
 
AST_CORE_API void mergeInPlace ()
 
AST_CORE_API TimeIntervalListintersect (const TimeIntervalList &other)
 
AST_CORE_API TimeIntervalListunite (const TimeIntervalList &other)
 
AST_CORE_API TimeIntervalListsubtract (const TimeIntervalList &other)
 
AST_CORE_API TimeIntervalList intersected (const TimeIntervalList &other) const
 
AST_CORE_API bool intersects (const TimeIntervalList &other) const
 
AST_CORE_API TimeIntervalList united (const TimeIntervalList &other) const
 
AST_CORE_API TimeIntervalList subtracted (const TimeIntervalList &other) const
 
TimeIntervalListoperator&= (const TimeIntervalList &other)
 
TimeIntervalListoperator|= (const TimeIntervalList &other)
 
TimeIntervalListoperator-= (const TimeIntervalList &other)
 
TimeIntervalList operator& (const TimeIntervalList &other) const
 
TimeIntervalList operator| (const TimeIntervalList &other) const
 
TimeIntervalList operator- (const TimeIntervalList &other) const
 
IntervalList toIntervalList () const
 
TimeList discretize (double step) const
 
TimeList discretize (const TimePoint &epoch, double step) const
 
AST_CORE_API std::string toString (int precision=kTimePointDefaultFormatPrecision) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 

静态 Public 成员函数

static AST_CORE_API TimeIntervalList FromTimeInterval (const TimeInterval &interval)
 
static AST_CORE_API TimeIntervalList FromTimeIntervals (const std::vector< TimeInterval > &intervals)
 
static AST_CORE_API TimeIntervalList FromTimeIntervals (const std::vector< TimeInterval > &intervals, const TimePoint &epoch)
 
static AST_CORE_API TimeIntervalList FromIntervals (const std::vector< Interval > &intervals, const TimePoint &epoch)
 
static AST_CORE_API TimeIntervalList FromIntervalList (const IntervalList &list, const TimePoint &epoch)
 

友元

const_iterator operator+ (const_iterator::difference_type n, const const_iterator &it)
 

详细描述

绝对时段列表

绝对时段列表以 TimePoint 历元 + IntervalList 的形式存储一组绝对时间区间。

存储模型:

  • epoch_ : TimePoint — 参考历元
  • intervals_ : IntervalList — 相对时间区间列表(相对于 epoch_ 的秒偏移量)

集合运算委托给 IntervalList,跨历元运算时自动将 other 转换到当前历元。

典型用途:

  • 卫星可见窗口分析
  • 多约束交集计算
  • 通信时段管理
  • 任务时间线规划
注解
列表可以无序。集合运算(merged、intersect 等)内部会先排序合并。
警告
跨历元集合运算需执行 O(n) 的区间转换,性能略低于同历元运算。

构造及析构函数说明

◆ TimeIntervalList()

ast::TimeIntervalList::TimeIntervalList ( const TimePoint & epoch)
inline

从参考历元构造空列表

参数
epoch参考历元

成员函数说明

◆ at()

TimeInterval ast::TimeIntervalList::at ( size_t i) const

访问第 i 个绝对区间(边界检查)

参数
i索引
返回
TimeInterval 由 epoch_ + 相对偏移计算得到(按值返回)
异常
std::out_of_range若 i >= size()

◆ contains()

bool ast::TimeIntervalList::contains ( const TimePoint & t) const

检查绝对时间点是否落在任一区间内

参数
t绝对时间点
返回
是否在任一区间内

◆ discretize() [1/2]

TimeList ast::TimeIntervalList::discretize ( const TimePoint & epoch,
double step ) const
inline

离散化(指定历元)

区间为闭区间 [start, stop],两端点均会被包含在输出中。 对每个区间按步长生成时间点序列,末端点始终被强制包含。 详见 IntervalList::discretize。

参数
epoch输出时间列表的参考历元
step步长(秒,必须 > 0)
返回
TimeList 离散化后的时间列表

◆ discretize() [2/2]

TimeList ast::TimeIntervalList::discretize ( double step) const
inline

离散化(使用当前 epoch)

区间为闭区间 [start, stop],两端点均会被包含在输出中。 对每个区间按步长生成时间点序列,末端点始终被强制包含。 详见 IntervalList::discretize。

参数
step步长(秒,必须 > 0)
返回
TimeList 离散化后的时间列表

◆ FromIntervalList()

TimeIntervalList ast::TimeIntervalList::FromIntervalList ( const IntervalList & list,
const TimePoint & epoch )
static

从相对区间列表 + 历元构造

参数
list相对区间列表
epoch参考历元
返回
TimeIntervalList

◆ FromIntervals()

TimeIntervalList ast::TimeIntervalList::FromIntervals ( const std::vector< Interval > & intervals,
const TimePoint & epoch )
static

从相对区间向量 + 历元构造

参数
intervals相对区间向量
epoch参考历元
返回
TimeIntervalList

◆ FromTimeIntervals() [1/2]

TimeIntervalList ast::TimeIntervalList::FromTimeIntervals ( const std::vector< TimeInterval > & intervals)
static

从绝对区间向量构造

以第一个区间的 start 作为 epoch,所有区间转换为相对偏移。 若 intervals 为空,返回空列表(默认 epoch)。

参数
intervals绝对区间向量
返回
TimeIntervalList

◆ FromTimeIntervals() [2/2]

TimeIntervalList ast::TimeIntervalList::FromTimeIntervals ( const std::vector< TimeInterval > & intervals,
const TimePoint & epoch )
static

从绝对区间向量构造(指定历元)

参数
intervals绝对区间向量
epoch参考历元
返回
TimeIntervalList

◆ intersect()

TimeIntervalList & ast::TimeIntervalList::intersect ( const TimeIntervalList & other)

原地交集:将自身替换为「同时属于当前列表和 other 的时段」

参数
other另一个绝对时段列表
返回
*this
注解
若 other 的历元不同,自动转换到当前历元后再运算。 若需保留原始数据,请使用 intersected() 获取副本。

◆ intersected()

TimeIntervalList ast::TimeIntervalList::intersected ( const TimeIntervalList & other) const

交集(返回副本):同时属于当前列表和 other 的时段

参数
other另一个绝对时段列表
返回
交集(不修改当前对象)
注解
若 other 的历元不同,自动转换到当前历元后再运算。

◆ intersects()

bool ast::TimeIntervalList::intersects ( const TimeIntervalList & other) const

判断两个绝对时段列表是否相交(存在正长度重叠区间)

参数
other另一个绝对时段列表
返回
是否相交
注解
若 other 的历元不同,自动转换到当前历元后再运算。

◆ intervals()

IntervalList & ast::TimeIntervalList::intervals ( )
inlinenoexcept

获取底层相对区间列表(可修改)

警告
修改底层列表不会自动调整 epoch,调用者需自行保证一致性。

◆ merged()

TimeIntervalList ast::TimeIntervalList::merged ( ) const

合并重叠/相邻区间

返回排序后无重叠的区间列表。

返回
合并后的 TimeIntervalList

◆ mergeInPlace()

void ast::TimeIntervalList::mergeInPlace ( )

原地合并重叠/相邻区间

直接修改当前对象,将其区间排序后合并重叠或相邻的区间。 合并后列表有序且无重叠。

注解
若需保留原始数据,请使用 merged() 获取副本。

◆ operator[]()

TimeInterval ast::TimeIntervalList::operator[] ( size_t i) const

访问第 i 个绝对区间(无边界检查)

参数
i索引
返回
TimeInterval 由 epoch_ + 相对偏移计算得到(按值返回)

◆ pop_back()

void ast::TimeIntervalList::pop_back ( )
inline

移除最后一个区间

警告
调用前应确保列表非空,否则行为未定义(与 std::vector 一致)

◆ push_back() [1/2]

void ast::TimeIntervalList::push_back ( const TimeInterval & ti)

追加一个绝对区间

参数
ti绝对时间区间

◆ push_back() [2/2]

void ast::TimeIntervalList::push_back ( const TimePoint & start,
const TimePoint & stop )

通过起止时间点追加绝对区间

参数
start开始时间点
stop结束时间点

◆ setEpoch()

void ast::TimeIntervalList::setEpoch ( const TimePoint & epoch)
inline

设置参考历元

警告
仅当列表为空时调用才是安全的。若列表非空, 已有的相对偏移仍相对于旧历元,将导致元素访问返回错误结果。

◆ subtract()

TimeIntervalList & ast::TimeIntervalList::subtract ( const TimeIntervalList & other)

原地差集:将自身替换为「属于当前列表但不属于 other 的时段」

参数
other另一个绝对时段列表
返回
*this(*this - other)
注解
若 other 的历元不同,自动转换到当前历元后再运算。 若需保留原始数据,请使用 subtracted() 获取副本。

◆ subtracted()

TimeIntervalList ast::TimeIntervalList::subtracted ( const TimeIntervalList & other) const

差集(返回副本):属于当前列表但不属于 other 的时段

参数
other另一个绝对时段列表
返回
差集(*this - other,不修改当前对象)
注解
若 other 的历元不同,自动转换到当前历元后再运算。

◆ toIntervalList()

IntervalList ast::TimeIntervalList::toIntervalList ( ) const
inline

转换为相对区间列表

返回
当前 intervals_ 的副本

◆ toString()

std::string ast::TimeIntervalList::toString ( int precision = kTimePointDefaultFormatPrecision) const

转换为字符串进行展示

参数
precision时间点格式化精度
返回
字符串表示

◆ unite()

TimeIntervalList & ast::TimeIntervalList::unite ( const TimeIntervalList & other)

原地并集:将自身替换为「属于当前列表或 other 的时段」

参数
other另一个绝对时段列表
返回
*this
注解
若 other 的历元不同,自动转换到当前历元后再运算。 若需保留原始数据,请使用 united() 获取副本。

◆ united()

TimeIntervalList ast::TimeIntervalList::united ( const TimeIntervalList & other) const

并集(返回副本):属于当前列表或 other 的时段

参数
other另一个绝对时段列表
返回
并集(不修改当前对象)
注解
若 other 的历元不同,自动转换到当前历元后再运算。

该类的文档由以下文件生成: