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

#include <DAFParser.hpp>

+ 类 ast::DAFParser 继承关系图:

Public 类型

using Record = std::array<char, 1024>
 

Public 成员函数

 DAFParser (StringView filepath)
 
errc_t parse ()
 
errc_t parse (StringView filepath)
 
bool isValidFile () const
 
size_t readRecord (int recordIndex, void *buffer, size_t size) const
 
size_t readFileRecord (void *buffer, size_t size) const
 
errc_t getFileRecord (Record &fileRecord) const
 
errc_t getSummaryRecords (std::vector< Record > &summaryRecords) const
 
errc_t getFileRecord (int &nd, int &ni, int &fward, int &bward, int &free) const
 
errc_t getComment (std::string &comment) const
 
errc_t getComment (std::vector< std::string > &comments) const
 
void printComment (std::FILE *fp=stdout) const
 
void open (StringView filepath)
 
- Public 成员函数 继承自 ast::BaseParser
 BaseParser (StringView filepath)
 
void open (StringView filepath)
 
bool isOpen () const
 
void close ()
 
void seek (std::streamoff pos, std::ios::seekdir dir)
 
std::streamoff tell ()
 
bool eof () const
 
size_t read (void *buffer, size_t size, size_t pos) const
 
StringView getLineWithNewline ()
 
StringView getLine ()
 
StringView getLineTrim ()
 
StringView getLineSkipHashComment ()
 
int getLineNumber ()
 
std::string getFilePath () const
 
void setBorrowedFile (FILE *file)
 
void setOwnedFile (FILE *file)
 
FILE * getFile () const
 

Protected 成员函数

errc_t runTest ()
 
errc_t readSummaryRecords (int fward, int bward, std::vector< Record > &summaryRecords) const
 
const DAF_FileRecordgetFileRecord () const
 

Protected 属性

Record fileRecord_
 
bool isValidFile_ =false
 
bool isSameEndian_ =false
 
- Protected 属性 继承自 ast::BaseParser
FILE * file_ {nullptr}
 
bool fileBorrowed_ {false}
 
std::vector< char > lineBuffer_
 

详细描述

SPICE 双精度数组文件解析器 DAF(Double Precision Array File,双精度数组文件)

待办事项
在读取数据时需要处理数据的大小端问题

该类用于解析SPICE的双精度数组文件(DAF),提取其中的数组数据。

警告
该类型的单个实例暂不支持多线程并发访问

成员函数说明

◆ getComment() [1/2]

errc_t ast::DAFParser::getComment ( std::string & comment) const

获取文件注释

参数
comment接收文件注释的字符串引用
返回
成功返回0,否则返回错误码

◆ getComment() [2/2]

errc_t ast::DAFParser::getComment ( std::vector< std::string > & comments) const

获取文件注释

参数
comment接收文件注释的字符串向量引用
返回
成功返回0,否则返回错误码

◆ getFileRecord() [1/2]

errc_t ast::DAFParser::getFileRecord ( int & nd,
int & ni,
int & fward,
int & bward,
int & free ) const

获取文件记录头信息

参数
nd双精度分量个数 ND
ni整型分量个数 NI
fward第一个摘要记录号
bward最后一个摘要记录号
free第一个空闲字地址
返回
成功返回0,否则返回错误码

◆ getFileRecord() [2/2]

errc_t ast::DAFParser::getFileRecord ( Record & fileRecord) const

获取文件记录头

参数
fileRecord接收文件记录头的引用
返回
成功返回0,否则返回错误码

◆ getSummaryRecords()

errc_t ast::DAFParser::getSummaryRecords ( std::vector< Record > & summaryRecords) const

获取所有摘要记录

参数
summaryRecords接收摘要记录的向量
返回
成功返回实际读取的字节数

◆ isValidFile()

bool ast::DAFParser::isValidFile ( ) const

检查解析结果是否有效

返回
如果DAF文件解析成功且包含有效数据,则返回true;否则返回false

◆ open()

void ast::BaseParser::open ( StringView filepath)

打开文件

打开指定路径的文件,用于后续的解析操作。

参数
filepath文件路径视图,指定要打开的文件路径。

◆ parse() [1/2]

errc_t ast::DAFParser::parse ( )

解析DAF文件

读取文件记录头、摘要记录和名称记录。

返回
成功返回0,否则返回错误码

摘要大小 (size of a single summary)

每个摘要记录可存储的摘要个数 (number of summaries)

每个名称长度 (number of characters in a single name)

◆ parse() [2/2]

errc_t ast::DAFParser::parse ( StringView filepath)

解析指定路径的DAF文件

打开文件、解析文件记录头、摘要记录和名称记录。

参数
filepath文件路径
返回
成功返回0,否则返回错误码

◆ printComment()

void ast::DAFParser::printComment ( std::FILE * fp = stdout) const

打印文件注释到指定文件流

参数
fp文件流指针,默认输出到标准输出

◆ readFileRecord()

size_t ast::DAFParser::readFileRecord ( void * buffer,
size_t size ) const

读取文件记录头到缓冲区

参数
buffer指向接收数据的缓冲区指针
size缓冲区大小,单位为字节
返回
成功返回实际读取的字节数

◆ readRecord()

size_t ast::DAFParser::readRecord ( int recordIndex,
void * buffer,
size_t size ) const

读取指定记录索引的数据到缓冲区

参数
recordIndex记录索引,从0开始
buffer指向接收数据的缓冲区指针
size缓冲区大小,单位为字节
返回
成功返回实际读取的字节数

◆ runTest()

errc_t ast::DAFParser::runTest ( )
protected

摘要大小 (size of a single summary)

每个摘要记录可存储的摘要个数 (number of summaries)

每个名称长度 (number of characters in a single name)


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